diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateCollection.cs index 5fb26127641ba..107c34272bc36 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_AppCertificateCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListCertificatesByResourceGroup() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListCertificatesByResourceGroup.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListCertificatesByResourceGroup.json // this example is just showing the usage of "Certificates_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetAll_ListCertificatesByResourceGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetCertificate() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetCertificate.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetCertificate.json // this example is just showing the usage of "Certificates_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -90,7 +90,7 @@ public async Task Get_GetCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetCertificate() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetCertificate.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetCertificate.json // this example is just showing the usage of "Certificates_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -120,7 +120,7 @@ public async Task Exists_GetCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetCertificate() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetCertificate.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetCertificate.json // this example is just showing the usage of "Certificates_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -162,7 +162,7 @@ public async Task GetIfExists_GetCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateCertificate() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/CreateOrUpdateCertificate.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateCertificate.json // this example is just showing the usage of "Certificates_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateResource.cs index b5785192ff003..4ac4434bdfb7a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppCertificateResource.cs @@ -21,7 +21,7 @@ public partial class Sample_AppCertificateResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAppCertificates_ListCertificatesForSubscription() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListCertificates.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListCertificates.json // this example is just showing the usage of "Certificates_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task GetAppCertificates_ListCertificatesForSubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetCertificate() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetCertificate.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetCertificate.json // this example is just showing the usage of "Certificates_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -84,7 +84,7 @@ public async Task Get_GetCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteCertificate() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DeleteCertificate.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteCertificate.json // this example is just showing the usage of "Certificates_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -111,7 +111,7 @@ public async Task Delete_DeleteCertificate() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_PatchCertificate() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/PatchCertificate.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/PatchCertificate.json // this example is just showing the usage of "Certificates_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateCollection.cs new file mode 100644 index 0000000000000..836df50f52f20 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateCollection.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_AppServiceCertificateCollection + { + // List certificates by App Service Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListCertificatesByAppServiceCertificate() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/ListCertificatesByAppServiceCertificateOrder.json + // this example is just showing the usage of "AppServiceCertificateOrders_ListCertificates" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // get the collection of this AppServiceCertificateResource + AppServiceCertificateCollection collection = appServiceCertificateOrder.GetAppServiceCertificates(); + + // invoke the operation and iterate over the result + await foreach (AppServiceCertificateResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get App Service Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAppServiceCertificate() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/GetAppServiceCertificate.json + // this example is just showing the usage of "AppServiceCertificateOrders_GetCertificate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // get the collection of this AppServiceCertificateResource + AppServiceCertificateCollection collection = appServiceCertificateOrder.GetAppServiceCertificates(); + + // invoke the operation + string name = "SampleCertName1"; + AppServiceCertificateResource result = await collection.GetAsync(name); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get App Service Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAppServiceCertificate() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/GetAppServiceCertificate.json + // this example is just showing the usage of "AppServiceCertificateOrders_GetCertificate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // get the collection of this AppServiceCertificateResource + AppServiceCertificateCollection collection = appServiceCertificateOrder.GetAppServiceCertificates(); + + // invoke the operation + string name = "SampleCertName1"; + bool result = await collection.ExistsAsync(name); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get App Service Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppServiceCertificate() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/GetAppServiceCertificate.json + // this example is just showing the usage of "AppServiceCertificateOrders_GetCertificate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // get the collection of this AppServiceCertificateResource + AppServiceCertificateCollection collection = appServiceCertificateOrder.GetAppServiceCertificates(); + + // invoke the operation + string name = "SampleCertName1"; + NullableResponse response = await collection.GetIfExistsAsync(name); + AppServiceCertificateResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateCertificate() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/CreateAppServiceCertificate.json + // this example is just showing the usage of "AppServiceCertificateOrders_CreateOrUpdateCertificate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // get the collection of this AppServiceCertificateResource + AppServiceCertificateCollection collection = appServiceCertificateOrder.GetAppServiceCertificates(); + + // invoke the operation + string name = "SampleCertName1"; + AppServiceCertificateData data = new AppServiceCertificateData(new AzureLocation("Global")) + { + KeyVaultId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/testrg123/providers/microsoft.keyvault/vaults/SamplevaultName"), + KeyVaultSecretName = "SampleSecretName1", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + AppServiceCertificateResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateOrderCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateOrderCollection.cs new file mode 100644 index 0000000000000..99be143bbe033 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateOrderCollection.cs @@ -0,0 +1,217 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_AppServiceCertificateOrderCollection + { + // List App Service Certificate orders by resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAppServiceCertificateOrdersByResourceGroup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/ListAppServiceCertificateOrdersByResourceGroup.json + // this example is just showing the usage of "AppServiceCertificateOrders_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceCertificateOrderResource + AppServiceCertificateOrderCollection collection = resourceGroupResource.GetAppServiceCertificateOrders(); + + // invoke the operation and iterate over the result + await foreach (AppServiceCertificateOrderResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateOrderData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get App Service Certificate Order + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAppServiceCertificateOrder() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/GetAppServiceCertificateOrder.json + // this example is just showing the usage of "AppServiceCertificateOrders_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceCertificateOrderResource + AppServiceCertificateOrderCollection collection = resourceGroupResource.GetAppServiceCertificateOrders(); + + // invoke the operation + string certificateOrderName = "SampleCertificateOrderName"; + AppServiceCertificateOrderResource result = await collection.GetAsync(certificateOrderName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateOrderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get App Service Certificate Order + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAppServiceCertificateOrder() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/GetAppServiceCertificateOrder.json + // this example is just showing the usage of "AppServiceCertificateOrders_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceCertificateOrderResource + AppServiceCertificateOrderCollection collection = resourceGroupResource.GetAppServiceCertificateOrders(); + + // invoke the operation + string certificateOrderName = "SampleCertificateOrderName"; + bool result = await collection.ExistsAsync(certificateOrderName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get App Service Certificate Order + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAppServiceCertificateOrder() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/GetAppServiceCertificateOrder.json + // this example is just showing the usage of "AppServiceCertificateOrders_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceCertificateOrderResource + AppServiceCertificateOrderCollection collection = resourceGroupResource.GetAppServiceCertificateOrders(); + + // invoke the operation + string certificateOrderName = "SampleCertificateOrderName"; + NullableResponse response = await collection.GetIfExistsAsync(certificateOrderName); + AppServiceCertificateOrderResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateOrderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create Certificate order + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateCertificateOrder() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/CreateAppServiceCertificateOrder.json + // this example is just showing the usage of "AppServiceCertificateOrders_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceCertificateOrderResource + AppServiceCertificateOrderCollection collection = resourceGroupResource.GetAppServiceCertificateOrders(); + + // invoke the operation + string certificateOrderName = "SampleCertificateOrderName"; + AppServiceCertificateOrderData data = new AppServiceCertificateOrderData(new AzureLocation("Global")) + { + Certificates = +{ +["SampleCertName1"] = new AppServiceCertificateProperties() +{ +KeyVaultId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/testrg123/providers/microsoft.keyvault/vaults/SamplevaultName"), +KeyVaultSecretName = "SampleSecretName1", +}, +["SampleCertName2"] = new AppServiceCertificateProperties() +{ +KeyVaultId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/testrg123/providers/microsoft.keyvault/vaults/SamplevaultName"), +KeyVaultSecretName = "SampleSecretName2", +}, +}, + DistinguishedName = "CN=SampleCustomDomain.com", + ValidityInYears = 2, + KeySize = 2048, + ProductType = CertificateProductType.StandardDomainValidatedSsl, + IsAutoRenew = true, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, certificateOrderName, data); + AppServiceCertificateOrderResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateOrderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateOrderResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateOrderResource.cs new file mode 100644 index 0000000000000..b5872e7be7176 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateOrderResource.cs @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_AppServiceCertificateOrderResource + { + // List App Service Certificate orders by subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAppServiceCertificateOrders_ListAppServiceCertificateOrdersBySubscription() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/ListAppServiceCertificateOrdersBySubscription.json + // this example is just showing the usage of "AppServiceCertificateOrders_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServiceCertificateOrderResource item in subscriptionResource.GetAppServiceCertificateOrdersAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateOrderData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get App Service Certificate Order + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAppServiceCertificateOrder() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/GetAppServiceCertificateOrder.json + // this example is just showing the usage of "AppServiceCertificateOrders_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation + AppServiceCertificateOrderResource result = await appServiceCertificateOrder.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateOrderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete App Service Certificate Order + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAppServiceCertificateOrder() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/DeleteAppServiceCertificateOrder.json + // this example is just showing the usage of "AppServiceCertificateOrders_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation + await appServiceCertificateOrder.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Update Certificate order + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateCertificateOrder() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/UpdateAppServiceCertificateOrder.json + // this example is just showing the usage of "AppServiceCertificateOrders_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation + AppServiceCertificateOrderPatch patch = new AppServiceCertificateOrderPatch() + { + Certificates = +{ +["SampleCertName1"] = new AppServiceCertificateProperties() +{ +KeyVaultId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/testrg123/providers/microsoft.keyvault/vaults/SamplevaultName"), +KeyVaultSecretName = "SampleSecretName1", +}, +["SampleCertName2"] = new AppServiceCertificateProperties() +{ +KeyVaultId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/testrg123/providers/microsoft.keyvault/vaults/SamplevaultName"), +KeyVaultSecretName = "SampleSecretName2", +}, +}, + DistinguishedName = "CN=SampleCustomDomain.com", + ValidityInYears = 2, + KeySize = 2048, + ProductType = CertificateProductType.StandardDomainValidatedSsl, + IsAutoRenew = true, + }; + AppServiceCertificateOrderResource result = await appServiceCertificateOrder.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateOrderData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Reissue App Service Certificate Order + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Reissue_ReissueAppServiceCertificateOrder() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/ReissueAppServiceCertificateOrder.json + // this example is just showing the usage of "AppServiceCertificateOrders_Reissue" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation + ReissueCertificateOrderContent content = new ReissueCertificateOrderContent() + { + KeySize = 2048, + DelayExistingRevokeInHours = 2, + Csr = "CSR1223238Value", + IsPrivateKeyExternal = false, + }; + await appServiceCertificateOrder.ReissueAsync(content); + + Console.WriteLine($"Succeeded"); + } + + // Renew App Service Certificate Order + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Renew_RenewAppServiceCertificateOrder() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/RenewAppServiceCertificateOrder.json + // this example is just showing the usage of "AppServiceCertificateOrders_Renew" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation + RenewCertificateOrderContent content = new RenewCertificateOrderContent() + { + KeySize = 2048, + Csr = "CSR1223238Value", + IsPrivateKeyExternal = false, + }; + await appServiceCertificateOrder.RenewAsync(content); + + Console.WriteLine($"Succeeded"); + } + + // Resend App Service Certificate Order email + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ResendEmail_ResendAppServiceCertificateOrderEmail() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/ResendAppServiceCertificateOrderEmail.json + // this example is just showing the usage of "AppServiceCertificateOrders_ResendEmail" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation + await appServiceCertificateOrder.ResendEmailAsync(); + + Console.WriteLine($"Succeeded"); + } + + // Resend Domain Ownership verification email + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ResendRequestEmails_ResendDomainOwnershipVerificationEmail() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/ResendDomainOwnershipVerificationEmail.json + // this example is just showing the usage of "AppServiceCertificateOrders_ResendRequestEmails" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation + AppServiceDomainNameIdentifier nameIdentifier = new AppServiceDomainNameIdentifier() + { + Name = "Domain name", + }; + await appServiceCertificateOrder.ResendRequestEmailsAsync(nameIdentifier); + + Console.WriteLine($"Succeeded"); + } + + // Retrieve Site Seal + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveSiteSeal_RetrieveSiteSeal() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/RetrieveSiteSeal.json + // this example is just showing the usage of "AppServiceCertificateOrders_RetrieveSiteSeal" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertOrder"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation + SiteSealContent content = new SiteSealContent() + { + IsLightTheme = true, + Locale = "en-us", + }; + SiteSeal result = await appServiceCertificateOrder.RetrieveSiteSealAsync(content); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Verify Domain Ownership + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task VerifyDomainOwnership_VerifyDomainOwnership() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/VerifyDomainOwnership.json + // this example is just showing the usage of "AppServiceCertificateOrders_VerifyDomainOwnership" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation + await appServiceCertificateOrder.VerifyDomainOwnershipAsync(); + + Console.WriteLine($"Succeeded"); + } + + // Retrieve Certificate Order Actions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveCertificateActions_RetrieveCertificateOrderActions() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/RetrieveCertificateOrderActions.json + // this example is just showing the usage of "AppServiceCertificateOrders_RetrieveCertificateActions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "SampleCertOrder"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation and iterate over the result + await foreach (CertificateOrderAction item in appServiceCertificateOrder.RetrieveCertificateActionsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Retrieve Certificate Email History + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RetrieveCertificateEmailHistory_RetrieveCertificateEmailHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/RetrieveCertificateEmailHistory.json + // this example is just showing the usage of "AppServiceCertificateOrders_RetrieveCertificateEmailHistory" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateOrderResource created on azure + // for more information of creating AppServiceCertificateOrderResource, please refer to the document of AppServiceCertificateOrderResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "SampleCertOrder"; + ResourceIdentifier appServiceCertificateOrderResourceId = AppServiceCertificateOrderResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceCertificateOrderResource appServiceCertificateOrder = client.GetAppServiceCertificateOrderResource(appServiceCertificateOrderResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServiceCertificateEmail item in appServiceCertificateOrder.RetrieveCertificateEmailHistoryAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateResource.cs new file mode 100644 index 0000000000000..e7b199d779c0d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceCertificateResource.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_AppServiceCertificateResource + { + // Get App Service Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAppServiceCertificate() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/GetAppServiceCertificate.json + // this example is just showing the usage of "AppServiceCertificateOrders_GetCertificate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateResource created on azure + // for more information of creating AppServiceCertificateResource, please refer to the document of AppServiceCertificateResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + string name = "SampleCertName1"; + ResourceIdentifier appServiceCertificateResourceId = AppServiceCertificateResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName, name); + AppServiceCertificateResource appServiceCertificate = client.GetAppServiceCertificateResource(appServiceCertificateResourceId); + + // invoke the operation + AppServiceCertificateResource result = await appServiceCertificate.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete App Service Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAppServiceCertificate() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/DeleteAppServiceCertificate.json + // this example is just showing the usage of "AppServiceCertificateOrders_DeleteCertificate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateResource created on azure + // for more information of creating AppServiceCertificateResource, please refer to the document of AppServiceCertificateResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + string name = "SampleCertName1"; + ResourceIdentifier appServiceCertificateResourceId = AppServiceCertificateResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName, name); + AppServiceCertificateResource appServiceCertificate = client.GetAppServiceCertificateResource(appServiceCertificateResourceId); + + // invoke the operation + await appServiceCertificate.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Update Certificate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateCertificate() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/UpdateAppServiceCertificate.json + // this example is just showing the usage of "AppServiceCertificateOrders_UpdateCertificate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceCertificateResource created on azure + // for more information of creating AppServiceCertificateResource, please refer to the document of AppServiceCertificateResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string certificateOrderName = "SampleCertificateOrderName"; + string name = "SampleCertName1"; + ResourceIdentifier appServiceCertificateResourceId = AppServiceCertificateResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, certificateOrderName, name); + AppServiceCertificateResource appServiceCertificate = client.GetAppServiceCertificateResource(appServiceCertificateResourceId); + + // invoke the operation + AppServiceCertificatePatch patch = new AppServiceCertificatePatch() + { + KeyVaultId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/testrg123/providers/microsoft.keyvault/vaults/SamplevaultName"), + KeyVaultSecretName = "SampleSecretName1", + }; + AppServiceCertificateResource result = await appServiceCertificate.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceCertificateData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceDomainCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceDomainCollection.cs new file mode 100644 index 0000000000000..c8792d903efb1 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceDomainCollection.cs @@ -0,0 +1,247 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_AppServiceDomainCollection + { + // List domains by resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListDomainsByResourceGroup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/ListDomainsByResourceGroup.json + // this example is just showing the usage of "Domains_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceDomainResource + AppServiceDomainCollection collection = resourceGroupResource.GetAppServiceDomains(); + + // invoke the operation and iterate over the result + await foreach (AppServiceDomainResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceDomainData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Domain + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDomain() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetDomain.json + // this example is just showing the usage of "Domains_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceDomainResource + AppServiceDomainCollection collection = resourceGroupResource.GetAppServiceDomains(); + + // invoke the operation + string domainName = "example.com"; + AppServiceDomainResource result = await collection.GetAsync(domainName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get Domain + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetDomain() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetDomain.json + // this example is just showing the usage of "Domains_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceDomainResource + AppServiceDomainCollection collection = resourceGroupResource.GetAppServiceDomains(); + + // invoke the operation + string domainName = "example.com"; + bool result = await collection.ExistsAsync(domainName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get Domain + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDomain() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetDomain.json + // this example is just showing the usage of "Domains_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceDomainResource + AppServiceDomainCollection collection = resourceGroupResource.GetAppServiceDomains(); + + // invoke the operation + string domainName = "example.com"; + NullableResponse response = await collection.GetIfExistsAsync(domainName); + AppServiceDomainResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create App Service Domain + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateAppServiceDomain() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/CreateAppServiceDomain.json + // this example is just showing the usage of "Domains_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceDomainResource + AppServiceDomainCollection collection = resourceGroupResource.GetAppServiceDomains(); + + // invoke the operation + string domainName = "example.com"; + AppServiceDomainData data = new AppServiceDomainData(new AzureLocation("global")) + { + ContactAdmin = new RegistrationContactInfo("admin@email.com", "John", "Doe", "1-245-534-2242") + { + AddressMailing = new RegistrationAddressInfo("3400 State St", "Chicago", "United States", "67098", "IL"), + Fax = "1-245-534-2242", + JobTitle = "Admin", + NameMiddle = "", + Organization = "Microsoft Inc.", + }, + ContactBilling = new RegistrationContactInfo("billing@email.com", "John", "Doe", "1-245-534-2242") + { + AddressMailing = new RegistrationAddressInfo("3400 State St", "Chicago", "United States", "67098", "IL"), + Fax = "1-245-534-2242", + JobTitle = "Billing", + NameMiddle = "", + Organization = "Microsoft Inc.", + }, + ContactRegistrant = new RegistrationContactInfo("registrant@email.com", "John", "Doe", "1-245-534-2242") + { + AddressMailing = new RegistrationAddressInfo("3400 State St", "Chicago", "United States", "67098", "IL"), + Fax = "1-245-534-2242", + JobTitle = "Registrant", + NameMiddle = "", + Organization = "Microsoft Inc.", + }, + ContactTech = new RegistrationContactInfo("tech@email.com", "John", "Doe", "1-245-534-2242") + { + AddressMailing = new RegistrationAddressInfo("3400 State St", "Chicago", "United States", "67098", "IL"), + Fax = "1-245-534-2242", + JobTitle = "Tech", + NameMiddle = "", + Organization = "Microsoft Inc.", + }, + IsDomainPrivacyEnabled = false, + IsAutoRenew = true, + Consent = new DomainPurchaseConsent() + { + AgreementKeys = +{ +"agreementKey1" +}, + AgreedBy = "192.0.2.1", + AgreedOn = DateTimeOffset.Parse("2021-09-10T19:30:53Z"), + }, + DnsType = AppServiceDnsType.DefaultDomainRegistrarDns, + AuthCode = "exampleAuthCode", + Tags = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, domainName, data); + AppServiceDomainResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceDomainResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceDomainResource.cs index 88c07cba0f152..f791b96295873 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceDomainResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceDomainResource.cs @@ -9,17 +9,189 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.AppService.Samples { public partial class Sample_AppServiceDomainResource { + // List domains by subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAppServiceDomains_ListDomainsBySubscription() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/ListDomainsBySubscription.json + // this example is just showing the usage of "Domains_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServiceDomainResource item in subscriptionResource.GetAppServiceDomainsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceDomainData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Domain + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDomain() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetDomain.json + // this example is just showing the usage of "Domains_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceDomainResource created on azure + // for more information of creating AppServiceDomainResource, please refer to the document of AppServiceDomainResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + ResourceIdentifier appServiceDomainResourceId = AppServiceDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + AppServiceDomainResource appServiceDomain = client.GetAppServiceDomainResource(appServiceDomainResourceId); + + // invoke the operation + AppServiceDomainResource result = await appServiceDomain.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete App Service Domain + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAppServiceDomain() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/DeleteAppServiceDomain.json + // this example is just showing the usage of "Domains_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceDomainResource created on azure + // for more information of creating AppServiceDomainResource, please refer to the document of AppServiceDomainResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + ResourceIdentifier appServiceDomainResourceId = AppServiceDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + AppServiceDomainResource appServiceDomain = client.GetAppServiceDomainResource(appServiceDomainResourceId); + + // invoke the operation + bool? forceHardDeleteDomain = true; + await appServiceDomain.DeleteAsync(WaitUntil.Completed, forceHardDeleteDomain: forceHardDeleteDomain); + + Console.WriteLine($"Succeeded"); + } + + // Update App Service Domain + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateAppServiceDomain() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/UpdateAppServiceDomain.json + // this example is just showing the usage of "Domains_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceDomainResource created on azure + // for more information of creating AppServiceDomainResource, please refer to the document of AppServiceDomainResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + ResourceIdentifier appServiceDomainResourceId = AppServiceDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + AppServiceDomainResource appServiceDomain = client.GetAppServiceDomainResource(appServiceDomainResourceId); + + // invoke the operation + AppServiceDomainPatch patch = new AppServiceDomainPatch() + { + ContactAdmin = new RegistrationContactInfo("admin@email.com", "John", "Doe", "1-245-534-2242") + { + AddressMailing = new RegistrationAddressInfo("3400 State St", "Chicago", "United States", "67098", "IL"), + Fax = "1-245-534-2242", + JobTitle = "Admin", + NameMiddle = "", + Organization = "Microsoft Inc.", + }, + ContactBilling = new RegistrationContactInfo("billing@email.com", "John", "Doe", "1-245-534-2242") + { + AddressMailing = new RegistrationAddressInfo("3400 State St", "Chicago", "United States", "67098", "IL"), + Fax = "1-245-534-2242", + JobTitle = "Billing", + NameMiddle = "", + Organization = "Microsoft Inc.", + }, + ContactRegistrant = new RegistrationContactInfo("registrant@email.com", "John", "Doe", "1-245-534-2242") + { + AddressMailing = new RegistrationAddressInfo("3400 State St", "Chicago", "United States", "67098", "IL"), + Fax = "1-245-534-2242", + JobTitle = "Registrant", + NameMiddle = "", + Organization = "Microsoft Inc.", + }, + ContactTech = new RegistrationContactInfo("tech@email.com", "John", "Doe", "1-245-534-2242") + { + AddressMailing = new RegistrationAddressInfo("3400 State St", "Chicago", "United States", "67098", "IL"), + Fax = "1-245-534-2242", + JobTitle = "Tech", + NameMiddle = "", + Organization = "Microsoft Inc.", + }, + IsDomainPrivacyEnabled = false, + IsAutoRenew = true, + Consent = new DomainPurchaseConsent() + { + AgreementKeys = +{ +"agreementKey1" +}, + AgreedBy = "192.0.2.1", + AgreedOn = DateTimeOffset.Parse("2021-09-10T19:30:53Z"), + }, + DnsType = AppServiceDnsType.DefaultDomainRegistrarDns, + AuthCode = "exampleAuthCode", + }; + AppServiceDomainResource result = await appServiceDomain.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Renew an existing domain [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Renew_RenewAnExistingDomain() { - // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2021-02-01/examples/RenewDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/RenewDomain.json // this example is just showing the usage of "Domains_Renew" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -40,5 +212,36 @@ public async Task Renew_RenewAnExistingDomain() Console.WriteLine($"Succeeded"); } + + // Transfer out domain + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task TransferOut_TransferOutDomain() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/TransferOutDomain.json + // this example is just showing the usage of "Domains_TransferOut" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceDomainResource created on azure + // for more information of creating AppServiceDomainResource, please refer to the document of AppServiceDomainResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + ResourceIdentifier appServiceDomainResourceId = AppServiceDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + AppServiceDomainResource appServiceDomain = client.GetAppServiceDomainResource(appServiceDomainResourceId); + + // invoke the operation + AppServiceDomainResource result = await appServiceDomain.TransferOutAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceDomainData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceEnvironmentCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceEnvironmentCollection.cs new file mode 100644 index 0000000000000..9da13b76064d3 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceEnvironmentCollection.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_AppServiceEnvironmentCollection + { + // Get all App Service Environments in a resource group. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetAllAppServiceEnvironmentsInAResourceGroup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListByResourceGroup.json + // this example is just showing the usage of "AppServiceEnvironments_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceEnvironmentResource + AppServiceEnvironmentCollection collection = resourceGroupResource.GetAppServiceEnvironments(); + + // invoke the operation and iterate over the result + await foreach (AppServiceEnvironmentResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceEnvironmentData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get the properties of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetThePropertiesOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_Get.json + // this example is just showing the usage of "AppServiceEnvironments_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceEnvironmentResource + AppServiceEnvironmentCollection collection = resourceGroupResource.GetAppServiceEnvironments(); + + // invoke the operation + string name = "test-ase"; + AppServiceEnvironmentResource result = await collection.GetAsync(name); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the properties of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetThePropertiesOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_Get.json + // this example is just showing the usage of "AppServiceEnvironments_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceEnvironmentResource + AppServiceEnvironmentCollection collection = resourceGroupResource.GetAppServiceEnvironments(); + + // invoke the operation + string name = "test-ase"; + bool result = await collection.ExistsAsync(name); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get the properties of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetThePropertiesOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_Get.json + // this example is just showing the usage of "AppServiceEnvironments_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceEnvironmentResource + AppServiceEnvironmentCollection collection = resourceGroupResource.GetAppServiceEnvironments(); + + // invoke the operation + string name = "test-ase"; + NullableResponse response = await collection.GetIfExistsAsync(name); + AppServiceEnvironmentResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create or update an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_CreateOrUpdate.json + // this example is just showing the usage of "AppServiceEnvironments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AppServiceEnvironmentResource + AppServiceEnvironmentCollection collection = resourceGroupResource.GetAppServiceEnvironments(); + + // invoke the operation + string name = "test-ase"; + AppServiceEnvironmentData data = new AppServiceEnvironmentData(new AzureLocation("South Central US")) + { + VirtualNetwork = new AppServiceVirtualNetworkProfile(new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/delegated")), + Kind = "Asev3", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + AppServiceEnvironmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceEnvironmentResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceEnvironmentResource.cs index 1337819550f72..0067a9fe7bc39 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceEnvironmentResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServiceEnvironmentResource.cs @@ -10,17 +10,259 @@ using Azure.Core; using Azure.Identity; using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.AppService.Samples { public partial class Sample_AppServiceEnvironmentResource { - // Get Inbound Network Dependencies Endpoints + // Get all App Service Environments for a subscription. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetInboundNetworkDependenciesEndpoints_GetInboundNetworkDependenciesEndpoints() + public async Task GetAppServiceEnvironments_GetAllAppServiceEnvironmentsForASubscription() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetInboundNetworkDependenciesEndpoints.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_List.json + // this example is just showing the usage of "AppServiceEnvironments_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServiceEnvironmentResource item in subscriptionResource.GetAppServiceEnvironmentsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceEnvironmentData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get the properties of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetThePropertiesOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_Get.json + // this example is just showing the usage of "AppServiceEnvironments_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation + AppServiceEnvironmentResource result = await appServiceEnvironment.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_Delete.json + // this example is just showing the usage of "AppServiceEnvironments_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation + await appServiceEnvironment.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Create or update an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_Update.json + // this example is just showing the usage of "AppServiceEnvironments_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation + AppServiceEnvironmentPatch patch = new AppServiceEnvironmentPatch() + { + VirtualNetwork = new AppServiceVirtualNetworkProfile(new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/test-rg/providers/Microsoft.Network/virtualNetworks/test-subnet/subnets/delegated")), + FrontEndScaleFactor = 20, + }; + AppServiceEnvironmentResource result = await appServiceEnvironment.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceEnvironmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the used, available, and total worker capacity an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCapacities_GetTheUsedAvailableAndTotalWorkerCapacityAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListCapacities.json + // this example is just showing the usage of "AppServiceEnvironments_ListCapacities" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation and iterate over the result + await foreach (StampCapacity item in appServiceEnvironment.GetCapacitiesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get IP addresses assigned to an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetVipInfo_GetIPAddressesAssignedToAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetVipInfo.json + // this example is just showing the usage of "AppServiceEnvironments_GetVipInfo" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation + AppServiceEnvironmentAddressResult result = await appServiceEnvironment.GetVipInfoAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get diagnostic information for an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetDiagnostics_GetDiagnosticInformationForAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListDiagnostics.json + // this example is just showing the usage of "AppServiceEnvironments_ListDiagnostics" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation and iterate over the result + await foreach (HostingEnvironmentDiagnostics item in appServiceEnvironment.GetDiagnosticsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a diagnostics item for an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetDiagnosticsItem_GetADiagnosticsItemForAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetDiagnosticsItem.json + // this example is just showing the usage of "AppServiceEnvironments_GetDiagnosticsItem" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation + string diagnosticsName = "test-diagnostic"; + HostingEnvironmentDiagnostics result = await appServiceEnvironment.GetDiagnosticsItemAsync(diagnosticsName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get the network endpoints of all inbound dependencies of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetInboundNetworkDependenciesEndpoints_GetTheNetworkEndpointsOfAllInboundDependenciesOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetInboundNetworkDependenciesEndpoints.json // this example is just showing the usage of "AppServiceEnvironments_GetInboundNetworkDependenciesEndpoints" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -45,12 +287,96 @@ public async Task GetInboundNetworkDependenciesEndpoints_GetInboundNetworkDepend Console.WriteLine($"Succeeded"); } - // Get Outbound Network Dependencies Endpoints + // Send a test notification that an upgrade is available for this App Service Environment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task TestUpgradeAvailableNotification_SendATestNotificationThatAnUpgradeIsAvailableForThisAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_TestUpgradeAvailableNotification.json + // this example is just showing the usage of "AppServiceEnvironments_TestUpgradeAvailableNotification" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "SampleHostingEnvironment"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation + await appServiceEnvironment.TestUpgradeAvailableNotificationAsync(); + + Console.WriteLine($"Succeeded"); + } + + // Initiate an upgrade on an App Service Environment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Upgrade_InitiateAnUpgradeOnAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_Upgrade.json + // this example is just showing the usage of "AppServiceEnvironments_Upgrade" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "SampleHostingEnvironment"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation + await appServiceEnvironment.UpgradeAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // List all currently running operations on the App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetOperations_ListAllCurrentlyRunningOperationsOnTheAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListOperations.json + // this example is just showing the usage of "AppServiceEnvironments_ListOperations" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServiceOperation item in appServiceEnvironment.GetOperationsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get the network endpoints of all outbound dependencies of an App Service Environment. [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetOutboundNetworkDependenciesEndpoints_GetOutboundNetworkDependenciesEndpoints() + public async Task GetOutboundNetworkDependenciesEndpoints_GetTheNetworkEndpointsOfAllOutboundDependenciesOfAnAppServiceEnvironment() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetOutboundNetworkDependenciesEndpoints.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetOutboundNetworkDependenciesEndpoints.json // this example is just showing the usage of "AppServiceEnvironments_GetOutboundNetworkDependenciesEndpoints" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -74,5 +400,157 @@ public async Task GetOutboundNetworkDependenciesEndpoints_GetOutboundNetworkDepe Console.WriteLine($"Succeeded"); } + + // Gets the private link resources. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetPrivateLinkResources_GetsThePrivateLinkResources() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetPrivateLinkResources.json + // this example is just showing the usage of "AppServiceEnvironments_GetPrivateLinkResources" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServicePrivateLinkResourceData item in appServiceEnvironment.GetPrivateLinkResourcesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Reboot all machines in an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Reboot_RebootAllMachinesInAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_Reboot.json + // this example is just showing the usage of "AppServiceEnvironments_Reboot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation + await appServiceEnvironment.RebootAsync(); + + Console.WriteLine($"Succeeded"); + } + + // Get all App Service plans in an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAppServicePlans_GetAllAppServicePlansInAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListAppServicePlans.json + // this example is just showing the usage of "AppServiceEnvironments_ListAppServicePlans" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServicePlanResource item in appServiceEnvironment.GetAppServicePlansAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServicePlanData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get all apps in an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAllWebAppData_GetAllAppsInAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListWebApps.json + // this example is just showing the usage of "AppServiceEnvironments_ListWebApps" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation and iterate over the result + await foreach (WebSiteData item in appServiceEnvironment.GetAllWebAppDataAsync()) + { + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {item.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get global usage metrics of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetUsages_GetGlobalUsageMetricsOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListUsages.json + // this example is just showing the usage of "AppServiceEnvironments_ListUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // invoke the operation and iterate over the result + await foreach (CsmUsageQuota item in appServiceEnvironment.GetUsagesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanCollection.cs index 0812f60ab4f53..3b0ed51316feb 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_AppServicePlanCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppServicePlansByResourceGroup() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListAppServicePlansByResourceGroup.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListAppServicePlansByResourceGroup.json // this example is just showing the usage of "AppServicePlans_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_ListAppServicePlansByResourceGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppServicePlan() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetAppServicePlan.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetAppServicePlan.json // this example is just showing the usage of "AppServicePlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +91,7 @@ public async Task Get_GetAppServicePlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppServicePlan() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetAppServicePlan.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetAppServicePlan.json // this example is just showing the usage of "AppServicePlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -121,7 +121,7 @@ public async Task Exists_GetAppServicePlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppServicePlan() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetAppServicePlan.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetAppServicePlan.json // this example is just showing the usage of "AppServicePlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -163,7 +163,7 @@ public async Task GetIfExists_GetAppServicePlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateAppServicePlan() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/CreateOrUpdateAppServicePlan.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateAppServicePlan.json // this example is just showing the usage of "AppServicePlans_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanResource.cs index dfeee5c4c25e7..b066edde7b4af 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AppServicePlanResource.cs @@ -21,7 +21,7 @@ public partial class Sample_AppServicePlanResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAppServicePlans_ListAppServicePlans() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListAppServicePlans.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListAppServicePlans.json // this example is just showing the usage of "AppServicePlans_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task GetAppServicePlans_ListAppServicePlans() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppServicePlan() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetAppServicePlan.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetAppServicePlan.json // this example is just showing the usage of "AppServicePlans_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -84,7 +84,7 @@ public async Task Get_GetAppServicePlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAppServicePlan() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DeleteAppServicePlan.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteAppServicePlan.json // this example is just showing the usage of "AppServicePlans_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -111,7 +111,7 @@ public async Task Delete_DeleteAppServicePlan() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_PatchServicePlan() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/PatchAppServicePlan.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/PatchAppServicePlan.json // this example is just showing the usage of "AppServicePlans_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AseV3NetworkingConfigurationResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AseV3NetworkingConfigurationResource.cs new file mode 100644 index 0000000000000..39b429d4497ac --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AseV3NetworkingConfigurationResource.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_AseV3NetworkingConfigurationResource + { + // Get networking configuration of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetNetworkingConfigurationOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetAseV3NetworkingConfiguration.json + // this example is just showing the usage of "AppServiceEnvironments_GetAseV3NetworkingConfiguration" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AseV3NetworkingConfigurationResource created on azure + // for more information of creating AseV3NetworkingConfigurationResource, please refer to the document of AseV3NetworkingConfigurationResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier aseV3NetworkingConfigurationResourceId = AseV3NetworkingConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AseV3NetworkingConfigurationResource aseV3NetworkingConfiguration = client.GetAseV3NetworkingConfigurationResource(aseV3NetworkingConfigurationResourceId); + + // invoke the operation + AseV3NetworkingConfigurationResource result = await aseV3NetworkingConfiguration.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AseV3NetworkingConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update networking configuration of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_UpdateNetworkingConfigurationOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_UpdateAseNetworkingConfiguration.json + // this example is just showing the usage of "AppServiceEnvironments_UpdateAseNetworkingConfiguration" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AseV3NetworkingConfigurationResource created on azure + // for more information of creating AseV3NetworkingConfigurationResource, please refer to the document of AseV3NetworkingConfigurationResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier aseV3NetworkingConfigurationResourceId = AseV3NetworkingConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AseV3NetworkingConfigurationResource aseV3NetworkingConfiguration = client.GetAseV3NetworkingConfigurationResource(aseV3NetworkingConfigurationResourceId); + + // invoke the operation + AseV3NetworkingConfigurationData data = new AseV3NetworkingConfigurationData() + { + FtpEnabled = true, + RemoteDebugEnabled = true, + }; + ArmOperation lro = await aseV3NetworkingConfiguration.CreateOrUpdateAsync(WaitUntil.Completed, data); + AseV3NetworkingConfigurationResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AseV3NetworkingConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AuthsettingsV2SiteConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AuthsettingsV2SiteConfigResource.cs new file mode 100644 index 0000000000000..2fbb48327b5d0 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_AuthsettingsV2SiteConfigResource.cs @@ -0,0 +1,185 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_AuthsettingsV2SiteConfigResource + { + // List Auth Settings without Secrets + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ListAuthSettingsWithoutSecrets() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetAuthSettingsV2WithoutSecrets.json + // this example is just showing the usage of "WebApps_GetAuthSettingsV2WithoutSecrets" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AuthsettingsV2SiteConfigResource created on azure + // for more information of creating AuthsettingsV2SiteConfigResource, please refer to the document of AuthsettingsV2SiteConfigResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier authsettingsV2SiteConfigResourceId = AuthsettingsV2SiteConfigResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AuthsettingsV2SiteConfigResource authsettingsV2SiteConfig = client.GetAuthsettingsV2SiteConfigResource(authsettingsV2SiteConfigResourceId); + + // invoke the operation + AuthsettingsV2SiteConfigResource result = await authsettingsV2SiteConfig.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteAuthSettingsV2Data resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update Auth Settings V2 + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_UpdateAuthSettingsV2() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdateAuthSettingsV2.json + // this example is just showing the usage of "WebApps_UpdateAuthSettingsV2" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AuthsettingsV2SiteConfigResource created on azure + // for more information of creating AuthsettingsV2SiteConfigResource, please refer to the document of AuthsettingsV2SiteConfigResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier authsettingsV2SiteConfigResourceId = AuthsettingsV2SiteConfigResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AuthsettingsV2SiteConfigResource authsettingsV2SiteConfig = client.GetAuthsettingsV2SiteConfigResource(authsettingsV2SiteConfigResourceId); + + // invoke the operation + SiteAuthSettingsV2Data data = new SiteAuthSettingsV2Data() + { + Platform = new AuthPlatform() + { + IsEnabled = true, + RuntimeVersion = "~1", + ConfigFilePath = "/auth/config.json", + }, + GlobalValidation = new GlobalValidation() + { + IsAuthenticationRequired = true, + UnauthenticatedClientAction = UnauthenticatedClientActionV2.Return403, + ExcludedPaths = +{ +"/nosecrets/Path" +}, + }, + IdentityProviders = new AppServiceIdentityProviders() + { + Google = new AppServiceGoogleProvider() + { + IsEnabled = true, + Registration = new ClientRegistration() + { + ClientId = "42d795a9-8abb-4d06-8534-39528af40f8e.apps.googleusercontent.com", + ClientSecretSettingName = "ClientSecret", + }, + LoginScopes = +{ +"admin" +}, + ValidationAllowedAudiences = +{ +"https://example.com" +}, + }, + }, + Login = new WebAppLoginInfo() + { + RoutesLogoutEndpoint = "https://app.com/logout", + TokenStore = new AppServiceTokenStore() + { + IsEnabled = true, + TokenRefreshExtensionHours = 96, + FileSystemDirectory = "/wwwroot/sites/example", + }, + PreserveUrlFragmentsForLogins = true, + AllowedExternalRedirectUrls = +{ +"https://someurl.com" +}, + CookieExpiration = new WebAppCookieExpiration() + { + Convention = CookieExpirationConvention.IdentityProviderDerived, + TimeToExpiration = "2022:09-01T00:00Z", + }, + Nonce = new LoginFlowNonceSettings() + { + ValidateNonce = true, + }, + }, + HttpSettings = new AppServiceHttpSettings() + { + IsHttpsRequired = true, + RoutesApiPrefix = "/authv2/", + ForwardProxy = new AppServiceForwardProxy() + { + Convention = ForwardProxyConvention.Standard, + CustomHostHeaderName = "authHeader", + CustomProtoHeaderName = "customProtoHeader", + }, + }, + }; + ArmOperation lro = await authsettingsV2SiteConfig.CreateOrUpdateAsync(WaitUntil.Completed, data); + AuthsettingsV2SiteConfigResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteAuthSettingsV2Data resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List Auth Settings V2 + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAuthSettingsV2_ListAuthSettingsV2() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListAuthSettingsV2.json + // this example is just showing the usage of "WebApps_GetAuthSettingsV2" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AuthsettingsV2SiteConfigResource created on azure + // for more information of creating AuthsettingsV2SiteConfigResource, please refer to the document of AuthsettingsV2SiteConfigResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier authsettingsV2SiteConfigResourceId = AuthsettingsV2SiteConfigResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AuthsettingsV2SiteConfigResource authsettingsV2SiteConfig = client.GetAuthsettingsV2SiteConfigResource(authsettingsV2SiteConfigResourceId); + + // invoke the operation + AuthsettingsV2SiteConfigResource result = await authsettingsV2SiteConfig.GetAuthSettingsV2Async(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteAuthSettingsV2Data resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorCollection.cs index d7f26c3dd08bd..906ab908d59c5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_CertificateOrderDetectorCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppServiceCertificateDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2021-02-01/examples/Diagnostics_ListAppServiceCertificateOrderDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/Diagnostics_ListAppServiceCertificateOrderDetectorResponse.json // this example is just showing the usage of "CertificateOrdersDiagnostics_ListAppServiceCertificateOrderDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetAll_ListAppServiceCertificateDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppServiceCertificateOrderDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2021-02-01/examples/Diagnostics_GetAppServiceCertificateOrderDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/Diagnostics_GetAppServiceCertificateOrderDetectorResponse.json // this example is just showing the usage of "CertificateOrdersDiagnostics_GetAppServiceCertificateOrderDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +91,7 @@ public async Task Get_GetAppServiceCertificateOrderDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppServiceCertificateOrderDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2021-02-01/examples/Diagnostics_GetAppServiceCertificateOrderDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/Diagnostics_GetAppServiceCertificateOrderDetectorResponse.json // this example is just showing the usage of "CertificateOrdersDiagnostics_GetAppServiceCertificateOrderDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +122,7 @@ public async Task Exists_GetAppServiceCertificateOrderDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppServiceCertificateOrderDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2021-02-01/examples/Diagnostics_GetAppServiceCertificateOrderDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/Diagnostics_GetAppServiceCertificateOrderDetectorResponse.json // this example is just showing the usage of "CertificateOrdersDiagnostics_GetAppServiceCertificateOrderDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorResource.cs index e2d77a52fe9eb..f0a0af0231ed5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CertificateOrderDetectorResource.cs @@ -19,7 +19,7 @@ public partial class Sample_CertificateOrderDetectorResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppServiceCertificateOrderDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2021-02-01/examples/Diagnostics_GetAppServiceCertificateOrderDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/Diagnostics_GetAppServiceCertificateOrderDetectorResponse.json // this example is just showing the usage of "CertificateOrdersDiagnostics_GetAppServiceCertificateOrderDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ContainerAppCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ContainerAppCollection.cs new file mode 100644 index 0000000000000..2b531c97d7b42 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ContainerAppCollection.cs @@ -0,0 +1,245 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_ContainerAppCollection + { + // List Container Apps by resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListContainerAppsByResourceGroup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListContainerAppsByResourceGroup.json + // this example is just showing the usage of "ContainerApps_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerAppResource + ContainerAppCollection collection = resourceGroupResource.GetContainerApps(); + + // invoke the operation and iterate over the result + await foreach (ContainerAppResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerAppData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Container App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetContainerApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetContainerApp.json + // this example is just showing the usage of "ContainerApps_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerAppResource + ContainerAppCollection collection = resourceGroupResource.GetContainerApps(); + + // invoke the operation + string name = "testcontainerApp0"; + ContainerAppResource result = await collection.GetAsync(name); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerAppData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get Container App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetContainerApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetContainerApp.json + // this example is just showing the usage of "ContainerApps_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerAppResource + ContainerAppCollection collection = resourceGroupResource.GetContainerApps(); + + // invoke the operation + string name = "testcontainerApp0"; + bool result = await collection.ExistsAsync(name); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get Container App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainerApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetContainerApp.json + // this example is just showing the usage of "ContainerApps_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerAppResource + ContainerAppCollection collection = resourceGroupResource.GetContainerApps(); + + // invoke the operation + string name = "testcontainerApp0"; + NullableResponse response = await collection.GetIfExistsAsync(name); + ContainerAppResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerAppData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create or Update Container App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateContainerApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateContainerApp.json + // this example is just showing the usage of "ContainerApps_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this ContainerAppResource + ContainerAppCollection collection = resourceGroupResource.GetContainerApps(); + + // invoke the operation + string name = "testcontainerApp0"; + ContainerAppData data = new ContainerAppData(new AzureLocation("East US")) + { + KubeEnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/kubeEnvironments/demokube", + Configuration = new Configuration() + { + Ingress = new Ingress() + { + External = true, + TargetPort = 3000, + }, + }, + Template = new Template() + { + Containers = +{ +new Container() +{ +Image = "repo/testcontainerApp0:v1", +Name = "testcontainerApp0", +} +}, + Scale = new Scale() + { + MinReplicas = 1, + MaxReplicas = 5, + Rules = +{ +new ScaleRule() +{ +Name = "httpscalingrule", +Custom = new CustomScaleRule() +{ +CustomScaleRuleType = "http", +Metadata = +{ +["concurrentRequests"] = "50", +}, +}, +} +}, + }, + Dapr = new Dapr() + { + Enabled = true, + AppPort = 3000, + }, + }, + Kind = "containerApp", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + ContainerAppResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerAppData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ContainerAppResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ContainerAppResource.cs new file mode 100644 index 0000000000000..720fc7df841ed --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ContainerAppResource.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_ContainerAppResource + { + // List Container Apps by resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetContainerApps_ListContainerAppsByResourceGroup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListContainerAppsBySubscription.json + // this example is just showing the usage of "ContainerApps_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (ContainerAppResource item in subscriptionResource.GetContainerAppsAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerAppData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Container App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetContainerApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetContainerApp.json + // this example is just showing the usage of "ContainerApps_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testcontainerApp0"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // invoke the operation + ContainerAppResource result = await containerApp.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerAppData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or Update Container App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateContainerApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateContainerApp.json + // this example is just showing the usage of "ContainerApps_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testcontainerApp0"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // invoke the operation + ContainerAppData data = new ContainerAppData(new AzureLocation("East US")) + { + KubeEnvironmentId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/rg/providers/Microsoft.Web/kubeEnvironments/demokube", + Configuration = new Configuration() + { + Ingress = new Ingress() + { + External = true, + TargetPort = 3000, + }, + }, + Template = new Template() + { + Containers = +{ +new Container() +{ +Image = "repo/testcontainerApp0:v1", +Name = "testcontainerApp0", +} +}, + Scale = new Scale() + { + MinReplicas = 1, + MaxReplicas = 5, + Rules = +{ +new ScaleRule() +{ +Name = "httpscalingrule", +Custom = new CustomScaleRule() +{ +CustomScaleRuleType = "http", +Metadata = +{ +["concurrentRequests"] = "50", +}, +}, +} +}, + }, + Dapr = new Dapr() + { + Enabled = true, + AppPort = 3000, + }, + }, + Kind = "containerApp", + }; + ArmOperation lro = await containerApp.UpdateAsync(WaitUntil.Completed, data); + ContainerAppResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ContainerAppData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete Container App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteContainerApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteContainerApp.json + // this example is just showing the usage of "ContainerApps_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testWorkerApp0"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // invoke the operation + await containerApp.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // List Container Apps Secrets + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSecretsContainerApps_ListContainerAppsSecrets() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListContainerAppSecrets.json + // this example is just showing the usage of "ContainerApps_ListSecrets" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + string name = "testcontainerApp0"; + await foreach (ContainerAppSecret item in subscriptionResource.GetSecretsContainerAppsAsync(name)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CustomDnsSuffixConfigurationResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CustomDnsSuffixConfigurationResource.cs new file mode 100644 index 0000000000000..fdc4cba5bea22 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_CustomDnsSuffixConfigurationResource.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_CustomDnsSuffixConfigurationResource + { + // Get ASE custom DNS suffix configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetASECustomDNSSuffixConfiguration() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetAseCustomDnsSuffixConfiguration.json + // this example is just showing the usage of "AppServiceEnvironments_GetAseCustomDnsSuffixConfiguration" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CustomDnsSuffixConfigurationResource created on azure + // for more information of creating CustomDnsSuffixConfigurationResource, please refer to the document of CustomDnsSuffixConfigurationResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier customDnsSuffixConfigurationResourceId = CustomDnsSuffixConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + CustomDnsSuffixConfigurationResource customDnsSuffixConfiguration = client.GetCustomDnsSuffixConfigurationResource(customDnsSuffixConfigurationResourceId); + + // invoke the operation + CustomDnsSuffixConfigurationResource result = await customDnsSuffixConfiguration.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CustomDnsSuffixConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update ASE custom DNS suffix configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_UpdateASECustomDNSSuffixConfiguration() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdateAseCustomDnsSuffixConfiguration.json + // this example is just showing the usage of "AppServiceEnvironments_UpdateAseCustomDnsSuffixConfiguration" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CustomDnsSuffixConfigurationResource created on azure + // for more information of creating CustomDnsSuffixConfigurationResource, please refer to the document of CustomDnsSuffixConfigurationResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier customDnsSuffixConfigurationResourceId = CustomDnsSuffixConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + CustomDnsSuffixConfigurationResource customDnsSuffixConfiguration = client.GetCustomDnsSuffixConfigurationResource(customDnsSuffixConfigurationResourceId); + + // invoke the operation + CustomDnsSuffixConfigurationData data = new CustomDnsSuffixConfigurationData() + { + DnsSuffix = "contoso.com", + CertificateUri = new Uri("https://test-kv.vault.azure.net/secrets/contosocert"), + KeyVaultReferenceIdentity = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/test-rg/providers/microsoft.managedidentity/userassignedidentities/test-user-mi", + }; + ArmOperation lro = await customDnsSuffixConfiguration.CreateOrUpdateAsync(WaitUntil.Completed, data); + CustomDnsSuffixConfigurationResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CustomDnsSuffixConfigurationData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete ASE custom DNS suffix configuration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteASECustomDNSSuffixConfiguration() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteAseCustomDnsSuffixConfiguration.json + // this example is just showing the usage of "AppServiceEnvironments_DeleteAseCustomDnsSuffixConfiguration" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this CustomDnsSuffixConfigurationResource created on azure + // for more information of creating CustomDnsSuffixConfigurationResource, please refer to the document of CustomDnsSuffixConfigurationResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier customDnsSuffixConfigurationResourceId = CustomDnsSuffixConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + CustomDnsSuffixConfigurationResource customDnsSuffixConfiguration = client.GetCustomDnsSuffixConfigurationResource(customDnsSuffixConfigurationResourceId); + + // invoke the operation + ArmOperation lro = await customDnsSuffixConfiguration.DeleteAsync(WaitUntil.Completed); + BinaryData result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteCollection.cs index 506a73ce23861..8f81f929c6719 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_DeletedSiteCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDeletedWebApp() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetDeletedWebApp.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetDeletedWebApp.json // this example is just showing the usage of "Global_GetDeletedWebApp" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task Get_GetDeletedWebApp() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetDeletedWebApp() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetDeletedWebApp.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetDeletedWebApp.json // this example is just showing the usage of "Global_GetDeletedWebApp" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -82,7 +82,7 @@ public async Task Exists_GetDeletedWebApp() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetDeletedWebApp() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetDeletedWebApp.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetDeletedWebApp.json // this example is just showing the usage of "Global_GetDeletedWebApp" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteResource.cs index 5eabeaedeaa88..4ab8194142807 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DeletedSiteResource.cs @@ -21,7 +21,7 @@ public partial class Sample_DeletedSiteResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetDeletedSitesByLocation_ListDeletedWebAppByLocation() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListDeletedWebAppsByLocation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListDeletedWebAppsByLocation.json // this example is just showing the usage of "DeletedWebApps_ListByLocation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +54,7 @@ public async Task GetDeletedSitesByLocation_ListDeletedWebAppByLocation() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetDeletedWebAppByLocationDeletedWebApp_GetDeletedWebAppByLocation() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetDeletedWebAppByLocation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetDeletedWebAppByLocation.json // this example is just showing the usage of "DeletedWebApps_GetDeletedWebAppByLocation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -85,7 +85,7 @@ public async Task GetDeletedWebAppByLocationDeletedWebApp_GetDeletedWebAppByLoca [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDeletedWebApp() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetDeletedWebApp.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetDeletedWebApp.json // this example is just showing the usage of "Global_GetDeletedWebApp" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +115,7 @@ public async Task Get_GetDeletedWebApp() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetDeletedWebAppSnapshots_GetDeletedWebAppSnapshots() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetDeletedWebAppSnapshots.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetDeletedWebAppSnapshots.json // this example is just showing the usage of "Global_GetDeletedWebAppSnapshots" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DomainOwnershipIdentifierCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DomainOwnershipIdentifierCollection.cs new file mode 100644 index 0000000000000..2f42ca9178595 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DomainOwnershipIdentifierCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_DomainOwnershipIdentifierCollection + { + // List Domain Ownership Identifiers + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListDomainOwnershipIdentifiers() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/ListDomainOwnershipIdentifiers.json + // this example is just showing the usage of "Domains_ListOwnershipIdentifiers" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceDomainResource created on azure + // for more information of creating AppServiceDomainResource, please refer to the document of AppServiceDomainResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + ResourceIdentifier appServiceDomainResourceId = AppServiceDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + AppServiceDomainResource appServiceDomain = client.GetAppServiceDomainResource(appServiceDomainResourceId); + + // get the collection of this DomainOwnershipIdentifierResource + DomainOwnershipIdentifierCollection collection = appServiceDomain.GetDomainOwnershipIdentifiers(); + + // invoke the operation and iterate over the result + await foreach (DomainOwnershipIdentifierResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DomainOwnershipIdentifierData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Domain Ownership Identifier + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDomainOwnershipIdentifier() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetDomainOwnershipIdentifier.json + // this example is just showing the usage of "Domains_GetOwnershipIdentifier" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceDomainResource created on azure + // for more information of creating AppServiceDomainResource, please refer to the document of AppServiceDomainResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + ResourceIdentifier appServiceDomainResourceId = AppServiceDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + AppServiceDomainResource appServiceDomain = client.GetAppServiceDomainResource(appServiceDomainResourceId); + + // get the collection of this DomainOwnershipIdentifierResource + DomainOwnershipIdentifierCollection collection = appServiceDomain.GetDomainOwnershipIdentifiers(); + + // invoke the operation + string name = "SampleOwnershipId"; + DomainOwnershipIdentifierResource result = await collection.GetAsync(name); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DomainOwnershipIdentifierData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get Domain Ownership Identifier + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetDomainOwnershipIdentifier() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetDomainOwnershipIdentifier.json + // this example is just showing the usage of "Domains_GetOwnershipIdentifier" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceDomainResource created on azure + // for more information of creating AppServiceDomainResource, please refer to the document of AppServiceDomainResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + ResourceIdentifier appServiceDomainResourceId = AppServiceDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + AppServiceDomainResource appServiceDomain = client.GetAppServiceDomainResource(appServiceDomainResourceId); + + // get the collection of this DomainOwnershipIdentifierResource + DomainOwnershipIdentifierCollection collection = appServiceDomain.GetDomainOwnershipIdentifiers(); + + // invoke the operation + string name = "SampleOwnershipId"; + bool result = await collection.ExistsAsync(name); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get Domain Ownership Identifier + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDomainOwnershipIdentifier() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetDomainOwnershipIdentifier.json + // this example is just showing the usage of "Domains_GetOwnershipIdentifier" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceDomainResource created on azure + // for more information of creating AppServiceDomainResource, please refer to the document of AppServiceDomainResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + ResourceIdentifier appServiceDomainResourceId = AppServiceDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + AppServiceDomainResource appServiceDomain = client.GetAppServiceDomainResource(appServiceDomainResourceId); + + // get the collection of this DomainOwnershipIdentifierResource + DomainOwnershipIdentifierCollection collection = appServiceDomain.GetDomainOwnershipIdentifiers(); + + // invoke the operation + string name = "SampleOwnershipId"; + NullableResponse response = await collection.GetIfExistsAsync(name); + DomainOwnershipIdentifierResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DomainOwnershipIdentifierData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create App Service Domain OwnershipIdentifier + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateAppServiceDomainOwnershipIdentifier() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/CreateAppServiceDomainOwnershipIdentifier.json + // this example is just showing the usage of "Domains_CreateOrUpdateOwnershipIdentifier" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceDomainResource created on azure + // for more information of creating AppServiceDomainResource, please refer to the document of AppServiceDomainResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + ResourceIdentifier appServiceDomainResourceId = AppServiceDomainResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName); + AppServiceDomainResource appServiceDomain = client.GetAppServiceDomainResource(appServiceDomainResourceId); + + // get the collection of this DomainOwnershipIdentifierResource + DomainOwnershipIdentifierCollection collection = appServiceDomain.GetDomainOwnershipIdentifiers(); + + // invoke the operation + string name = "SampleOwnershipId"; + DomainOwnershipIdentifierData data = new DomainOwnershipIdentifierData() + { + OwnershipId = "SampleOwnershipId", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + DomainOwnershipIdentifierResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DomainOwnershipIdentifierData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DomainOwnershipIdentifierResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DomainOwnershipIdentifierResource.cs new file mode 100644 index 0000000000000..81cfd171fee7d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_DomainOwnershipIdentifierResource.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_DomainOwnershipIdentifierResource + { + // Get Domain Ownership Identifier + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDomainOwnershipIdentifier() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetDomainOwnershipIdentifier.json + // this example is just showing the usage of "Domains_GetOwnershipIdentifier" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DomainOwnershipIdentifierResource created on azure + // for more information of creating DomainOwnershipIdentifierResource, please refer to the document of DomainOwnershipIdentifierResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + string name = "SampleOwnershipId"; + ResourceIdentifier domainOwnershipIdentifierResourceId = DomainOwnershipIdentifierResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName, name); + DomainOwnershipIdentifierResource domainOwnershipIdentifier = client.GetDomainOwnershipIdentifierResource(domainOwnershipIdentifierResourceId); + + // invoke the operation + DomainOwnershipIdentifierResource result = await domainOwnershipIdentifier.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DomainOwnershipIdentifierData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete App Service Domain Ownership Identifier + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAppServiceDomainOwnershipIdentifier() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/DeleteAppServiceDomainOwnershipIdentifier.json + // this example is just showing the usage of "Domains_DeleteOwnershipIdentifier" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DomainOwnershipIdentifierResource created on azure + // for more information of creating DomainOwnershipIdentifierResource, please refer to the document of DomainOwnershipIdentifierResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + string name = "ownershipIdentifier"; + ResourceIdentifier domainOwnershipIdentifierResourceId = DomainOwnershipIdentifierResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName, name); + DomainOwnershipIdentifierResource domainOwnershipIdentifier = client.GetDomainOwnershipIdentifierResource(domainOwnershipIdentifierResourceId); + + // invoke the operation + await domainOwnershipIdentifier.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Update App Service Domain OwnershipIdentifier + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateAppServiceDomainOwnershipIdentifier() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/UpdateAppServiceDomainOwnershipIdentifier.json + // this example is just showing the usage of "Domains_UpdateOwnershipIdentifier" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DomainOwnershipIdentifierResource created on azure + // for more information of creating DomainOwnershipIdentifierResource, please refer to the document of DomainOwnershipIdentifierResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string domainName = "example.com"; + string name = "SampleOwnershipId"; + ResourceIdentifier domainOwnershipIdentifierResourceId = DomainOwnershipIdentifierResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, domainName, name); + DomainOwnershipIdentifierResource domainOwnershipIdentifier = client.GetDomainOwnershipIdentifierResource(domainOwnershipIdentifierResourceId); + + // invoke the operation + DomainOwnershipIdentifierData data = new DomainOwnershipIdentifierData() + { + OwnershipId = "SampleOwnershipId", + }; + DomainOwnershipIdentifierResource result = await domainOwnershipIdentifier.UpdateAsync(data); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DomainOwnershipIdentifierData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorCollection.cs index e156e212919ec..02880699c875a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_HostingEnvironmentDetectorCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetAppServiceEnvironmentDetectorResponses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListHostingEnvironmentDetectorResponses.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListHostingEnvironmentDetectorResponses.json // this example is just showing the usage of "Diagnostics_ListHostingEnvironmentDetectorResponses" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetAll_GetAppServiceEnvironmentDetectorResponses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppServiceEnvironmentDetectorResponses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetHostingEnvironmentDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetHostingEnvironmentDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetHostingEnvironmentDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +91,7 @@ public async Task Get_GetAppServiceEnvironmentDetectorResponses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppServiceEnvironmentDetectorResponses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetHostingEnvironmentDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetHostingEnvironmentDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetHostingEnvironmentDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +122,7 @@ public async Task Exists_GetAppServiceEnvironmentDetectorResponses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppServiceEnvironmentDetectorResponses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetHostingEnvironmentDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetHostingEnvironmentDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetHostingEnvironmentDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorResource.cs index 8c08a61b5a1d9..61da7ac65c8b5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentDetectorResource.cs @@ -19,7 +19,7 @@ public partial class Sample_HostingEnvironmentDetectorResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppServiceEnvironmentDetectorResponses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetHostingEnvironmentDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetHostingEnvironmentDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetHostingEnvironmentDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentMultiRolePoolResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentMultiRolePoolResource.cs new file mode 100644 index 0000000000000..6446458eed127 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentMultiRolePoolResource.cs @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_HostingEnvironmentMultiRolePoolResource + { + // Get properties of a multi-role pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetPropertiesOfAMultiRolePool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetMultiRolePool.json + // this example is just showing the usage of "AppServiceEnvironments_GetMultiRolePool" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentMultiRolePoolResource created on azure + // for more information of creating HostingEnvironmentMultiRolePoolResource, please refer to the document of HostingEnvironmentMultiRolePoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier hostingEnvironmentMultiRolePoolResourceId = HostingEnvironmentMultiRolePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + HostingEnvironmentMultiRolePoolResource hostingEnvironmentMultiRolePool = client.GetHostingEnvironmentMultiRolePoolResource(hostingEnvironmentMultiRolePoolResourceId); + + // invoke the operation + HostingEnvironmentMultiRolePoolResource result = await hostingEnvironmentMultiRolePool.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceWorkerPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update a multi-role pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateAMultiRolePool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_CreateOrUpdateMultiRolePool.json + // this example is just showing the usage of "AppServiceEnvironments_CreateOrUpdateMultiRolePool" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentMultiRolePoolResource created on azure + // for more information of creating HostingEnvironmentMultiRolePoolResource, please refer to the document of HostingEnvironmentMultiRolePoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier hostingEnvironmentMultiRolePoolResourceId = HostingEnvironmentMultiRolePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + HostingEnvironmentMultiRolePoolResource hostingEnvironmentMultiRolePool = client.GetHostingEnvironmentMultiRolePoolResource(hostingEnvironmentMultiRolePoolResourceId); + + // invoke the operation + AppServiceWorkerPoolData data = new AppServiceWorkerPoolData() + { + WorkerSize = "Medium", + WorkerCount = 3, + }; + ArmOperation lro = await hostingEnvironmentMultiRolePool.CreateOrUpdateAsync(WaitUntil.Completed, data); + HostingEnvironmentMultiRolePoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceWorkerPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or update a multi-role pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateAMultiRolePool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_CreateOrUpdateMultiRolePool.json + // this example is just showing the usage of "AppServiceEnvironments_UpdateMultiRolePool" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentMultiRolePoolResource created on azure + // for more information of creating HostingEnvironmentMultiRolePoolResource, please refer to the document of HostingEnvironmentMultiRolePoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier hostingEnvironmentMultiRolePoolResourceId = HostingEnvironmentMultiRolePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + HostingEnvironmentMultiRolePoolResource hostingEnvironmentMultiRolePool = client.GetHostingEnvironmentMultiRolePoolResource(hostingEnvironmentMultiRolePoolResourceId); + + // invoke the operation + AppServiceWorkerPoolData data = new AppServiceWorkerPoolData() + { + WorkerSize = "Medium", + WorkerCount = 3, + }; + HostingEnvironmentMultiRolePoolResource result = await hostingEnvironmentMultiRolePool.UpdateAsync(data); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceWorkerPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get metric definitions for a specific instance of a multi-role pool of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMultiRolePoolInstanceMetricDefinitions_GetMetricDefinitionsForASpecificInstanceOfAMultiRolePoolOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListMultiRolePoolInstanceMetricDefinitions.json + // this example is just showing the usage of "AppServiceEnvironments_ListMultiRolePoolInstanceMetricDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentMultiRolePoolResource created on azure + // for more information of creating HostingEnvironmentMultiRolePoolResource, please refer to the document of HostingEnvironmentMultiRolePoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier hostingEnvironmentMultiRolePoolResourceId = HostingEnvironmentMultiRolePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + HostingEnvironmentMultiRolePoolResource hostingEnvironmentMultiRolePool = client.GetHostingEnvironmentMultiRolePoolResource(hostingEnvironmentMultiRolePoolResourceId); + + // invoke the operation and iterate over the result + string instance = "10.7.1.8"; + await foreach (ResourceMetricDefinition item in hostingEnvironmentMultiRolePool.GetMultiRolePoolInstanceMetricDefinitionsAsync(instance)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get metric definitions for a multi-role pool of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMultiRoleMetricDefinitions_GetMetricDefinitionsForAMultiRolePoolOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListMultiRoleMetricDefinitions.json + // this example is just showing the usage of "AppServiceEnvironments_ListMultiRoleMetricDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentMultiRolePoolResource created on azure + // for more information of creating HostingEnvironmentMultiRolePoolResource, please refer to the document of HostingEnvironmentMultiRolePoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier hostingEnvironmentMultiRolePoolResourceId = HostingEnvironmentMultiRolePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + HostingEnvironmentMultiRolePoolResource hostingEnvironmentMultiRolePool = client.GetHostingEnvironmentMultiRolePoolResource(hostingEnvironmentMultiRolePoolResourceId); + + // invoke the operation and iterate over the result + await foreach (ResourceMetricDefinition item in hostingEnvironmentMultiRolePool.GetMultiRoleMetricDefinitionsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get available SKUs for scaling a multi-role pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMultiRolePoolSkus_GetAvailableSKUsForScalingAMultiRolePool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListMultiRolePoolSkus.json + // this example is just showing the usage of "AppServiceEnvironments_ListMultiRolePoolSkus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentMultiRolePoolResource created on azure + // for more information of creating HostingEnvironmentMultiRolePoolResource, please refer to the document of HostingEnvironmentMultiRolePoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier hostingEnvironmentMultiRolePoolResourceId = HostingEnvironmentMultiRolePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + HostingEnvironmentMultiRolePoolResource hostingEnvironmentMultiRolePool = client.GetHostingEnvironmentMultiRolePoolResource(hostingEnvironmentMultiRolePoolResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServicePoolSkuInfo item in hostingEnvironmentMultiRolePool.GetMultiRolePoolSkusAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get usage metrics for a multi-role pool of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetMultiRoleUsages_GetUsageMetricsForAMultiRolePoolOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListMultiRoleUsages.json + // this example is just showing the usage of "AppServiceEnvironments_ListMultiRoleUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentMultiRolePoolResource created on azure + // for more information of creating HostingEnvironmentMultiRolePoolResource, please refer to the document of HostingEnvironmentMultiRolePoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier hostingEnvironmentMultiRolePoolResourceId = HostingEnvironmentMultiRolePoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + HostingEnvironmentMultiRolePoolResource hostingEnvironmentMultiRolePool = client.GetHostingEnvironmentMultiRolePoolResource(hostingEnvironmentMultiRolePoolResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServiceUsage item in hostingEnvironmentMultiRolePool.GetMultiRoleUsagesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentPrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentPrivateEndpointConnectionCollection.cs new file mode 100644 index 0000000000000..14ed37b763bdc --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentPrivateEndpointConnectionCollection.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_HostingEnvironmentPrivateEndpointConnectionCollection + { + // Gets the list of private endpoints associated with a hosting environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetsTheListOfPrivateEndpointsAssociatedWithAHostingEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetPrivateEndpointConnectionList.json + // this example is just showing the usage of "AppServiceEnvironments_GetPrivateEndpointConnectionList" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentPrivateEndpointConnectionResource + HostingEnvironmentPrivateEndpointConnectionCollection collection = appServiceEnvironment.GetHostingEnvironmentPrivateEndpointConnections(); + + // invoke the operation and iterate over the result + await foreach (HostingEnvironmentPrivateEndpointConnectionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RemotePrivateEndpointConnectionARMResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Gets a private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsAPrivateEndpointConnection() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetPrivateEndpointConnection.json + // this example is just showing the usage of "AppServiceEnvironments_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentPrivateEndpointConnectionResource + HostingEnvironmentPrivateEndpointConnectionCollection collection = appServiceEnvironment.GetHostingEnvironmentPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "fa38656c-034e-43d8-adce-fe06ce039c98"; + HostingEnvironmentPrivateEndpointConnectionResource result = await collection.GetAsync(privateEndpointConnectionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RemotePrivateEndpointConnectionARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Gets a private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetsAPrivateEndpointConnection() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetPrivateEndpointConnection.json + // this example is just showing the usage of "AppServiceEnvironments_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentPrivateEndpointConnectionResource + HostingEnvironmentPrivateEndpointConnectionCollection collection = appServiceEnvironment.GetHostingEnvironmentPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "fa38656c-034e-43d8-adce-fe06ce039c98"; + bool result = await collection.ExistsAsync(privateEndpointConnectionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Gets a private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsAPrivateEndpointConnection() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetPrivateEndpointConnection.json + // this example is just showing the usage of "AppServiceEnvironments_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentPrivateEndpointConnectionResource + HostingEnvironmentPrivateEndpointConnectionCollection collection = appServiceEnvironment.GetHostingEnvironmentPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "fa38656c-034e-43d8-adce-fe06ce039c98"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + HostingEnvironmentPrivateEndpointConnectionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RemotePrivateEndpointConnectionARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Approves or rejects a private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ApprovesOrRejectsAPrivateEndpointConnection() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ApproveOrRejectPrivateEndpointConnection.json + // this example is just showing the usage of "AppServiceEnvironments_ApproveOrRejectPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentPrivateEndpointConnectionResource + HostingEnvironmentPrivateEndpointConnectionCollection collection = appServiceEnvironment.GetHostingEnvironmentPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "fa38656c-034e-43d8-adce-fe06ce039c98"; + RemotePrivateEndpointConnectionARMResourceData data = new RemotePrivateEndpointConnectionARMResourceData() + { + PrivateLinkServiceConnectionState = new PrivateLinkConnectionState() + { + Status = "Approved", + Description = "Approved by johndoe@company.com", + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); + HostingEnvironmentPrivateEndpointConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RemotePrivateEndpointConnectionARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentPrivateEndpointConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentPrivateEndpointConnectionResource.cs new file mode 100644 index 0000000000000..de861b9153d68 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentPrivateEndpointConnectionResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_HostingEnvironmentPrivateEndpointConnectionResource + { + // Gets a private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsAPrivateEndpointConnection() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetPrivateEndpointConnection.json + // this example is just showing the usage of "AppServiceEnvironments_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentPrivateEndpointConnectionResource created on azure + // for more information of creating HostingEnvironmentPrivateEndpointConnectionResource, please refer to the document of HostingEnvironmentPrivateEndpointConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + string privateEndpointConnectionName = "fa38656c-034e-43d8-adce-fe06ce039c98"; + ResourceIdentifier hostingEnvironmentPrivateEndpointConnectionResourceId = HostingEnvironmentPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, privateEndpointConnectionName); + HostingEnvironmentPrivateEndpointConnectionResource hostingEnvironmentPrivateEndpointConnection = client.GetHostingEnvironmentPrivateEndpointConnectionResource(hostingEnvironmentPrivateEndpointConnectionResourceId); + + // invoke the operation + HostingEnvironmentPrivateEndpointConnectionResource result = await hostingEnvironmentPrivateEndpointConnection.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RemotePrivateEndpointConnectionARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Approves or rejects a private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ApprovesOrRejectsAPrivateEndpointConnection() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ApproveOrRejectPrivateEndpointConnection.json + // this example is just showing the usage of "AppServiceEnvironments_ApproveOrRejectPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentPrivateEndpointConnectionResource created on azure + // for more information of creating HostingEnvironmentPrivateEndpointConnectionResource, please refer to the document of HostingEnvironmentPrivateEndpointConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + string privateEndpointConnectionName = "fa38656c-034e-43d8-adce-fe06ce039c98"; + ResourceIdentifier hostingEnvironmentPrivateEndpointConnectionResourceId = HostingEnvironmentPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, privateEndpointConnectionName); + HostingEnvironmentPrivateEndpointConnectionResource hostingEnvironmentPrivateEndpointConnection = client.GetHostingEnvironmentPrivateEndpointConnectionResource(hostingEnvironmentPrivateEndpointConnectionResourceId); + + // invoke the operation + RemotePrivateEndpointConnectionARMResourceData data = new RemotePrivateEndpointConnectionARMResourceData() + { + PrivateLinkServiceConnectionState = new PrivateLinkConnectionState() + { + Status = "Approved", + Description = "Approved by johndoe@company.com", + }, + }; + ArmOperation lro = await hostingEnvironmentPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); + HostingEnvironmentPrivateEndpointConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RemotePrivateEndpointConnectionARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Deletes a private endpoint connection. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeletesAPrivateEndpointConnection() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_DeletePrivateEndpointConnection.json + // this example is just showing the usage of "AppServiceEnvironments_DeletePrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentPrivateEndpointConnectionResource created on azure + // for more information of creating HostingEnvironmentPrivateEndpointConnectionResource, please refer to the document of HostingEnvironmentPrivateEndpointConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + string privateEndpointConnectionName = "fa38656c-034e-43d8-adce-fe06ce039c98"; + ResourceIdentifier hostingEnvironmentPrivateEndpointConnectionResourceId = HostingEnvironmentPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, privateEndpointConnectionName); + HostingEnvironmentPrivateEndpointConnectionResource hostingEnvironmentPrivateEndpointConnection = client.GetHostingEnvironmentPrivateEndpointConnectionResource(hostingEnvironmentPrivateEndpointConnectionResourceId); + + // invoke the operation + ArmOperation lro = await hostingEnvironmentPrivateEndpointConnection.DeleteAsync(WaitUntil.Completed); + BinaryData result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentWorkerPoolCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentWorkerPoolCollection.cs new file mode 100644 index 0000000000000..649d4231ff30a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentWorkerPoolCollection.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_HostingEnvironmentWorkerPoolCollection + { + // Get all worker pools of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetAllWorkerPoolsOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListWorkerPools.json + // this example is just showing the usage of "AppServiceEnvironments_ListWorkerPools" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentWorkerPoolResource + HostingEnvironmentWorkerPoolCollection collection = appServiceEnvironment.GetHostingEnvironmentWorkerPools(); + + // invoke the operation and iterate over the result + await foreach (HostingEnvironmentWorkerPoolResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceWorkerPoolData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get properties of a worker pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetPropertiesOfAWorkerPool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetWorkerPool.json + // this example is just showing the usage of "AppServiceEnvironments_GetWorkerPool" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentWorkerPoolResource + HostingEnvironmentWorkerPoolCollection collection = appServiceEnvironment.GetHostingEnvironmentWorkerPools(); + + // invoke the operation + string workerPoolName = "workerPool1"; + HostingEnvironmentWorkerPoolResource result = await collection.GetAsync(workerPoolName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceWorkerPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get properties of a worker pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetPropertiesOfAWorkerPool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetWorkerPool.json + // this example is just showing the usage of "AppServiceEnvironments_GetWorkerPool" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentWorkerPoolResource + HostingEnvironmentWorkerPoolCollection collection = appServiceEnvironment.GetHostingEnvironmentWorkerPools(); + + // invoke the operation + string workerPoolName = "workerPool1"; + bool result = await collection.ExistsAsync(workerPoolName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get properties of a worker pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetPropertiesOfAWorkerPool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetWorkerPool.json + // this example is just showing the usage of "AppServiceEnvironments_GetWorkerPool" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentWorkerPoolResource + HostingEnvironmentWorkerPoolCollection collection = appServiceEnvironment.GetHostingEnvironmentWorkerPools(); + + // invoke the operation + string workerPoolName = "workerPool1"; + NullableResponse response = await collection.GetIfExistsAsync(workerPoolName); + HostingEnvironmentWorkerPoolResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceWorkerPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Get properties of a worker pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_GetPropertiesOfAWorkerPool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_CreateOrUpdateWorkerPool.json + // this example is just showing the usage of "AppServiceEnvironments_CreateOrUpdateWorkerPool" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this AppServiceEnvironmentResource created on azure + // for more information of creating AppServiceEnvironmentResource, please refer to the document of AppServiceEnvironmentResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + ResourceIdentifier appServiceEnvironmentResourceId = AppServiceEnvironmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + AppServiceEnvironmentResource appServiceEnvironment = client.GetAppServiceEnvironmentResource(appServiceEnvironmentResourceId); + + // get the collection of this HostingEnvironmentWorkerPoolResource + HostingEnvironmentWorkerPoolCollection collection = appServiceEnvironment.GetHostingEnvironmentWorkerPools(); + + // invoke the operation + string workerPoolName = "0"; + AppServiceWorkerPoolData data = new AppServiceWorkerPoolData() + { + WorkerSize = "Small", + WorkerCount = 3, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workerPoolName, data); + HostingEnvironmentWorkerPoolResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceWorkerPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentWorkerPoolResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentWorkerPoolResource.cs new file mode 100644 index 0000000000000..1ae7930051e2d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_HostingEnvironmentWorkerPoolResource.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_HostingEnvironmentWorkerPoolResource + { + // Get properties of a worker pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetPropertiesOfAWorkerPool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_GetWorkerPool.json + // this example is just showing the usage of "AppServiceEnvironments_GetWorkerPool" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentWorkerPoolResource created on azure + // for more information of creating HostingEnvironmentWorkerPoolResource, please refer to the document of HostingEnvironmentWorkerPoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + string workerPoolName = "workerPool1"; + ResourceIdentifier hostingEnvironmentWorkerPoolResourceId = HostingEnvironmentWorkerPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workerPoolName); + HostingEnvironmentWorkerPoolResource hostingEnvironmentWorkerPool = client.GetHostingEnvironmentWorkerPoolResource(hostingEnvironmentWorkerPoolResourceId); + + // invoke the operation + HostingEnvironmentWorkerPoolResource result = await hostingEnvironmentWorkerPool.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceWorkerPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get properties of a worker pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_GetPropertiesOfAWorkerPool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_CreateOrUpdateWorkerPool.json + // this example is just showing the usage of "AppServiceEnvironments_UpdateWorkerPool" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentWorkerPoolResource created on azure + // for more information of creating HostingEnvironmentWorkerPoolResource, please refer to the document of HostingEnvironmentWorkerPoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + string workerPoolName = "0"; + ResourceIdentifier hostingEnvironmentWorkerPoolResourceId = HostingEnvironmentWorkerPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workerPoolName); + HostingEnvironmentWorkerPoolResource hostingEnvironmentWorkerPool = client.GetHostingEnvironmentWorkerPoolResource(hostingEnvironmentWorkerPoolResourceId); + + // invoke the operation + AppServiceWorkerPoolData data = new AppServiceWorkerPoolData() + { + WorkerSize = "Small", + WorkerCount = 3, + }; + HostingEnvironmentWorkerPoolResource result = await hostingEnvironmentWorkerPool.UpdateAsync(data); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + AppServiceWorkerPoolData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get metric definitions for a specific instance of a worker pool of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWorkerPoolInstanceMetricDefinitions_GetMetricDefinitionsForASpecificInstanceOfAWorkerPoolOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListWorkerPoolInstanceMetricDefinitions.json + // this example is just showing the usage of "AppServiceEnvironments_ListWorkerPoolInstanceMetricDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentWorkerPoolResource created on azure + // for more information of creating HostingEnvironmentWorkerPoolResource, please refer to the document of HostingEnvironmentWorkerPoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + string workerPoolName = "0"; + ResourceIdentifier hostingEnvironmentWorkerPoolResourceId = HostingEnvironmentWorkerPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workerPoolName); + HostingEnvironmentWorkerPoolResource hostingEnvironmentWorkerPool = client.GetHostingEnvironmentWorkerPoolResource(hostingEnvironmentWorkerPoolResourceId); + + // invoke the operation and iterate over the result + string instance = "10.8.0.7"; + await foreach (ResourceMetricDefinition item in hostingEnvironmentWorkerPool.GetWorkerPoolInstanceMetricDefinitionsAsync(instance)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get metric definitions for a worker pool of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWebWorkerMetricDefinitions_GetMetricDefinitionsForAWorkerPoolOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListWebWorkerMetricDefinitions.json + // this example is just showing the usage of "AppServiceEnvironments_ListWebWorkerMetricDefinitions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentWorkerPoolResource created on azure + // for more information of creating HostingEnvironmentWorkerPoolResource, please refer to the document of HostingEnvironmentWorkerPoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + string workerPoolName = "0"; + ResourceIdentifier hostingEnvironmentWorkerPoolResourceId = HostingEnvironmentWorkerPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workerPoolName); + HostingEnvironmentWorkerPoolResource hostingEnvironmentWorkerPool = client.GetHostingEnvironmentWorkerPoolResource(hostingEnvironmentWorkerPoolResourceId); + + // invoke the operation and iterate over the result + await foreach (ResourceMetricDefinition item in hostingEnvironmentWorkerPool.GetWebWorkerMetricDefinitionsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get available SKUs for scaling a worker pool. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWorkerPoolSkus_GetAvailableSKUsForScalingAWorkerPool() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListWorkerPoolSkus.json + // this example is just showing the usage of "AppServiceEnvironments_ListWorkerPoolSkus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentWorkerPoolResource created on azure + // for more information of creating HostingEnvironmentWorkerPoolResource, please refer to the document of HostingEnvironmentWorkerPoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + string workerPoolName = "workerPool1"; + ResourceIdentifier hostingEnvironmentWorkerPoolResourceId = HostingEnvironmentWorkerPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workerPoolName); + HostingEnvironmentWorkerPoolResource hostingEnvironmentWorkerPool = client.GetHostingEnvironmentWorkerPoolResource(hostingEnvironmentWorkerPoolResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServicePoolSkuInfo item in hostingEnvironmentWorkerPool.GetWorkerPoolSkusAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get usage metrics for a worker pool of an App Service Environment. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWebWorkerUsages_GetUsageMetricsForAWorkerPoolOfAnAppServiceEnvironment() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AppServiceEnvironments_ListWebWorkerUsages.json + // this example is just showing the usage of "AppServiceEnvironments_ListWebWorkerUsages" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this HostingEnvironmentWorkerPoolResource created on azure + // for more information of creating HostingEnvironmentWorkerPoolResource, please refer to the document of HostingEnvironmentWorkerPoolResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-rg"; + string name = "test-ase"; + string workerPoolName = "0"; + ResourceIdentifier hostingEnvironmentWorkerPoolResourceId = HostingEnvironmentWorkerPoolResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workerPoolName); + HostingEnvironmentWorkerPoolResource hostingEnvironmentWorkerPool = client.GetHostingEnvironmentWorkerPoolResource(hostingEnvironmentWorkerPoolResourceId); + + // invoke the operation and iterate over the result + await foreach (AppServiceUsage item in hostingEnvironmentWorkerPool.GetWebWorkerUsagesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentCollection.cs index 88c6659686180..aa83b257cd0ec 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_KubeEnvironmentCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListKubeEnvironmentsByResourceGroup() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/KubeEnvironments_ListByResourceGroup.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/KubeEnvironments_ListByResourceGroup.json // this example is just showing the usage of "KubeEnvironments_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetAll_ListKubeEnvironmentsByResourceGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetKubeEnvironmentsByName() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/KubeEnvironments_Get.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/KubeEnvironments_Get.json // this example is just showing the usage of "KubeEnvironments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -90,7 +90,7 @@ public async Task Get_GetKubeEnvironmentsByName() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetKubeEnvironmentsByName() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/KubeEnvironments_Get.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/KubeEnvironments_Get.json // this example is just showing the usage of "KubeEnvironments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -120,7 +120,7 @@ public async Task Exists_GetKubeEnvironmentsByName() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetKubeEnvironmentsByName() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/KubeEnvironments_Get.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/KubeEnvironments_Get.json // this example is just showing the usage of "KubeEnvironments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -162,7 +162,7 @@ public async Task GetIfExists_GetKubeEnvironmentsByName() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateKubeEnvironments() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/KubeEnvironments_CreateOrUpdate.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/KubeEnvironments_CreateOrUpdate.json // this example is just showing the usage of "KubeEnvironments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentResource.cs index 6df8e08220bff..c4ce7f5bf44ac 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_KubeEnvironmentResource.cs @@ -21,7 +21,7 @@ public partial class Sample_KubeEnvironmentResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetKubeEnvironments_ListKubeEnvironmentsBySubscription() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/KubeEnvironments_ListBySubscription.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/KubeEnvironments_ListBySubscription.json // this example is just showing the usage of "KubeEnvironments_ListBySubscription" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task GetKubeEnvironments_ListKubeEnvironmentsBySubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetKubeEnvironmentsByName() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/KubeEnvironments_Get.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/KubeEnvironments_Get.json // this example is just showing the usage of "KubeEnvironments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -84,7 +84,7 @@ public async Task Get_GetKubeEnvironmentsByName() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteKubeEnvironmentByName() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/KubeEnvironments_Delete.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/KubeEnvironments_Delete.json // this example is just showing the usage of "KubeEnvironments_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -111,7 +111,7 @@ public async Task Delete_DeleteKubeEnvironmentByName() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_UpdateKubeEnvironments() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/KubeEnvironments_Update.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/KubeEnvironments_Update.json // this example is just showing the usage of "KubeEnvironments_Update" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RequestHistoryCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RequestHistoryCollection.cs new file mode 100644 index 0000000000000..248209771ddbd --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RequestHistoryCollection.cs @@ -0,0 +1,179 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_RequestHistoryCollection + { + // List repetition request history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListRepetitionRequestHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitionsRequestHistories_List.json + // this example is just showing the usage of "WorkflowRunActionRepetitionsRequestHistories_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource created on azure + // for more information of creating SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource, please refer to the document of SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586776228332053161046300351"; + string actionName = "HTTP_Webhook"; + string repetitionName = "000001"; + ResourceIdentifier siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId = SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName, repetitionName); + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource siteHostruntimeWebhookApiWorkflowRunActionRepetition = client.GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource(siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId); + + // get the collection of this RequestHistoryResource + RequestHistoryCollection collection = siteHostruntimeWebhookApiWorkflowRunActionRepetition.GetRequestHistories(); + + // invoke the operation and iterate over the result + await foreach (RequestHistoryResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RequestHistoryData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a repetition request history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetARepetitionRequestHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitionsRequestHistories_Get.json + // this example is just showing the usage of "WorkflowRunActionRepetitionsRequestHistories_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource created on azure + // for more information of creating SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource, please refer to the document of SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586776228332053161046300351"; + string actionName = "HTTP_Webhook"; + string repetitionName = "000001"; + ResourceIdentifier siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId = SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName, repetitionName); + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource siteHostruntimeWebhookApiWorkflowRunActionRepetition = client.GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource(siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId); + + // get the collection of this RequestHistoryResource + RequestHistoryCollection collection = siteHostruntimeWebhookApiWorkflowRunActionRepetition.GetRequestHistories(); + + // invoke the operation + string requestHistoryName = "08586611142732800686"; + RequestHistoryResource result = await collection.GetAsync(requestHistoryName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RequestHistoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a repetition request history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetARepetitionRequestHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitionsRequestHistories_Get.json + // this example is just showing the usage of "WorkflowRunActionRepetitionsRequestHistories_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource created on azure + // for more information of creating SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource, please refer to the document of SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586776228332053161046300351"; + string actionName = "HTTP_Webhook"; + string repetitionName = "000001"; + ResourceIdentifier siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId = SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName, repetitionName); + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource siteHostruntimeWebhookApiWorkflowRunActionRepetition = client.GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource(siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId); + + // get the collection of this RequestHistoryResource + RequestHistoryCollection collection = siteHostruntimeWebhookApiWorkflowRunActionRepetition.GetRequestHistories(); + + // invoke the operation + string requestHistoryName = "08586611142732800686"; + bool result = await collection.ExistsAsync(requestHistoryName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a repetition request history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARepetitionRequestHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitionsRequestHistories_Get.json + // this example is just showing the usage of "WorkflowRunActionRepetitionsRequestHistories_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource created on azure + // for more information of creating SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource, please refer to the document of SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586776228332053161046300351"; + string actionName = "HTTP_Webhook"; + string repetitionName = "000001"; + ResourceIdentifier siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId = SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName, repetitionName); + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource siteHostruntimeWebhookApiWorkflowRunActionRepetition = client.GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource(siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId); + + // get the collection of this RequestHistoryResource + RequestHistoryCollection collection = siteHostruntimeWebhookApiWorkflowRunActionRepetition.GetRequestHistories(); + + // invoke the operation + string requestHistoryName = "08586611142732800686"; + NullableResponse response = await collection.GetIfExistsAsync(requestHistoryName); + RequestHistoryResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RequestHistoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RequestHistoryResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RequestHistoryResource.cs new file mode 100644 index 0000000000000..f683e83c92304 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RequestHistoryResource.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_RequestHistoryResource + { + // Get a repetition request history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetARepetitionRequestHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitionsRequestHistories_Get.json + // this example is just showing the usage of "WorkflowRunActionRepetitionsRequestHistories_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RequestHistoryResource created on azure + // for more information of creating RequestHistoryResource, please refer to the document of RequestHistoryResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586776228332053161046300351"; + string actionName = "HTTP_Webhook"; + string repetitionName = "000001"; + string requestHistoryName = "08586611142732800686"; + ResourceIdentifier requestHistoryResourceId = RequestHistoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName, repetitionName, requestHistoryName); + RequestHistoryResource requestHistory = client.GetRequestHistoryResource(requestHistoryResourceId); + + // invoke the operation + RequestHistoryResource result = await requestHistory.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RequestHistoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs index 965ea13989e8f..5124212922608 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ResourceGroupResourceExtensions.cs @@ -20,7 +20,7 @@ public partial class Sample_ResourceGroupResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAllResourceHealthMetadataData_ListResourceHealthMetadataForAResourceGroup() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListResourceHealthMetadataByResourceGroup.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListResourceHealthMetadataByResourceGroup.json // this example is just showing the usage of "ResourceHealthMetadata_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RevisionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RevisionCollection.cs new file mode 100644 index 0000000000000..0bf5807ab9c2b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RevisionCollection.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_RevisionCollection + { + // List Container App's revisions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListContainerAppSRevisions() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListRevisions.json + // this example is just showing the usage of "ContainerAppsRevisions_ListRevisions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string containerAppName = "testcontainerApp0"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // get the collection of this RevisionResource + RevisionCollection collection = containerApp.GetRevisions(); + + // invoke the operation and iterate over the result + await foreach (RevisionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RevisionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Container App's revision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetContainerAppSRevision() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetRevision.json + // this example is just showing the usage of "ContainerAppsRevisions_GetRevision" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string containerAppName = "testcontainerApp0"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // get the collection of this RevisionResource + RevisionCollection collection = containerApp.GetRevisions(); + + // invoke the operation + string name = "testcontainerApp0-pjxhsye"; + RevisionResource result = await collection.GetAsync(name); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RevisionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get Container App's revision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetContainerAppSRevision() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetRevision.json + // this example is just showing the usage of "ContainerAppsRevisions_GetRevision" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string containerAppName = "testcontainerApp0"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // get the collection of this RevisionResource + RevisionCollection collection = containerApp.GetRevisions(); + + // invoke the operation + string name = "testcontainerApp0-pjxhsye"; + bool result = await collection.ExistsAsync(name); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get Container App's revision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetContainerAppSRevision() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetRevision.json + // this example is just showing the usage of "ContainerAppsRevisions_GetRevision" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ContainerAppResource created on azure + // for more information of creating ContainerAppResource, please refer to the document of ContainerAppResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string containerAppName = "testcontainerApp0"; + ResourceIdentifier containerAppResourceId = ContainerAppResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName); + ContainerAppResource containerApp = client.GetContainerAppResource(containerAppResourceId); + + // get the collection of this RevisionResource + RevisionCollection collection = containerApp.GetRevisions(); + + // invoke the operation + string name = "testcontainerApp0-pjxhsye"; + NullableResponse response = await collection.GetIfExistsAsync(name); + RevisionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RevisionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RevisionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RevisionResource.cs new file mode 100644 index 0000000000000..c70ec7a3eb588 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_RevisionResource.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_RevisionResource + { + // Get Container App's revision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetContainerAppSRevision() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetRevision.json + // this example is just showing the usage of "ContainerAppsRevisions_GetRevision" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RevisionResource created on azure + // for more information of creating RevisionResource, please refer to the document of RevisionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string containerAppName = "testcontainerApp0"; + string name = "testcontainerApp0-pjxhsye"; + ResourceIdentifier revisionResourceId = RevisionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName, name); + RevisionResource revision = client.GetRevisionResource(revisionResourceId); + + // invoke the operation + RevisionResource result = await revision.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + RevisionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Activate Container App's revision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ActivateRevision_ActivateContainerAppSRevision() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ActivateRevision.json + // this example is just showing the usage of "ContainerAppsRevisions_ActivateRevision" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RevisionResource created on azure + // for more information of creating RevisionResource, please refer to the document of RevisionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string containerAppName = "testcontainerApp0"; + string name = "testcontainerApp0-pjxhsye"; + ResourceIdentifier revisionResourceId = RevisionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName, name); + RevisionResource revision = client.GetRevisionResource(revisionResourceId); + + // invoke the operation + await revision.ActivateRevisionAsync(); + + Console.WriteLine($"Succeeded"); + } + + // Deactivate Container App's revision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task DeactivateRevision_DeactivateContainerAppSRevision() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeactivateRevision.json + // this example is just showing the usage of "ContainerAppsRevisions_DeactivateRevision" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RevisionResource created on azure + // for more information of creating RevisionResource, please refer to the document of RevisionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string containerAppName = "testcontainerApp0"; + string name = "testcontainerApp0-pjxhsye"; + ResourceIdentifier revisionResourceId = RevisionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName, name); + RevisionResource revision = client.GetRevisionResource(revisionResourceId); + + // invoke the operation + await revision.DeactivateRevisionAsync(); + + Console.WriteLine($"Succeeded"); + } + + // Restart Container App's revision + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RestartRevision_RestartContainerAppSRevision() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/RestartRevision.json + // this example is just showing the usage of "ContainerAppsRevisions_RestartRevision" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this RevisionResource created on azure + // for more information of creating RevisionResource, please refer to the document of RevisionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string containerAppName = "testStaticSite0"; + string name = "testcontainerApp0-pjxhsye"; + ResourceIdentifier revisionResourceId = RevisionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, containerAppName, name); + RevisionResource revision = client.GetRevisionResource(revisionResourceId); + + // invoke the operation + await revision.RestartRevisionAsync(); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ScmSiteBasicPublishingCredentialsPolicyResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ScmSiteBasicPublishingCredentialsPolicyResource.cs index f14a6d120ba6f..02bd0bc524fce 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ScmSiteBasicPublishingCredentialsPolicyResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ScmSiteBasicPublishingCredentialsPolicyResource.cs @@ -19,7 +19,7 @@ public partial class Sample_ScmSiteBasicPublishingCredentialsPolicyResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetSCMAllowed() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetPublishingCredentialsPolicy.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetPublishingCredentialsPolicy.json // this example is just showing the usage of "WebApps_GetScmAllowed" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetSCMAllowed() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_UpdateSCMAllowed() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/UpdatePublishingCredentialsPolicy.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdatePublishingCredentialsPolicy.json // this example is just showing the usage of "WebApps_UpdateScmAllowed" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ScmSiteSlotBasicPublishingCredentialsPolicyResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ScmSiteSlotBasicPublishingCredentialsPolicyResource.cs index 6aae22f83557f..833d148674b52 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ScmSiteSlotBasicPublishingCredentialsPolicyResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_ScmSiteSlotBasicPublishingCredentialsPolicyResource.cs @@ -19,7 +19,7 @@ public partial class Sample_ScmSiteSlotBasicPublishingCredentialsPolicyResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetSCMAllowed() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetPublishingCredentialsPolicySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetPublishingCredentialsPolicySlot.json // this example is just showing the usage of "WebApps_GetScmAllowedSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetSCMAllowed() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_UpdateSCMAllowed() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/UpdatePublishingCredentialsPolicySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdatePublishingCredentialsPolicySlot.json // this example is just showing the usage of "WebApps_UpdateScmAllowedSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteBackupCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteBackupCollection.cs new file mode 100644 index 0000000000000..baca08ead37ab --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteBackupCollection.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteBackupCollection + { + // List web app backups + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListWebAppBackups() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListWebAppBackups.json + // this example is just showing the usage of "WebApps_ListBackups" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteBackupResource + SiteBackupCollection collection = webSite.GetSiteBackups(); + + // invoke the operation and iterate over the result + await foreach (SiteBackupResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebAppBackupData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get web app backup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetWebAppBackup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppBackup.json + // this example is just showing the usage of "WebApps_GetBackupStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteBackupResource + SiteBackupCollection collection = webSite.GetSiteBackups(); + + // invoke the operation + string backupId = "12345"; + SiteBackupResource result = await collection.GetAsync(backupId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebAppBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get web app backup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetWebAppBackup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppBackup.json + // this example is just showing the usage of "WebApps_GetBackupStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteBackupResource + SiteBackupCollection collection = webSite.GetSiteBackups(); + + // invoke the operation + string backupId = "12345"; + bool result = await collection.ExistsAsync(backupId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get web app backup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWebAppBackup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppBackup.json + // this example is just showing the usage of "WebApps_GetBackupStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteBackupResource + SiteBackupCollection collection = webSite.GetSiteBackups(); + + // invoke the operation + string backupId = "12345"; + NullableResponse response = await collection.GetIfExistsAsync(backupId); + SiteBackupResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebAppBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteBackupResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteBackupResource.cs new file mode 100644 index 0000000000000..7cc01393df3bb --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteBackupResource.cs @@ -0,0 +1,182 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteBackupResource + { + // Get web app backup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetWebAppBackup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppBackup.json + // this example is just showing the usage of "WebApps_GetBackupStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteBackupResource created on azure + // for more information of creating SiteBackupResource, please refer to the document of SiteBackupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + string backupId = "12345"; + ResourceIdentifier siteBackupResourceId = SiteBackupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, backupId); + SiteBackupResource siteBackup = client.GetSiteBackupResource(siteBackupResourceId); + + // invoke the operation + SiteBackupResource result = await siteBackup.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebAppBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete web app backup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteWebAppBackup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteWebAppBackup.json + // this example is just showing the usage of "WebApps_DeleteBackup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteBackupResource created on azure + // for more information of creating SiteBackupResource, please refer to the document of SiteBackupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + string backupId = "12345"; + ResourceIdentifier siteBackupResourceId = SiteBackupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, backupId); + SiteBackupResource siteBackup = client.GetSiteBackupResource(siteBackupResourceId); + + // invoke the operation + await siteBackup.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get web app backup with secrets + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetBackupStatusSecrets_GetWebAppBackupWithSecrets() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppBackupWithSecrets.json + // this example is just showing the usage of "WebApps_ListBackupStatusSecrets" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteBackupResource created on azure + // for more information of creating SiteBackupResource, please refer to the document of SiteBackupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + string backupId = "12345"; + ResourceIdentifier siteBackupResourceId = SiteBackupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, backupId); + SiteBackupResource siteBackup = client.GetSiteBackupResource(siteBackupResourceId); + + // invoke the operation + WebAppBackupInfo info = new WebAppBackupInfo() + { + BackupName = "abcdwe", + IsEnabled = true, + StorageAccountUri = new Uri("DefaultEndpointsProtocol=https;AccountName=storagesample;AccountKey="), + BackupSchedule = new WebAppBackupSchedule(7, BackupFrequencyUnit.Day, true, 30) + { + StartOn = DateTimeOffset.Parse("2022-09-02T17:33:11.641Z"), + }, + Databases = +{ +new AppServiceDatabaseBackupSetting(AppServiceDatabaseType.SqlAzure) +{ +Name = "backenddb", +ConnectionStringName = "backend", +ConnectionString = "DSN=data-source-name[;SERVER=value] [;PWD=value] [;UID=value] [;=]", +},new AppServiceDatabaseBackupSetting(AppServiceDatabaseType.SqlAzure) +{ +Name = "statsdb", +ConnectionStringName = "stats", +ConnectionString = "DSN=data-source-name[;SERVER=value] [;PWD=value] [;UID=value] [;=]", +} +}, + }; + SiteBackupResource result = await siteBackup.GetBackupStatusSecretsAsync(info); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebAppBackupData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Restore web app from backup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Restore_RestoreWebAppFromBackup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/RestoreWebAppBackup.json + // this example is just showing the usage of "WebApps_Restore" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteBackupResource created on azure + // for more information of creating SiteBackupResource, please refer to the document of SiteBackupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + string backupId = "123244"; + ResourceIdentifier siteBackupResourceId = SiteBackupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, backupId); + SiteBackupResource siteBackup = client.GetSiteBackupResource(siteBackupResourceId); + + // invoke the operation + RestoreRequestInfo info = new RestoreRequestInfo() + { + StorageAccountUri = new Uri("DefaultEndpointsProtocol=https;AccountName=storagesample;AccountKey="), + CanOverwrite = true, + SiteName = "sitef6141", + Databases = +{ +new AppServiceDatabaseBackupSetting(AppServiceDatabaseType.SqlAzure) +{ +Name = "backenddb", +ConnectionStringName = "backend", +ConnectionString = "DSN=data-source-name[;SERVER=value] [;PWD=value] [;UID=value] [;=]", +},new AppServiceDatabaseBackupSetting(AppServiceDatabaseType.SqlAzure) +{ +Name = "statsdb", +ConnectionStringName = "stats", +ConnectionString = "DSN=data-source-name[;SERVER=value] [;PWD=value] [;UID=value] [;=]", +} +}, + }; + await siteBackup.RestoreAsync(WaitUntil.Completed, info); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingCollection.cs index 2f6e420c28161..831ab8ba7e004 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteConfigAppsettingCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetAzureKeyVaultReferencesForAppSettings() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSettings.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetKeyVaultReferencesForAppSettings.json // this example is just showing the usage of "WebApps_GetAppSettingsKeyVaultReferences" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetAll_GetAzureKeyVaultReferencesForAppSettings() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAzureKeyVaultAppSettingReference() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSetting.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetKeyVaultReferencesForAppSetting.json // this example is just showing the usage of "WebApps_GetAppSettingKeyVaultReference" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +91,7 @@ public async Task Get_GetAzureKeyVaultAppSettingReference() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAzureKeyVaultAppSettingReference() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSetting.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetKeyVaultReferencesForAppSetting.json // this example is just showing the usage of "WebApps_GetAppSettingKeyVaultReference" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +122,7 @@ public async Task Exists_GetAzureKeyVaultAppSettingReference() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAzureKeyVaultAppSettingReference() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSetting.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetKeyVaultReferencesForAppSetting.json // this example is just showing the usage of "WebApps_GetAppSettingKeyVaultReference" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingResource.cs index b2cbbf3fc4258..2813603013bce 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteConfigAppsettingResource.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteConfigAppsettingResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAzureKeyVaultAppSettingReference() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSetting.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetKeyVaultReferencesForAppSetting.json // this example is just showing the usage of "WebApps_GetAppSettingKeyVaultReference" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDeploymentStatuCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDeploymentStatuCollection.cs new file mode 100644 index 0000000000000..1a14c5f779ab3 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDeploymentStatuCollection.cs @@ -0,0 +1,158 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteDeploymentStatuCollection + { + // List Deployment Status + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListDeploymentStatus() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListSiteDeploymentStatus.json + // this example is just showing the usage of "WebApps_ListProductionSiteDeploymentStatuses" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteDeploymentStatuResource + SiteDeploymentStatuCollection collection = webSite.GetSiteDeploymentStatus(); + + // invoke the operation and iterate over the result + await foreach (SiteDeploymentStatuResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CsmDeploymentStatusData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Deployment Status + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDeploymentStatus() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteDeploymentStatus.json + // this example is just showing the usage of "WebApps_GetProductionSiteDeploymentStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteDeploymentStatuResource + SiteDeploymentStatuCollection collection = webSite.GetSiteDeploymentStatus(); + + // invoke the operation + string deploymentStatusId = "eacfd68b-3bbd-4ad9-99c5-98614d89c8e5"; + ArmOperation lro = await collection.GetAsync(WaitUntil.Completed, deploymentStatusId); + SiteDeploymentStatuResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CsmDeploymentStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get Deployment Status + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetDeploymentStatus() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteDeploymentStatus.json + // this example is just showing the usage of "WebApps_GetProductionSiteDeploymentStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteDeploymentStatuResource + SiteDeploymentStatuCollection collection = webSite.GetSiteDeploymentStatus(); + + // invoke the operation + string deploymentStatusId = "eacfd68b-3bbd-4ad9-99c5-98614d89c8e5"; + ArmOperation lro = await collection.ExistsAsync(WaitUntil.Completed, deploymentStatusId); + bool result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get Deployment Status + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDeploymentStatus() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteDeploymentStatus.json + // this example is just showing the usage of "WebApps_GetProductionSiteDeploymentStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteDeploymentStatuResource + SiteDeploymentStatuCollection collection = webSite.GetSiteDeploymentStatus(); + + // invoke the operation + string deploymentStatusId = "eacfd68b-3bbd-4ad9-99c5-98614d89c8e5"; + ArmOperation lro = await collection.GetIfExistsAsync(WaitUntil.Completed, deploymentStatusId); + SiteDeploymentStatuResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CsmDeploymentStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDeploymentStatuResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDeploymentStatuResource.cs new file mode 100644 index 0000000000000..4acd581e0d908 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDeploymentStatuResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteDeploymentStatuResource + { + // Get Deployment Status + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDeploymentStatus() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteDeploymentStatus.json + // this example is just showing the usage of "WebApps_GetProductionSiteDeploymentStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteDeploymentStatuResource created on azure + // for more information of creating SiteDeploymentStatuResource, please refer to the document of SiteDeploymentStatuResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + string deploymentStatusId = "eacfd68b-3bbd-4ad9-99c5-98614d89c8e5"; + ResourceIdentifier siteDeploymentStatuResourceId = SiteDeploymentStatuResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, deploymentStatusId); + SiteDeploymentStatuResource siteDeploymentStatu = client.GetSiteDeploymentStatuResource(siteDeploymentStatuResourceId); + + // invoke the operation + ArmOperation lro = await siteDeploymentStatu.GetAsync(WaitUntil.Completed); + SiteDeploymentStatuResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CsmDeploymentStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorCollection.cs index aaad52320efa7..c9198fe01704b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteDetectorCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetAppDetectorResponses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDetectorResponses.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDetectorResponses.json // this example is just showing the usage of "Diagnostics_ListSiteDetectorResponses" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetAll_GetAppDetectorResponses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetAppSlotDetectorResponses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDetectorResponsesSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDetectorResponsesSlot.json // this example is just showing the usage of "Diagnostics_ListSiteDetectorResponses" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,7 +93,7 @@ public async Task GetAll_GetAppSlotDetectorResponses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -128,7 +128,7 @@ public async Task Get_GetAppDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -159,7 +159,7 @@ public async Task Exists_GetAppDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -202,7 +202,7 @@ public async Task GetIfExists_GetAppDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -237,7 +237,7 @@ public async Task Get_GetAppSlotDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppSlotDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -268,7 +268,7 @@ public async Task Exists_GetAppSlotDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppSlotDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorResource.cs index 8d90406e90778..f0b5f2852175c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDetectorResource.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteDetectorResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetAppDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponse" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisCollection.cs index 8567e699bd1a2..779edb9e99284 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteDiagnosticAnalysisCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppAnalyses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteAnalyses.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteAnalyses.json // this example is just showing the usage of "Diagnostics_ListSiteAnalyses" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_ListAppAnalyses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppSlotAnalyses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteAnalysesSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteAnalysesSlot.json // this example is just showing the usage of "Diagnostics_ListSiteAnalyses" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task GetAll_ListAppSlotAnalyses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysis.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysis.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysis" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -131,7 +131,7 @@ public async Task Get_GetAppAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysis.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysis.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysis" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -163,7 +163,7 @@ public async Task Exists_GetAppAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysis.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysis.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysis" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -207,7 +207,7 @@ public async Task GetIfExists_GetAppAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysisSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysisSlot.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysis" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -243,7 +243,7 @@ public async Task Get_GetAppSlotAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppSlotAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysisSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysisSlot.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysis" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -275,7 +275,7 @@ public async Task Exists_GetAppSlotAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppSlotAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysisSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysisSlot.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysis" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisResource.cs index 8af543b2081a6..8ee3750f49720 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticAnalysisResource.cs @@ -20,7 +20,7 @@ public partial class Sample_SiteDiagnosticAnalysisResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysis.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysis.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysis" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task Get_GetAppAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysisSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysisSlot.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysis" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -86,7 +86,7 @@ public async Task Get_GetAppSlotAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Execute_ExecuteSiteAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ExecuteSiteAnalysis.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ExecuteSiteAnalysis.json // this example is just showing the usage of "Diagnostics_ExecuteSiteAnalysis" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +115,7 @@ public async Task Execute_ExecuteSiteAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Execute_ExecuteSiteSlotAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ExecuteSiteAnalysisSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ExecuteSiteAnalysisSlot.json // this example is just showing the usage of "Diagnostics_ExecuteSiteAnalysis" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticCollection.cs index 98faeaf8c19b4..7990ab33d2956 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteDiagnosticCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppDiagnosticCategories() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDiagnosticCategories.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDiagnosticCategories.json // this example is just showing the usage of "Diagnostics_ListSiteDiagnosticCategories" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetAll_ListAppDiagnosticCategories() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppSlotDiagnosticCategories() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDiagnosticCategoriesSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDiagnosticCategoriesSlot.json // this example is just showing the usage of "Diagnostics_ListSiteDiagnosticCategories" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,7 +93,7 @@ public async Task GetAll_ListAppSlotDiagnosticCategories() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategory.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategory.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -128,7 +128,7 @@ public async Task Get_GetAppDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategory.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategory.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -159,7 +159,7 @@ public async Task Exists_GetAppDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategory.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategory.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -202,7 +202,7 @@ public async Task GetIfExists_GetAppDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -237,7 +237,7 @@ public async Task Get_GetAppSlotDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppSlotDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -268,7 +268,7 @@ public async Task Exists_GetAppSlotDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppSlotDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorCollection.cs index f62441e07e023..8a53b64e1534c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteDiagnosticDetectorCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppDetectors() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDetectors.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDetectors.json // this example is just showing the usage of "Diagnostics_ListSiteDetectors" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_ListAppDetectors() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppSlotDetectors() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDetectorsSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDetectorsSlot.json // this example is just showing the usage of "Diagnostics_ListSiteDetectors" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task GetAll_ListAppSlotDetectors() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetector.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetector.json // this example is just showing the usage of "Diagnostics_GetSiteDetector" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -131,7 +131,7 @@ public async Task Get_GetAppDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetector.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetector.json // this example is just showing the usage of "Diagnostics_GetSiteDetector" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -163,7 +163,7 @@ public async Task Exists_GetAppDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetector.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetector.json // this example is just showing the usage of "Diagnostics_GetSiteDetector" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -207,7 +207,7 @@ public async Task GetIfExists_GetAppDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetector" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -243,7 +243,7 @@ public async Task Get_GetAppSlotDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppSlotDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetector" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -275,7 +275,7 @@ public async Task Exists_GetAppSlotDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppSlotDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetector" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorResource.cs index 15a7ac2bbed5d..3205994a73012 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticDetectorResource.cs @@ -20,7 +20,7 @@ public partial class Sample_SiteDiagnosticDetectorResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetector.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetector.json // this example is just showing the usage of "Diagnostics_GetSiteDetector" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task Get_GetAppDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetector" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -86,7 +86,7 @@ public async Task Get_GetAppSlotDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Execute_ExecuteSiteDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ExecuteSiteDetector.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ExecuteSiteDetector.json // this example is just showing the usage of "Diagnostics_ExecuteSiteDetector" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +115,7 @@ public async Task Execute_ExecuteSiteDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Execute_ExecuteSiteSlotDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ExecuteSiteDetectorSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ExecuteSiteDetectorSlot.json // this example is just showing the usage of "Diagnostics_ExecuteSiteDetector" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticResource.cs index d73535cea1ced..f1a0560daebe5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteDiagnosticResource.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteDiagnosticResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategory.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategory.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetAppDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategory" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionRepetitionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionRepetitionCollection.cs new file mode 100644 index 0000000000000..c7989de0a3eb9 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionRepetitionCollection.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteHostruntimeWebhookApiWorkflowRunActionRepetitionCollection + { + // List repetitions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListRepetitions() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitions_List.json + // this example is just showing the usage of "WorkflowRunActionRepetitions_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunActionResource created on azure + // for more information of creating WorkflowRunActionResource, please refer to the document of WorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "testAction"; + ResourceIdentifier workflowRunActionResourceId = WorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName); + WorkflowRunActionResource workflowRunAction = client.GetWorkflowRunActionResource(workflowRunActionResourceId); + + // get the collection of this SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionCollection collection = workflowRunAction.GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitions(); + + // invoke the operation and iterate over the result + await foreach (SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionRepetitionDefinitionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetARepetition() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitions_Get.json + // this example is just showing the usage of "WorkflowRunActionRepetitions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunActionResource created on azure + // for more information of creating WorkflowRunActionResource, please refer to the document of WorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "testAction"; + ResourceIdentifier workflowRunActionResourceId = WorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName); + WorkflowRunActionResource workflowRunAction = client.GetWorkflowRunActionResource(workflowRunActionResourceId); + + // get the collection of this SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionCollection collection = workflowRunAction.GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitions(); + + // invoke the operation + string repetitionName = "000001"; + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource result = await collection.GetAsync(repetitionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionRepetitionDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetARepetition() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitions_Get.json + // this example is just showing the usage of "WorkflowRunActionRepetitions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunActionResource created on azure + // for more information of creating WorkflowRunActionResource, please refer to the document of WorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "testAction"; + ResourceIdentifier workflowRunActionResourceId = WorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName); + WorkflowRunActionResource workflowRunAction = client.GetWorkflowRunActionResource(workflowRunActionResourceId); + + // get the collection of this SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionCollection collection = workflowRunAction.GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitions(); + + // invoke the operation + string repetitionName = "000001"; + bool result = await collection.ExistsAsync(repetitionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARepetition() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitions_Get.json + // this example is just showing the usage of "WorkflowRunActionRepetitions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunActionResource created on azure + // for more information of creating WorkflowRunActionResource, please refer to the document of WorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "testAction"; + ResourceIdentifier workflowRunActionResourceId = WorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName); + WorkflowRunActionResource workflowRunAction = client.GetWorkflowRunActionResource(workflowRunActionResourceId); + + // get the collection of this SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionCollection collection = workflowRunAction.GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitions(); + + // invoke the operation + string repetitionName = "000001"; + NullableResponse response = await collection.GetIfExistsAsync(repetitionName); + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionRepetitionDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource.cs new file mode 100644 index 0000000000000..3b0d0ae1cd356 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + { + // Get a repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetARepetition() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitions_Get.json + // this example is just showing the usage of "WorkflowRunActionRepetitions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource created on azure + // for more information of creating SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource, please refer to the document of SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "testAction"; + string repetitionName = "000001"; + ResourceIdentifier siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId = SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName, repetitionName); + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource siteHostruntimeWebhookApiWorkflowRunActionRepetition = client.GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource(siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId); + + // invoke the operation + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource result = await siteHostruntimeWebhookApiWorkflowRunActionRepetition.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionRepetitionDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List expression traces for a repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetExpressionTraces_ListExpressionTracesForARepetition() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionRepetitions_ListExpressionTraces.json + // this example is just showing the usage of "WorkflowRunActionRepetitions_ListExpressionTraces" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource created on azure + // for more information of creating SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource, please refer to the document of SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "testAction"; + string repetitionName = "000001"; + ResourceIdentifier siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId = SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName, repetitionName); + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource siteHostruntimeWebhookApiWorkflowRunActionRepetition = client.GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource(siteHostruntimeWebhookApiWorkflowRunActionRepetitionResourceId); + + // invoke the operation and iterate over the result + await foreach (ExpressionRoot item in siteHostruntimeWebhookApiWorkflowRunActionRepetition.GetExpressionTracesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionCollection.cs new file mode 100644 index 0000000000000..b435b5d4187e4 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionCollection.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionCollection + { + // List the scoped repetitions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListTheScopedRepetitions() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionScopeRepetitions_List.json + // this example is just showing the usage of "WorkflowRunActionScopeRepetitions_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunActionResource created on azure + // for more information of creating WorkflowRunActionResource, please refer to the document of WorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "for_each"; + ResourceIdentifier workflowRunActionResourceId = WorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName); + WorkflowRunActionResource workflowRunAction = client.GetWorkflowRunActionResource(workflowRunActionResourceId); + + // get the collection of this SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource + SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionCollection collection = workflowRunAction.GetSiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitions(); + + // invoke the operation and iterate over the result + await foreach (SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionRepetitionDefinitionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a scoped repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAScopedRepetition() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionScopeRepetitions_Get.json + // this example is just showing the usage of "WorkflowRunActionScopeRepetitions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunActionResource created on azure + // for more information of creating WorkflowRunActionResource, please refer to the document of WorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "for_each"; + ResourceIdentifier workflowRunActionResourceId = WorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName); + WorkflowRunActionResource workflowRunAction = client.GetWorkflowRunActionResource(workflowRunActionResourceId); + + // get the collection of this SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource + SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionCollection collection = workflowRunAction.GetSiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitions(); + + // invoke the operation + string repetitionName = "000000"; + SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource result = await collection.GetAsync(repetitionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionRepetitionDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a scoped repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAScopedRepetition() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionScopeRepetitions_Get.json + // this example is just showing the usage of "WorkflowRunActionScopeRepetitions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunActionResource created on azure + // for more information of creating WorkflowRunActionResource, please refer to the document of WorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "for_each"; + ResourceIdentifier workflowRunActionResourceId = WorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName); + WorkflowRunActionResource workflowRunAction = client.GetWorkflowRunActionResource(workflowRunActionResourceId); + + // get the collection of this SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource + SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionCollection collection = workflowRunAction.GetSiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitions(); + + // invoke the operation + string repetitionName = "000000"; + bool result = await collection.ExistsAsync(repetitionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a scoped repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAScopedRepetition() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionScopeRepetitions_Get.json + // this example is just showing the usage of "WorkflowRunActionScopeRepetitions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunActionResource created on azure + // for more information of creating WorkflowRunActionResource, please refer to the document of WorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "for_each"; + ResourceIdentifier workflowRunActionResourceId = WorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName); + WorkflowRunActionResource workflowRunAction = client.GetWorkflowRunActionResource(workflowRunActionResourceId); + + // get the collection of this SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource + SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionCollection collection = workflowRunAction.GetSiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitions(); + + // invoke the operation + string repetitionName = "000000"; + NullableResponse response = await collection.GetIfExistsAsync(repetitionName); + SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionRepetitionDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource.cs new file mode 100644 index 0000000000000..1dc0bd83daf4f --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource + { + // Get a scoped repetition + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAScopedRepetition() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActionScopeRepetitions_Get.json + // this example is just showing the usage of "WorkflowRunActionScopeRepetitions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource created on azure + // for more information of creating SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource, please refer to the document of SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "for_each"; + string repetitionName = "000000"; + ResourceIdentifier siteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResourceId = SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName, repetitionName); + SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource siteHostruntimeWebhookApiWorkflowRunActionScopeRepetition = client.GetSiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource(siteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResourceId); + + // invoke the operation + SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource result = await siteHostruntimeWebhookApiWorkflowRunActionScopeRepetition.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionRepetitionDefinitionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceCollection.cs index 71b19f9b11594..1a94882f5240f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteInstanceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetSiteInstanceInfo() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSiteInstanceInfo.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteInstanceInfo.json // this example is just showing the usage of "WebApps_GetInstanceInfo" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +54,7 @@ public async Task Get_GetSiteInstanceInfo() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetSiteInstanceInfo() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSiteInstanceInfo.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteInstanceInfo.json // this example is just showing the usage of "WebApps_GetInstanceInfo" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -85,7 +85,7 @@ public async Task Exists_GetSiteInstanceInfo() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetSiteInstanceInfo() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSiteInstanceInfo.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteInstanceInfo.json // this example is just showing the usage of "WebApps_GetInstanceInfo" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceResource.cs index 599ebeecf82ab..2652d5c1c1356 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteInstanceResource.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteInstanceResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetSiteInstanceInfo() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSiteInstanceInfo.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteInstanceInfo.json // this example is just showing the usage of "WebApps_GetInstanceInfo" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionCollection.cs index a3afab1e02aab..67708763ddae9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_SitePrivateEndpointConnectionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnection.json // this example is just showing the usage of "WebApps_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task Get_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnection.json // this example is just showing the usage of "WebApps_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -86,7 +86,7 @@ public async Task Exists_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnection.json // this example is just showing the usage of "WebApps_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -129,7 +129,7 @@ public async Task GetIfExists_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApprovesOrRejectsAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ApproveRejectSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ApproveRejectSitePrivateEndpointConnection.json // this example is just showing the usage of "WebApps_ApproveOrRejectPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -150,7 +150,7 @@ public async Task CreateOrUpdate_ApprovesOrRejectsAPrivateEndpointConnectionForA // invoke the operation string privateEndpointConnectionName = "connection"; - PrivateLinkConnectionApprovalRequestInfo info = new PrivateLinkConnectionApprovalRequestInfo() + RemotePrivateEndpointConnectionARMResourceData data = new RemotePrivateEndpointConnectionARMResourceData() { PrivateLinkServiceConnectionState = new PrivateLinkConnectionState() { @@ -159,7 +159,7 @@ public async Task CreateOrUpdate_ApprovesOrRejectsAPrivateEndpointConnectionForA ActionsRequired = "", }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, info); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); SitePrivateEndpointConnectionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionResource.cs index 1c6c5111fa774..c4eb72e1345c9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SitePrivateEndpointConnectionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_SitePrivateEndpointConnectionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnection.json // this example is just showing the usage of "WebApps_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task Get_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ApproveRejectSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ApproveRejectSitePrivateEndpointConnection.json // this example is just showing the usage of "WebApps_ApproveOrRejectPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -70,7 +70,7 @@ public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() SitePrivateEndpointConnectionResource sitePrivateEndpointConnection = client.GetSitePrivateEndpointConnectionResource(sitePrivateEndpointConnectionResourceId); // invoke the operation - PrivateLinkConnectionApprovalRequestInfo info = new PrivateLinkConnectionApprovalRequestInfo() + RemotePrivateEndpointConnectionARMResourceData data = new RemotePrivateEndpointConnectionARMResourceData() { PrivateLinkServiceConnectionState = new PrivateLinkConnectionState() { @@ -79,7 +79,7 @@ public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() ActionsRequired = "", }, }; - ArmOperation lro = await sitePrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, info); + ArmOperation lro = await sitePrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); SitePrivateEndpointConnectionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well @@ -94,7 +94,7 @@ public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DeleteSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteSitePrivateEndpointConnection.json // this example is just showing the usage of "WebApps_DeletePrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDeploymentStatuCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDeploymentStatuCollection.cs new file mode 100644 index 0000000000000..98246fd8269d9 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDeploymentStatuCollection.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteSlotDeploymentStatuCollection + { + // List Deployment Status Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListDeploymentStatusSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListSiteDeploymentStatusSlot.json + // this example is just showing the usage of "WebApps_ListSlotSiteDeploymentStatusesSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + string slot = "stage"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotDeploymentStatuResource + SiteSlotDeploymentStatuCollection collection = webSiteSlot.GetSiteSlotDeploymentStatus(); + + // invoke the operation and iterate over the result + await foreach (SiteSlotDeploymentStatuResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CsmDeploymentStatusData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Deployment Status Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDeploymentStatusSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteDeploymentStatusSlot.json + // this example is just showing the usage of "WebApps_GetSlotSiteDeploymentStatusSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + string slot = "stage"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotDeploymentStatuResource + SiteSlotDeploymentStatuCollection collection = webSiteSlot.GetSiteSlotDeploymentStatus(); + + // invoke the operation + string deploymentStatusId = "eacfd68b-3bbd-4ad9-99c5-98614d89c8e5"; + ArmOperation lro = await collection.GetAsync(WaitUntil.Completed, deploymentStatusId); + SiteSlotDeploymentStatuResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CsmDeploymentStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get Deployment Status Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetDeploymentStatusSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteDeploymentStatusSlot.json + // this example is just showing the usage of "WebApps_GetSlotSiteDeploymentStatusSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + string slot = "stage"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotDeploymentStatuResource + SiteSlotDeploymentStatuCollection collection = webSiteSlot.GetSiteSlotDeploymentStatus(); + + // invoke the operation + string deploymentStatusId = "eacfd68b-3bbd-4ad9-99c5-98614d89c8e5"; + ArmOperation lro = await collection.ExistsAsync(WaitUntil.Completed, deploymentStatusId); + bool result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get Deployment Status Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDeploymentStatusSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteDeploymentStatusSlot.json + // this example is just showing the usage of "WebApps_GetSlotSiteDeploymentStatusSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + string slot = "stage"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotDeploymentStatuResource + SiteSlotDeploymentStatuCollection collection = webSiteSlot.GetSiteSlotDeploymentStatus(); + + // invoke the operation + string deploymentStatusId = "eacfd68b-3bbd-4ad9-99c5-98614d89c8e5"; + ArmOperation lro = await collection.GetIfExistsAsync(WaitUntil.Completed, deploymentStatusId); + SiteSlotDeploymentStatuResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CsmDeploymentStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDeploymentStatuResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDeploymentStatuResource.cs new file mode 100644 index 0000000000000..dd4f855dd75f6 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDeploymentStatuResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteSlotDeploymentStatuResource + { + // Get Deployment Status Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDeploymentStatusSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteDeploymentStatusSlot.json + // this example is just showing the usage of "WebApps_GetSlotSiteDeploymentStatusSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteSlotDeploymentStatuResource created on azure + // for more information of creating SiteSlotDeploymentStatuResource, please refer to the document of SiteSlotDeploymentStatuResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testSite"; + string slot = "stage"; + string deploymentStatusId = "eacfd68b-3bbd-4ad9-99c5-98614d89c8e5"; + ResourceIdentifier siteSlotDeploymentStatuResourceId = SiteSlotDeploymentStatuResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot, deploymentStatusId); + SiteSlotDeploymentStatuResource siteSlotDeploymentStatu = client.GetSiteSlotDeploymentStatuResource(siteSlotDeploymentStatuResourceId); + + // invoke the operation + ArmOperation lro = await siteSlotDeploymentStatu.GetAsync(WaitUntil.Completed); + SiteSlotDeploymentStatuResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + CsmDeploymentStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorCollection.cs index dcb4785d9221e..3c08f7eebdf43 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteSlotDetectorCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetAppDetectorResponses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDetectorResponses.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDetectorResponses.json // this example is just showing the usage of "Diagnostics_ListSiteDetectorResponsesSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_GetAppDetectorResponses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetAppSlotDetectorResponses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDetectorResponsesSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDetectorResponsesSlot.json // this example is just showing the usage of "Diagnostics_ListSiteDetectorResponsesSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task GetAll_GetAppSlotDetectorResponses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponseSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -131,7 +131,7 @@ public async Task Get_GetAppDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponseSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -163,7 +163,7 @@ public async Task Exists_GetAppDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponseSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -207,7 +207,7 @@ public async Task GetIfExists_GetAppDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponseSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -243,7 +243,7 @@ public async Task Get_GetAppSlotDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppSlotDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponseSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -275,7 +275,7 @@ public async Task Exists_GetAppSlotDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppSlotDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponseSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorResource.cs index 7aa4f183d79d1..dba633fc74d7f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDetectorResource.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteSlotDetectorResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponse.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponse.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponseSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task Get_GetAppDetectorResponse() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDetectorResponse() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorResponseSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorResponseSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisCollection.cs index 84f3ce19b9101..be64a55602030 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteSlotDiagnosticAnalysisCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppAnalyses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteAnalyses.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteAnalyses.json // this example is just showing the usage of "Diagnostics_ListSiteAnalysesSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -58,7 +58,7 @@ public async Task GetAll_ListAppAnalyses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppSlotAnalyses() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteAnalysesSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteAnalysesSlot.json // this example is just showing the usage of "Diagnostics_ListSiteAnalysesSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -97,7 +97,7 @@ public async Task GetAll_ListAppSlotAnalyses() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysis.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysis.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysisSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -134,7 +134,7 @@ public async Task Get_GetAppAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysis.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysis.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysisSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -167,7 +167,7 @@ public async Task Exists_GetAppAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysis.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysis.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysisSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -212,7 +212,7 @@ public async Task GetIfExists_GetAppAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysisSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysisSlot.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysisSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -249,7 +249,7 @@ public async Task Get_GetAppSlotAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppSlotAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysisSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysisSlot.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysisSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -282,7 +282,7 @@ public async Task Exists_GetAppSlotAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppSlotAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysisSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysisSlot.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysisSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisResource.cs index e84b9bda4be38..b5d76f7277d2a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticAnalysisResource.cs @@ -20,7 +20,7 @@ public partial class Sample_SiteSlotDiagnosticAnalysisResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysis.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysis.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysisSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +54,7 @@ public async Task Get_GetAppAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteAnalysisSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteAnalysisSlot.json // this example is just showing the usage of "Diagnostics_GetSiteAnalysisSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +88,7 @@ public async Task Get_GetAppSlotAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ExecuteSiteAnalysisSlot_ExecuteSiteAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ExecuteSiteAnalysis.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ExecuteSiteAnalysis.json // this example is just showing the usage of "Diagnostics_ExecuteSiteAnalysisSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -118,7 +118,7 @@ public async Task ExecuteSiteAnalysisSlot_ExecuteSiteAnalysis() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ExecuteSiteAnalysisSlot_ExecuteSiteSlotAnalysis() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ExecuteSiteAnalysisSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ExecuteSiteAnalysisSlot.json // this example is just showing the usage of "Diagnostics_ExecuteSiteAnalysisSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticCollection.cs index 8a5868d16506f..8cfd7a1be9205 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteSlotDiagnosticCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppDiagnosticCategories() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDiagnosticCategories.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDiagnosticCategories.json // this example is just showing the usage of "Diagnostics_ListSiteDiagnosticCategoriesSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_ListAppDiagnosticCategories() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppSlotDiagnosticCategories() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDiagnosticCategoriesSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDiagnosticCategoriesSlot.json // this example is just showing the usage of "Diagnostics_ListSiteDiagnosticCategoriesSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -95,7 +95,7 @@ public async Task GetAll_ListAppSlotDiagnosticCategories() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategory.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategory.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategorySlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -131,7 +131,7 @@ public async Task Get_GetAppDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategory.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategory.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategorySlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -163,7 +163,7 @@ public async Task Exists_GetAppDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategory.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategory.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategorySlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -207,7 +207,7 @@ public async Task GetIfExists_GetAppDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategorySlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -243,7 +243,7 @@ public async Task Get_GetAppSlotDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppSlotDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategorySlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -275,7 +275,7 @@ public async Task Exists_GetAppSlotDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppSlotDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategorySlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorCollection.cs index 616decce60186..ed6c16b15d6e5 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteSlotDiagnosticDetectorCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppDetectors() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDetectors.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDetectors.json // this example is just showing the usage of "Diagnostics_ListSiteDetectorsSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -58,7 +58,7 @@ public async Task GetAll_ListAppDetectors() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAppSlotDetectors() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ListSiteDetectorsSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ListSiteDetectorsSlot.json // this example is just showing the usage of "Diagnostics_ListSiteDetectorsSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -97,7 +97,7 @@ public async Task GetAll_ListAppSlotDetectors() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetector.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetector.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -134,7 +134,7 @@ public async Task Get_GetAppDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetector.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetector.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -167,7 +167,7 @@ public async Task Exists_GetAppDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetector.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetector.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -212,7 +212,7 @@ public async Task GetIfExists_GetAppDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -249,7 +249,7 @@ public async Task Get_GetAppSlotDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAppSlotDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -282,7 +282,7 @@ public async Task Exists_GetAppSlotDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAppSlotDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorResource.cs index 722cb050b612b..db6067d71e610 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticDetectorResource.cs @@ -20,7 +20,7 @@ public partial class Sample_SiteSlotDiagnosticDetectorResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetector.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetector.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -54,7 +54,7 @@ public async Task Get_GetAppDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDetectorSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDetectorSlot.json // this example is just showing the usage of "Diagnostics_GetSiteDetectorSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +88,7 @@ public async Task Get_GetAppSlotDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ExecuteSiteDetectorSlot_ExecuteSiteDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ExecuteSiteDetector.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ExecuteSiteDetector.json // this example is just showing the usage of "Diagnostics_ExecuteSiteDetectorSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -118,7 +118,7 @@ public async Task ExecuteSiteDetectorSlot_ExecuteSiteDetector() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ExecuteSiteDetectorSlot_ExecuteSiteSlotDetector() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_ExecuteSiteDetectorSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_ExecuteSiteDetectorSlot.json // this example is just showing the usage of "Diagnostics_ExecuteSiteDetectorSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticResource.cs index d0445feab79f4..577d69fea7cca 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotDiagnosticResource.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteSlotDiagnosticResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategory.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategory.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategorySlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task Get_GetAppDiagnosticCategory() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAppSlotDiagnosticCategory() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Diagnostics_GetSiteDiagnosticCategorySlot.json // this example is just showing the usage of "Diagnostics_GetSiteDiagnosticCategorySlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceCollection.cs index adcd27e8e73b9..ae646e83d3fcc 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteSlotInstanceCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetSiteInstanceInfo() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSiteInstanceInfo.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteInstanceInfo.json // this example is just showing the usage of "WebApps_GetInstanceInfoSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task Get_GetSiteInstanceInfo() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetSiteInstanceInfo() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSiteInstanceInfo.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteInstanceInfo.json // this example is just showing the usage of "WebApps_GetInstanceInfoSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -87,7 +87,7 @@ public async Task Exists_GetSiteInstanceInfo() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetSiteInstanceInfo() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSiteInstanceInfo.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteInstanceInfo.json // this example is just showing the usage of "WebApps_GetInstanceInfoSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceResource.cs index 9f124dafd646d..7dbfddca364e9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotInstanceResource.cs @@ -19,7 +19,7 @@ public partial class Sample_SiteSlotInstanceResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetSiteInstanceInfo() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSiteInstanceInfo.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteInstanceInfo.json // this example is just showing the usage of "WebApps_GetInstanceInfoSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionCollection.cs index c57165f009298..881156b74bc7f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_SiteSlotPrivateEndpointConnectionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnectionSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnectionSlot.json // this example is just showing the usage of "WebApps_GetPrivateEndpointConnectionSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task Get_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnectionSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnectionSlot.json // this example is just showing the usage of "WebApps_GetPrivateEndpointConnectionSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +88,7 @@ public async Task Exists_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnectionSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnectionSlot.json // this example is just showing the usage of "WebApps_GetPrivateEndpointConnectionSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -132,7 +132,7 @@ public async Task GetIfExists_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApprovesOrRejectsAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ApproveRejectSitePrivateEndpointConnectionSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ApproveRejectSitePrivateEndpointConnectionSlot.json // this example is just showing the usage of "WebApps_ApproveOrRejectPrivateEndpointConnectionSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -154,7 +154,7 @@ public async Task CreateOrUpdate_ApprovesOrRejectsAPrivateEndpointConnectionForA // invoke the operation string privateEndpointConnectionName = "connection"; - PrivateLinkConnectionApprovalRequestInfo info = new PrivateLinkConnectionApprovalRequestInfo() + RemotePrivateEndpointConnectionARMResourceData data = new RemotePrivateEndpointConnectionARMResourceData() { PrivateLinkServiceConnectionState = new PrivateLinkConnectionState() { @@ -163,7 +163,7 @@ public async Task CreateOrUpdate_ApprovesOrRejectsAPrivateEndpointConnectionForA ActionsRequired = "", }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, info); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); SiteSlotPrivateEndpointConnectionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionResource.cs index 6bc0ff9966ddf..ce31179a0bce9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotPrivateEndpointConnectionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_SiteSlotPrivateEndpointConnectionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnectionSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnectionSlot.json // this example is just showing the usage of "WebApps_GetPrivateEndpointConnectionSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task Get_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ApproveRejectSitePrivateEndpointConnectionSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ApproveRejectSitePrivateEndpointConnectionSlot.json // this example is just showing the usage of "WebApps_ApproveOrRejectPrivateEndpointConnectionSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -72,7 +72,7 @@ public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() SiteSlotPrivateEndpointConnectionResource siteSlotPrivateEndpointConnection = client.GetSiteSlotPrivateEndpointConnectionResource(siteSlotPrivateEndpointConnectionResourceId); // invoke the operation - PrivateLinkConnectionApprovalRequestInfo info = new PrivateLinkConnectionApprovalRequestInfo() + RemotePrivateEndpointConnectionARMResourceData data = new RemotePrivateEndpointConnectionARMResourceData() { PrivateLinkServiceConnectionState = new PrivateLinkConnectionState() { @@ -81,7 +81,7 @@ public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() ActionsRequired = "", }, }; - ArmOperation lro = await siteSlotPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, info); + ArmOperation lro = await siteSlotPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); SiteSlotPrivateEndpointConnectionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well @@ -96,7 +96,7 @@ public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DeleteSitePrivateEndpointConnectionSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteSitePrivateEndpointConnectionSlot.json // this example is just showing the usage of "WebApps_DeletePrivateEndpointConnectionSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotWorkflowCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotWorkflowCollection.cs new file mode 100644 index 0000000000000..7811d2a008bcd --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotWorkflowCollection.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteSlotWorkflowCollection + { + // List the workflows Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListTheWorkflowsSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListWorkflows.json + // this example is just showing the usage of "WebApps_ListInstanceWorkflowsSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotWorkflowResource + SiteSlotWorkflowCollection collection = webSiteSlot.GetSiteSlotWorkflows(); + + // invoke the operation and iterate over the result + await foreach (SiteSlotWorkflowResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowEnvelopeData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GET a workflow Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GETAWorkflowSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWorkflow.json + // this example is just showing the usage of "WebApps_GetInstanceWorkflowSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotWorkflowResource + SiteSlotWorkflowCollection collection = webSiteSlot.GetSiteSlotWorkflows(); + + // invoke the operation + string workflowName = "stateful1"; + SiteSlotWorkflowResource result = await collection.GetAsync(workflowName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowEnvelopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GET a workflow Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GETAWorkflowSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWorkflow.json + // this example is just showing the usage of "WebApps_GetInstanceWorkflowSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotWorkflowResource + SiteSlotWorkflowCollection collection = webSiteSlot.GetSiteSlotWorkflows(); + + // invoke the operation + string workflowName = "stateful1"; + bool result = await collection.ExistsAsync(workflowName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GET a workflow Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GETAWorkflowSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWorkflow.json + // this example is just showing the usage of "WebApps_GetInstanceWorkflowSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // get the collection of this SiteSlotWorkflowResource + SiteSlotWorkflowCollection collection = webSiteSlot.GetSiteSlotWorkflows(); + + // invoke the operation + string workflowName = "stateful1"; + NullableResponse response = await collection.GetIfExistsAsync(workflowName); + SiteSlotWorkflowResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowEnvelopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotWorkflowResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotWorkflowResource.cs new file mode 100644 index 0000000000000..7aab1fc653774 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteSlotWorkflowResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteSlotWorkflowResource + { + // GET a workflow Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GETAWorkflowSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWorkflow.json + // this example is just showing the usage of "WebApps_GetInstanceWorkflowSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteSlotWorkflowResource created on azure + // for more information of creating SiteSlotWorkflowResource, please refer to the document of SiteSlotWorkflowResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + string slot = "staging"; + string workflowName = "stateful1"; + ResourceIdentifier siteSlotWorkflowResourceId = SiteSlotWorkflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot, workflowName); + SiteSlotWorkflowResource siteSlotWorkflow = client.GetSiteSlotWorkflowResource(siteSlotWorkflowResourceId); + + // invoke the operation + SiteSlotWorkflowResource result = await siteSlotWorkflow.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowEnvelopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteWorkflowCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteWorkflowCollection.cs new file mode 100644 index 0000000000000..38135f6bec1c2 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteWorkflowCollection.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteWorkflowCollection + { + // List the workflows + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListTheWorkflows() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListWorkflows.json + // this example is just showing the usage of "WebApps_ListWorkflows" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteWorkflowResource + SiteWorkflowCollection collection = webSite.GetSiteWorkflows(); + + // invoke the operation and iterate over the result + await foreach (SiteWorkflowResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowEnvelopeData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GET a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GETAWorkflow() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWorkflow.json + // this example is just showing the usage of "WebApps_GetWorkflow" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteWorkflowResource + SiteWorkflowCollection collection = webSite.GetSiteWorkflows(); + + // invoke the operation + string workflowName = "stateful1"; + SiteWorkflowResource result = await collection.GetAsync(workflowName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowEnvelopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GET a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GETAWorkflow() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWorkflow.json + // this example is just showing the usage of "WebApps_GetWorkflow" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteWorkflowResource + SiteWorkflowCollection collection = webSite.GetSiteWorkflows(); + + // invoke the operation + string workflowName = "stateful1"; + bool result = await collection.ExistsAsync(workflowName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GET a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GETAWorkflow() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWorkflow.json + // this example is just showing the usage of "WebApps_GetWorkflow" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this SiteWorkflowResource + SiteWorkflowCollection collection = webSite.GetSiteWorkflows(); + + // invoke the operation + string workflowName = "stateful1"; + NullableResponse response = await collection.GetIfExistsAsync(workflowName); + SiteWorkflowResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowEnvelopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteWorkflowResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteWorkflowResource.cs new file mode 100644 index 0000000000000..b685b363d036b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SiteWorkflowResource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_SiteWorkflowResource + { + // GET a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GETAWorkflow() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWorkflow.json + // this example is just showing the usage of "WebApps_GetWorkflow" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SiteWorkflowResource created on azure + // for more information of creating SiteWorkflowResource, please refer to the document of SiteWorkflowResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + string workflowName = "stateful1"; + ResourceIdentifier siteWorkflowResourceId = SiteWorkflowResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName); + SiteWorkflowResource siteWorkflow = client.GetSiteWorkflowResource(siteWorkflowResourceId); + + // invoke the operation + SiteWorkflowResource result = await siteWorkflow.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowEnvelopeData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBasicAuthPropertiesARMResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBasicAuthPropertiesARMResource.cs new file mode 100644 index 0000000000000..cb3d67dc95643 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBasicAuthPropertiesARMResource.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_StaticSiteBasicAuthPropertiesARMResource + { + // Gets the basic auth properties for a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsTheBasicAuthPropertiesForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBasicAuth.json + // this example is just showing the usage of "StaticSites_GetBasicAuth" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBasicAuthPropertiesARMResource created on azure + // for more information of creating StaticSiteBasicAuthPropertiesARMResource, please refer to the document of StaticSiteBasicAuthPropertiesARMResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + BasicAuthName basicAuthName = BasicAuthName.Default; + ResourceIdentifier staticSiteBasicAuthPropertiesARMResourceId = StaticSiteBasicAuthPropertiesARMResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, basicAuthName); + StaticSiteBasicAuthPropertiesARMResource staticSiteBasicAuthPropertiesARMResource = client.GetStaticSiteBasicAuthPropertiesARMResource(staticSiteBasicAuthPropertiesARMResourceId); + + // invoke the operation + StaticSiteBasicAuthPropertiesARMResource result = await staticSiteBasicAuthPropertiesARMResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteBasicAuthPropertiesARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Creates or updates basic auth properties for a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreatesOrUpdatesBasicAuthPropertiesForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSiteBasicAuth.json + // this example is just showing the usage of "StaticSites_CreateOrUpdateBasicAuth" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBasicAuthPropertiesARMResource created on azure + // for more information of creating StaticSiteBasicAuthPropertiesARMResource, please refer to the document of StaticSiteBasicAuthPropertiesARMResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + BasicAuthName basicAuthName = BasicAuthName.Default; + ResourceIdentifier staticSiteBasicAuthPropertiesARMResourceId = StaticSiteBasicAuthPropertiesARMResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, basicAuthName); + StaticSiteBasicAuthPropertiesARMResource staticSiteBasicAuthPropertiesARMResource = client.GetStaticSiteBasicAuthPropertiesARMResource(staticSiteBasicAuthPropertiesARMResourceId); + + // invoke the operation + StaticSiteBasicAuthPropertiesARMResourceData data = new StaticSiteBasicAuthPropertiesARMResourceData() + { + Password = "**********************", + SecretUri = null, + ApplicableEnvironmentsMode = "AllEnvironments", + Environments = +{ +}, + }; + ArmOperation lro = await staticSiteBasicAuthPropertiesARMResource.UpdateAsync(WaitUntil.Completed, data); + StaticSiteBasicAuthPropertiesARMResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteBasicAuthPropertiesARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBasicAuthPropertiesARMResourceCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBasicAuthPropertiesARMResourceCollection.cs new file mode 100644 index 0000000000000..3d022e080f73d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBasicAuthPropertiesARMResourceCollection.cs @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_StaticSiteBasicAuthPropertiesARMResourceCollection + { + // Lists the basic auth properties for a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListsTheBasicAuthPropertiesForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListStaticSiteBasicAuth.json + // this example is just showing the usage of "StaticSites_ListBasicAuth" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteBasicAuthPropertiesARMResource + StaticSiteBasicAuthPropertiesARMResourceCollection collection = staticSite.GetStaticSiteBasicAuthPropertiesARMResources(); + + // invoke the operation and iterate over the result + await foreach (StaticSiteBasicAuthPropertiesARMResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteBasicAuthPropertiesARMResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Gets the basic auth properties for a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetsTheBasicAuthPropertiesForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBasicAuth.json + // this example is just showing the usage of "StaticSites_GetBasicAuth" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteBasicAuthPropertiesARMResource + StaticSiteBasicAuthPropertiesARMResourceCollection collection = staticSite.GetStaticSiteBasicAuthPropertiesARMResources(); + + // invoke the operation + BasicAuthName basicAuthName = BasicAuthName.Default; + StaticSiteBasicAuthPropertiesARMResource result = await collection.GetAsync(basicAuthName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteBasicAuthPropertiesARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Gets the basic auth properties for a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetsTheBasicAuthPropertiesForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBasicAuth.json + // this example is just showing the usage of "StaticSites_GetBasicAuth" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteBasicAuthPropertiesARMResource + StaticSiteBasicAuthPropertiesARMResourceCollection collection = staticSite.GetStaticSiteBasicAuthPropertiesARMResources(); + + // invoke the operation + BasicAuthName basicAuthName = BasicAuthName.Default; + bool result = await collection.ExistsAsync(basicAuthName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Gets the basic auth properties for a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetsTheBasicAuthPropertiesForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBasicAuth.json + // this example is just showing the usage of "StaticSites_GetBasicAuth" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteBasicAuthPropertiesARMResource + StaticSiteBasicAuthPropertiesARMResourceCollection collection = staticSite.GetStaticSiteBasicAuthPropertiesARMResources(); + + // invoke the operation + BasicAuthName basicAuthName = BasicAuthName.Default; + NullableResponse response = await collection.GetIfExistsAsync(basicAuthName); + StaticSiteBasicAuthPropertiesARMResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteBasicAuthPropertiesARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Creates or updates basic auth properties for a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreatesOrUpdatesBasicAuthPropertiesForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSiteBasicAuth.json + // this example is just showing the usage of "StaticSites_CreateOrUpdateBasicAuth" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteBasicAuthPropertiesARMResource + StaticSiteBasicAuthPropertiesARMResourceCollection collection = staticSite.GetStaticSiteBasicAuthPropertiesARMResources(); + + // invoke the operation + BasicAuthName basicAuthName = BasicAuthName.Default; + StaticSiteBasicAuthPropertiesARMResourceData data = new StaticSiteBasicAuthPropertiesARMResourceData() + { + Password = "**********************", + SecretUri = null, + ApplicableEnvironmentsMode = "AllEnvironments", + Environments = +{ +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, basicAuthName, data); + StaticSiteBasicAuthPropertiesARMResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteBasicAuthPropertiesARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildCollection.cs index 598ab030f6a11..ba778118a6d49 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_StaticSiteBuildCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetAllBuildsForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteBuilds.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuilds.json // this example is just showing the usage of "StaticSites_GetStaticSiteBuilds" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetAll_GetAllBuildsForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuild.json // this example is just showing the usage of "StaticSites_GetStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +91,7 @@ public async Task Get_GetAStaticSiteBuild() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuild.json // this example is just showing the usage of "StaticSites_GetStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +122,7 @@ public async Task Exists_GetAStaticSiteBuild() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuild.json // this example is just showing the usage of "StaticSites_GetStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildDatabaseConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildDatabaseConnectionCollection.cs new file mode 100644 index 0000000000000..969ec9490df3a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildDatabaseConnectionCollection.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_StaticSiteBuildDatabaseConnectionCollection + { + // List overviews of database connections for the static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListOverviewsOfDatabaseConnectionsForTheStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuildDatabaseConnections.json + // this example is just showing the usage of "StaticSites_GetBuildDatabaseConnections" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildDatabaseConnectionResource + StaticSiteBuildDatabaseConnectionCollection collection = staticSiteBuild.GetStaticSiteBuildDatabaseConnections(); + + // invoke the operation and iterate over the result + await foreach (StaticSiteBuildDatabaseConnectionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get overview of database connections for the static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetOverviewOfDatabaseConnectionsForTheStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuildDatabaseConnection.json + // this example is just showing the usage of "StaticSites_GetBuildDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildDatabaseConnectionResource + StaticSiteBuildDatabaseConnectionCollection collection = staticSiteBuild.GetStaticSiteBuildDatabaseConnections(); + + // invoke the operation + string databaseConnectionName = "default"; + StaticSiteBuildDatabaseConnectionResource result = await collection.GetAsync(databaseConnectionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get overview of database connections for the static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetOverviewOfDatabaseConnectionsForTheStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuildDatabaseConnection.json + // this example is just showing the usage of "StaticSites_GetBuildDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildDatabaseConnectionResource + StaticSiteBuildDatabaseConnectionCollection collection = staticSiteBuild.GetStaticSiteBuildDatabaseConnections(); + + // invoke the operation + string databaseConnectionName = "default"; + bool result = await collection.ExistsAsync(databaseConnectionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get overview of database connections for the static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetOverviewOfDatabaseConnectionsForTheStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuildDatabaseConnection.json + // this example is just showing the usage of "StaticSites_GetBuildDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildDatabaseConnectionResource + StaticSiteBuildDatabaseConnectionCollection collection = staticSiteBuild.GetStaticSiteBuildDatabaseConnections(); + + // invoke the operation + string databaseConnectionName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(databaseConnectionName); + StaticSiteBuildDatabaseConnectionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create or update a database connection for a static site build + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateADatabaseConnectionForAStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSiteBuildDatabaseConnection.json + // this example is just showing the usage of "StaticSites_CreateOrUpdateBuildDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildDatabaseConnectionResource + StaticSiteBuildDatabaseConnectionCollection collection = staticSiteBuild.GetStaticSiteBuildDatabaseConnections(); + + // invoke the operation + string databaseConnectionName = "default"; + DatabaseConnectionData data = new DatabaseConnectionData() + { + ResourceId = "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/databaseRG/providers/Microsoft.DocumentDB/databaseAccounts/exampleDatabaseName", + ConnectionIdentity = "SystemAssigned", + ConnectionString = "AccountEndpoint=https://exampleDatabaseName.documents.azure.com:443/;Database=mydb;", + Region = "West US 2", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseConnectionName, data); + StaticSiteBuildDatabaseConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildDatabaseConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildDatabaseConnectionResource.cs new file mode 100644 index 0000000000000..aacf3ea124d92 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildDatabaseConnectionResource.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_StaticSiteBuildDatabaseConnectionResource + { + // Get overview of database connections for the static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetOverviewOfDatabaseConnectionsForTheStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuildDatabaseConnection.json + // this example is just showing the usage of "StaticSites_GetBuildDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildDatabaseConnectionResource created on azure + // for more information of creating StaticSiteBuildDatabaseConnectionResource, please refer to the document of StaticSiteBuildDatabaseConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + string databaseConnectionName = "default"; + ResourceIdentifier staticSiteBuildDatabaseConnectionResourceId = StaticSiteBuildDatabaseConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName, databaseConnectionName); + StaticSiteBuildDatabaseConnectionResource staticSiteBuildDatabaseConnection = client.GetStaticSiteBuildDatabaseConnectionResource(staticSiteBuildDatabaseConnectionResourceId); + + // invoke the operation + StaticSiteBuildDatabaseConnectionResource result = await staticSiteBuildDatabaseConnection.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete a database connection from a static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteADatabaseConnectionFromAStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteStaticSiteBuildDatabaseConnection.json + // this example is just showing the usage of "StaticSites_DeleteBuildDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildDatabaseConnectionResource created on azure + // for more information of creating StaticSiteBuildDatabaseConnectionResource, please refer to the document of StaticSiteBuildDatabaseConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + string databaseConnectionName = "default"; + ResourceIdentifier staticSiteBuildDatabaseConnectionResourceId = StaticSiteBuildDatabaseConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName, databaseConnectionName); + StaticSiteBuildDatabaseConnectionResource staticSiteBuildDatabaseConnection = client.GetStaticSiteBuildDatabaseConnectionResource(staticSiteBuildDatabaseConnectionResourceId); + + // invoke the operation + await staticSiteBuildDatabaseConnection.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Patch a database connection for a static site build + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PatchADatabaseConnectionForAStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/PatchStaticSiteBuildDatabaseConnection.json + // this example is just showing the usage of "StaticSites_UpdateBuildDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildDatabaseConnectionResource created on azure + // for more information of creating StaticSiteBuildDatabaseConnectionResource, please refer to the document of StaticSiteBuildDatabaseConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + string databaseConnectionName = "default"; + ResourceIdentifier staticSiteBuildDatabaseConnectionResourceId = StaticSiteBuildDatabaseConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName, databaseConnectionName); + StaticSiteBuildDatabaseConnectionResource staticSiteBuildDatabaseConnection = client.GetStaticSiteBuildDatabaseConnectionResource(staticSiteBuildDatabaseConnectionResourceId); + + // invoke the operation + DatabaseConnectionPatchRequest databaseConnectionRequestEnvelope = new DatabaseConnectionPatchRequest(); + StaticSiteBuildDatabaseConnectionResource result = await staticSiteBuildDatabaseConnection.UpdateAsync(databaseConnectionRequestEnvelope); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get details of database connections for the static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetBuildDatabaseConnectionWithDetails_GetDetailsOfDatabaseConnectionsForTheStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuildDatabaseConnectionWithDetails.json + // this example is just showing the usage of "StaticSites_GetBuildDatabaseConnectionWithDetails" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildDatabaseConnectionResource created on azure + // for more information of creating StaticSiteBuildDatabaseConnectionResource, please refer to the document of StaticSiteBuildDatabaseConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + string databaseConnectionName = "default"; + ResourceIdentifier staticSiteBuildDatabaseConnectionResourceId = StaticSiteBuildDatabaseConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName, databaseConnectionName); + StaticSiteBuildDatabaseConnectionResource staticSiteBuildDatabaseConnection = client.GetStaticSiteBuildDatabaseConnectionResource(staticSiteBuildDatabaseConnectionResourceId); + + // invoke the operation + StaticSiteBuildDatabaseConnectionResource result = await staticSiteBuildDatabaseConnection.GetBuildDatabaseConnectionWithDetailsAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildLinkedBackendCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildLinkedBackendCollection.cs new file mode 100644 index 0000000000000..ded6a02e531d7 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildLinkedBackendCollection.cs @@ -0,0 +1,209 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_StaticSiteBuildLinkedBackendCollection + { + // Get details of the linked backends registered with a static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetDetailsOfTheLinkedBackendsRegisteredWithAStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetLinkedBackendsForStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_GetLinkedBackendsForBuild" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildLinkedBackendResource + StaticSiteBuildLinkedBackendCollection collection = staticSiteBuild.GetStaticSiteBuildLinkedBackends(); + + // invoke the operation and iterate over the result + await foreach (StaticSiteBuildLinkedBackendResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get details of the linked backend registered with a static site build by name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDetailsOfTheLinkedBackendRegisteredWithAStaticSiteBuildByName() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetLinkedBackendForStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_GetLinkedBackendForBuild" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildLinkedBackendResource + StaticSiteBuildLinkedBackendCollection collection = staticSiteBuild.GetStaticSiteBuildLinkedBackends(); + + // invoke the operation + string linkedBackendName = "testBackend"; + StaticSiteBuildLinkedBackendResource result = await collection.GetAsync(linkedBackendName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get details of the linked backend registered with a static site build by name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetDetailsOfTheLinkedBackendRegisteredWithAStaticSiteBuildByName() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetLinkedBackendForStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_GetLinkedBackendForBuild" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildLinkedBackendResource + StaticSiteBuildLinkedBackendCollection collection = staticSiteBuild.GetStaticSiteBuildLinkedBackends(); + + // invoke the operation + string linkedBackendName = "testBackend"; + bool result = await collection.ExistsAsync(linkedBackendName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get details of the linked backend registered with a static site build by name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDetailsOfTheLinkedBackendRegisteredWithAStaticSiteBuildByName() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetLinkedBackendForStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_GetLinkedBackendForBuild" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildLinkedBackendResource + StaticSiteBuildLinkedBackendCollection collection = staticSiteBuild.GetStaticSiteBuildLinkedBackends(); + + // invoke the operation + string linkedBackendName = "testBackend"; + NullableResponse response = await collection.GetIfExistsAsync(linkedBackendName); + StaticSiteBuildLinkedBackendResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Link a backend to a static site build + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_LinkABackendToAStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/LinkBackendToStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_LinkBackendToBuild" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // get the collection of this StaticSiteBuildLinkedBackendResource + StaticSiteBuildLinkedBackendCollection collection = staticSiteBuild.GetStaticSiteBuildLinkedBackends(); + + // invoke the operation + string linkedBackendName = "testBackend"; + StaticSiteLinkedBackendARMResourceData data = new StaticSiteLinkedBackendARMResourceData() + { + BackendResourceId = "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/backendRg/providers/Microsoft.Web/sites/testBackend", + Region = "West US 2", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, linkedBackendName, data); + StaticSiteBuildLinkedBackendResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildLinkedBackendResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildLinkedBackendResource.cs new file mode 100644 index 0000000000000..a028085d367cb --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildLinkedBackendResource.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_StaticSiteBuildLinkedBackendResource + { + // Validate if backend can be linked to static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ValidateBackendForBuild_ValidateIfBackendCanBeLinkedToStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ValidateLinkedBackendForStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_ValidateBackendForBuild" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildLinkedBackendResource created on azure + // for more information of creating StaticSiteBuildLinkedBackendResource, please refer to the document of StaticSiteBuildLinkedBackendResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + string linkedBackendName = "testBackend"; + ResourceIdentifier staticSiteBuildLinkedBackendResourceId = StaticSiteBuildLinkedBackendResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName, linkedBackendName); + StaticSiteBuildLinkedBackendResource staticSiteBuildLinkedBackend = client.GetStaticSiteBuildLinkedBackendResource(staticSiteBuildLinkedBackendResourceId); + + // invoke the operation + StaticSiteLinkedBackendARMResourceData data = new StaticSiteLinkedBackendARMResourceData() + { + BackendResourceId = "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/backendRg/providers/Microsoft.Web/sites/testBackend", + Region = "West US 2", + }; + await staticSiteBuildLinkedBackend.ValidateBackendForBuildAsync(WaitUntil.Completed, data); + + Console.WriteLine($"Succeeded"); + } + + // Get details of the linked backend registered with a static site build by name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDetailsOfTheLinkedBackendRegisteredWithAStaticSiteBuildByName() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetLinkedBackendForStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_GetLinkedBackendForBuild" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildLinkedBackendResource created on azure + // for more information of creating StaticSiteBuildLinkedBackendResource, please refer to the document of StaticSiteBuildLinkedBackendResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + string linkedBackendName = "testBackend"; + ResourceIdentifier staticSiteBuildLinkedBackendResourceId = StaticSiteBuildLinkedBackendResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName, linkedBackendName); + StaticSiteBuildLinkedBackendResource staticSiteBuildLinkedBackend = client.GetStaticSiteBuildLinkedBackendResource(staticSiteBuildLinkedBackendResourceId); + + // invoke the operation + StaticSiteBuildLinkedBackendResource result = await staticSiteBuildLinkedBackend.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Link a backend to a static site build + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_LinkABackendToAStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/LinkBackendToStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_LinkBackendToBuild" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildLinkedBackendResource created on azure + // for more information of creating StaticSiteBuildLinkedBackendResource, please refer to the document of StaticSiteBuildLinkedBackendResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + string linkedBackendName = "testBackend"; + ResourceIdentifier staticSiteBuildLinkedBackendResourceId = StaticSiteBuildLinkedBackendResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName, linkedBackendName); + StaticSiteBuildLinkedBackendResource staticSiteBuildLinkedBackend = client.GetStaticSiteBuildLinkedBackendResource(staticSiteBuildLinkedBackendResourceId); + + // invoke the operation + StaticSiteLinkedBackendARMResourceData data = new StaticSiteLinkedBackendARMResourceData() + { + BackendResourceId = "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/backendRg/providers/Microsoft.Web/sites/testBackend", + Region = "West US 2", + }; + ArmOperation lro = await staticSiteBuildLinkedBackend.UpdateAsync(WaitUntil.Completed, data); + StaticSiteBuildLinkedBackendResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Unlink a backend from a static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_UnlinkABackendFromAStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UnlinkBackendFromStaticSiteBuild.json + // this example is just showing the usage of "StaticSites_UnlinkBackendFromBuild" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildLinkedBackendResource created on azure + // for more information of creating StaticSiteBuildLinkedBackendResource, please refer to the document of StaticSiteBuildLinkedBackendResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "12"; + string linkedBackendName = "testBackend"; + ResourceIdentifier staticSiteBuildLinkedBackendResourceId = StaticSiteBuildLinkedBackendResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName, linkedBackendName); + StaticSiteBuildLinkedBackendResource staticSiteBuildLinkedBackend = client.GetStaticSiteBuildLinkedBackendResource(staticSiteBuildLinkedBackendResourceId); + + // invoke the operation + await staticSiteBuildLinkedBackend.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildResource.cs index 5eeee0dff457a..0f2a059279352 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildResource.cs @@ -20,7 +20,7 @@ public partial class Sample_StaticSiteBuildResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuild.json // this example is just showing the usage of "StaticSites_GetStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task Get_GetAStaticSiteBuild() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DeleteStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteStaticSiteBuild.json // this example is just showing the usage of "StaticSites_DeleteStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -80,7 +80,7 @@ public async Task Delete_DeleteAStaticSiteBuild() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateAppSettings_CreatesOrUpdatesTheFunctionAppSettingsOfAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/CreateOrUpdateStaticSiteBuildAppSettings.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSiteBuildAppSettings.json // this example is just showing the usage of "StaticSites_CreateOrUpdateStaticSiteBuildAppSettings" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -116,7 +116,7 @@ public async Task CreateOrUpdateAppSettings_CreatesOrUpdatesTheFunctionAppSettin [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateFunctionAppSettings_CreatesOrUpdatesTheFunctionAppSettingsOfAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/CreateOrUpdateStaticSiteBuildFunctionAppSettings.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSiteBuildFunctionAppSettings.json // this example is just showing the usage of "StaticSites_CreateOrUpdateStaticSiteBuildFunctionAppSettings" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -152,7 +152,7 @@ public async Task CreateOrUpdateFunctionAppSettings_CreatesOrUpdatesTheFunctionA [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetFunctions_GetsTheFunctionsOfAParticularStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListStaticSiteBuildFunctions.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListStaticSiteBuildFunctions.json // this example is just showing the usage of "StaticSites_ListStaticSiteBuildFunctions" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -183,7 +183,7 @@ public async Task GetFunctions_GetsTheFunctionsOfAParticularStaticSiteBuild() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetStaticSiteBuildAppSettings_GetAppSettingsOfAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListStaticSiteBuildAppSettings.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListStaticSiteBuildAppSettings.json // this example is just showing the usage of "StaticSites_ListStaticSiteBuildAppSettings" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -211,7 +211,7 @@ public async Task GetStaticSiteBuildAppSettings_GetAppSettingsOfAStaticSiteBuild [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetFunctionAppSettings_GetFunctionAppSettingsOfAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListStaticSiteBuildFunctionAppSettings.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListStaticSiteBuildFunctionAppSettings.json // this example is just showing the usage of "StaticSites_ListStaticSiteBuildFunctionAppSettings" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -234,12 +234,44 @@ public async Task GetFunctionAppSettings_GetFunctionAppSettingsOfAStaticSiteBuil Console.WriteLine($"Succeeded: {result}"); } + // List full details of database connections for the static site build. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetBuildDatabaseConnectionsWithDetails_ListFullDetailsOfDatabaseConnectionsForTheStaticSiteBuild() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteBuildDatabaseConnectionsWithDetails.json + // this example is just showing the usage of "StaticSites_GetBuildDatabaseConnectionsWithDetails" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteBuildResource created on azure + // for more information of creating StaticSiteBuildResource, please refer to the document of StaticSiteBuildResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string environmentName = "default"; + ResourceIdentifier staticSiteBuildResourceId = StaticSiteBuildResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, environmentName); + StaticSiteBuildResource staticSiteBuild = client.GetStaticSiteBuildResource(staticSiteBuildResourceId); + + // invoke the operation and iterate over the result + await foreach (DatabaseConnectionData item in staticSiteBuild.GetBuildDatabaseConnectionsWithDetailsAsync()) + { + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {item.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + // Deploy a site from a zipped package to a particular static site build [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateZipDeployment_DeployASiteFromAZippedPackageToAParticularStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/StaticSiteBuildZipDeploy.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/StaticSiteBuildZipDeploy.json // this example is just showing the usage of "StaticSites_CreateZipDeploymentForStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppCollection.cs index 03d017d58af08..a1f12471d0d9e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_StaticSiteBuildUserProvidedFunctionAppCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetDetailsOfTheUserProvidedFunctionAppsRegisteredWithAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppsForStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUserProvidedFunctionAppsForStaticSiteBuild.json // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppsForStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_GetDetailsOfTheUserProvidedFunctionAppsRegisteredWithAS [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppForStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUserProvidedFunctionAppForStaticSiteBuild.json // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppForStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,7 +93,7 @@ public async Task Get_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStati [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppForStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUserProvidedFunctionAppForStaticSiteBuild.json // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppForStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task Exists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithASt [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppForStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUserProvidedFunctionAppForStaticSiteBuild.json // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppForStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -169,7 +169,7 @@ public async Task GetIfExists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWi [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_RegisterAUserProvidedFunctionAppWithAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/RegisterUserProvidedFunctionAppWithStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/RegisterUserProvidedFunctionAppWithStaticSiteBuild.json // this example is just showing the usage of "StaticSites_RegisterUserProvidedFunctionAppWithStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppResource.cs index 3eefdd64d9529..2aa4315f152b2 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteBuildUserProvidedFunctionAppResource.cs @@ -19,7 +19,7 @@ public partial class Sample_StaticSiteBuildUserProvidedFunctionAppResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppForStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUserProvidedFunctionAppForStaticSiteBuild.json // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppForStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task Get_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStati [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_RegisterAUserProvidedFunctionAppWithAStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/RegisterUserProvidedFunctionAppWithStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/RegisterUserProvidedFunctionAppWithStaticSiteBuild.json // this example is just showing the usage of "StaticSites_RegisterUserProvidedFunctionAppWithStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,7 +92,7 @@ public async Task Update_RegisterAUserProvidedFunctionAppWithAStaticSiteBuild() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DetachTheUserProvidedFunctionAppFromTheStaticSiteBuild() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DetachUserProvidedFunctionAppFromStaticSiteBuild.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DetachUserProvidedFunctionAppFromStaticSiteBuild.json // this example is just showing the usage of "StaticSites_DetachUserProvidedFunctionAppFromStaticSiteBuild" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCollection.cs index f1ba0dbd95e62..12f2e83e8d22f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCollection.cs @@ -21,7 +21,7 @@ public partial class Sample_StaticSiteCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetStaticSitesForAResourceGroup() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSites.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSites.json // this example is just showing the usage of "StaticSites_GetStaticSitesByResourceGroup" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_GetStaticSitesForAResourceGroup() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDetailsForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSite.json // this example is just showing the usage of "StaticSites_GetStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +91,7 @@ public async Task Get_GetDetailsForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetDetailsForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSite.json // this example is just showing the usage of "StaticSites_GetStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -121,7 +121,7 @@ public async Task Exists_GetDetailsForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetDetailsForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSite.json // this example is just showing the usage of "StaticSites_GetStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -163,7 +163,7 @@ public async Task GetIfExists_GetDetailsForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/CreateOrUpdateStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSite.json // this example is just showing the usage of "StaticSites_CreateOrUpdateStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewCollection.cs index 42c8e97a48766..9f718ef92d5cf 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_StaticSiteCustomDomainOverviewCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListCustomDomainsForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteCustomDomains.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteCustomDomains.json // this example is just showing the usage of "StaticSites_ListStaticSiteCustomDomains" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_ListCustomDomainsForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetCustomDomainForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteCustomDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteCustomDomain.json // this example is just showing the usage of "StaticSites_GetStaticSiteCustomDomain" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,7 +92,7 @@ public async Task Get_GetCustomDomainForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetCustomDomainForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteCustomDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteCustomDomain.json // this example is just showing the usage of "StaticSites_GetStaticSiteCustomDomain" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -123,7 +123,7 @@ public async Task Exists_GetCustomDomainForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetCustomDomainForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteCustomDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteCustomDomain.json // this example is just showing the usage of "StaticSites_GetStaticSiteCustomDomain" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -166,7 +166,7 @@ public async Task GetIfExists_GetCustomDomainForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateACustomDomainForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/CreateOrUpdateStaticSiteCustomDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSiteCustomDomain.json // this example is just showing the usage of "StaticSites_CreateOrUpdateStaticSiteCustomDomain" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewResource.cs index 11365c3fd8427..d798b6af3710e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteCustomDomainOverviewResource.cs @@ -20,7 +20,7 @@ public partial class Sample_StaticSiteCustomDomainOverviewResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetCustomDomainForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSiteCustomDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteCustomDomain.json // this example is just showing the usage of "StaticSites_GetStaticSiteCustomDomain" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task Get_GetCustomDomainForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateOrUpdateACustomDomainForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/CreateOrUpdateStaticSiteCustomDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSiteCustomDomain.json // this example is just showing the usage of "StaticSites_CreateOrUpdateStaticSiteCustomDomain" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -86,7 +86,7 @@ public async Task Update_CreateOrUpdateACustomDomainForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteACustomDomainForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DeleteStaticSiteCustomDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteStaticSiteCustomDomain.json // this example is just showing the usage of "StaticSites_DeleteStaticSiteCustomDomain" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -114,7 +114,7 @@ public async Task Delete_DeleteACustomDomainForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ValidateCustomDomainCanBeAddedToStaticSite_ValidateACustomDomainForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ValidateStaticSiteCustomDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ValidateStaticSiteCustomDomain.json // this example is just showing the usage of "StaticSites_ValidateCustomDomainCanBeAddedToStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteDatabaseConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteDatabaseConnectionCollection.cs new file mode 100644 index 0000000000000..f0acc5e19baf7 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteDatabaseConnectionCollection.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_StaticSiteDatabaseConnectionCollection + { + // List overviews of database connections for the static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListOverviewsOfDatabaseConnectionsForTheStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteDatabaseConnections.json + // this example is just showing the usage of "StaticSites_GetDatabaseConnections" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteDatabaseConnectionResource + StaticSiteDatabaseConnectionCollection collection = staticSite.GetStaticSiteDatabaseConnections(); + + // invoke the operation and iterate over the result + await foreach (StaticSiteDatabaseConnectionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get overview of database connections for the static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetOverviewOfDatabaseConnectionsForTheStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteDatabaseConnection.json + // this example is just showing the usage of "StaticSites_GetDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteDatabaseConnectionResource + StaticSiteDatabaseConnectionCollection collection = staticSite.GetStaticSiteDatabaseConnections(); + + // invoke the operation + string databaseConnectionName = "default"; + StaticSiteDatabaseConnectionResource result = await collection.GetAsync(databaseConnectionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get overview of database connections for the static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetOverviewOfDatabaseConnectionsForTheStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteDatabaseConnection.json + // this example is just showing the usage of "StaticSites_GetDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteDatabaseConnectionResource + StaticSiteDatabaseConnectionCollection collection = staticSite.GetStaticSiteDatabaseConnections(); + + // invoke the operation + string databaseConnectionName = "default"; + bool result = await collection.ExistsAsync(databaseConnectionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get overview of database connections for the static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetOverviewOfDatabaseConnectionsForTheStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteDatabaseConnection.json + // this example is just showing the usage of "StaticSites_GetDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteDatabaseConnectionResource + StaticSiteDatabaseConnectionCollection collection = staticSite.GetStaticSiteDatabaseConnections(); + + // invoke the operation + string databaseConnectionName = "default"; + NullableResponse response = await collection.GetIfExistsAsync(databaseConnectionName); + StaticSiteDatabaseConnectionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Create or update a database connection for a static site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateADatabaseConnectionForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSiteDatabaseConnection.json + // this example is just showing the usage of "StaticSites_CreateOrUpdateDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteDatabaseConnectionResource + StaticSiteDatabaseConnectionCollection collection = staticSite.GetStaticSiteDatabaseConnections(); + + // invoke the operation + string databaseConnectionName = "default"; + DatabaseConnectionData data = new DatabaseConnectionData() + { + ResourceId = "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/databaseRG/providers/Microsoft.DocumentDB/databaseAccounts/exampleDatabaseName", + ConnectionIdentity = "SystemAssigned", + ConnectionString = "AccountEndpoint=https://exampleDatabaseName.documents.azure.com:443/;Database=mydb;", + Region = "West US 2", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseConnectionName, data); + StaticSiteDatabaseConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteDatabaseConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteDatabaseConnectionResource.cs new file mode 100644 index 0000000000000..8b1abbf16a429 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteDatabaseConnectionResource.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_StaticSiteDatabaseConnectionResource + { + // Get overview of database connections for the static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetOverviewOfDatabaseConnectionsForTheStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteDatabaseConnection.json + // this example is just showing the usage of "StaticSites_GetDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteDatabaseConnectionResource created on azure + // for more information of creating StaticSiteDatabaseConnectionResource, please refer to the document of StaticSiteDatabaseConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string databaseConnectionName = "default"; + ResourceIdentifier staticSiteDatabaseConnectionResourceId = StaticSiteDatabaseConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, databaseConnectionName); + StaticSiteDatabaseConnectionResource staticSiteDatabaseConnection = client.GetStaticSiteDatabaseConnectionResource(staticSiteDatabaseConnectionResourceId); + + // invoke the operation + StaticSiteDatabaseConnectionResource result = await staticSiteDatabaseConnection.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete a database connection from a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteADatabaseConnectionFromAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteStaticSiteDatabaseConnection.json + // this example is just showing the usage of "StaticSites_DeleteDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteDatabaseConnectionResource created on azure + // for more information of creating StaticSiteDatabaseConnectionResource, please refer to the document of StaticSiteDatabaseConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string databaseConnectionName = "default"; + ResourceIdentifier staticSiteDatabaseConnectionResourceId = StaticSiteDatabaseConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, databaseConnectionName); + StaticSiteDatabaseConnectionResource staticSiteDatabaseConnection = client.GetStaticSiteDatabaseConnectionResource(staticSiteDatabaseConnectionResourceId); + + // invoke the operation + await staticSiteDatabaseConnection.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Patch a database connection for a static site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PatchADatabaseConnectionForAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/PatchStaticSiteDatabaseConnection.json + // this example is just showing the usage of "StaticSites_UpdateDatabaseConnection" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteDatabaseConnectionResource created on azure + // for more information of creating StaticSiteDatabaseConnectionResource, please refer to the document of StaticSiteDatabaseConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string databaseConnectionName = "default"; + ResourceIdentifier staticSiteDatabaseConnectionResourceId = StaticSiteDatabaseConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, databaseConnectionName); + StaticSiteDatabaseConnectionResource staticSiteDatabaseConnection = client.GetStaticSiteDatabaseConnectionResource(staticSiteDatabaseConnectionResourceId); + + // invoke the operation + DatabaseConnectionPatchRequest databaseConnectionRequestEnvelope = new DatabaseConnectionPatchRequest(); + StaticSiteDatabaseConnectionResource result = await staticSiteDatabaseConnection.UpdateAsync(databaseConnectionRequestEnvelope); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get details of database connections for the static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetDatabaseConnectionWithDetails_GetDetailsOfDatabaseConnectionsForTheStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteDatabaseConnectionWithDetails.json + // this example is just showing the usage of "StaticSites_GetDatabaseConnectionWithDetails" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteDatabaseConnectionResource created on azure + // for more information of creating StaticSiteDatabaseConnectionResource, please refer to the document of StaticSiteDatabaseConnectionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string databaseConnectionName = "default"; + ResourceIdentifier staticSiteDatabaseConnectionResourceId = StaticSiteDatabaseConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, databaseConnectionName); + StaticSiteDatabaseConnectionResource staticSiteDatabaseConnection = client.GetStaticSiteDatabaseConnectionResource(staticSiteDatabaseConnectionResourceId); + + // invoke the operation + StaticSiteDatabaseConnectionResource result = await staticSiteDatabaseConnection.GetDatabaseConnectionWithDetailsAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DatabaseConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteLinkedBackendCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteLinkedBackendCollection.cs new file mode 100644 index 0000000000000..5f082dbb19518 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteLinkedBackendCollection.cs @@ -0,0 +1,204 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_StaticSiteLinkedBackendCollection + { + // Get details of the linked backends registered with a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetDetailsOfTheLinkedBackendsRegisteredWithAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetLinkedBackendsForStaticSite.json + // this example is just showing the usage of "StaticSites_GetLinkedBackends" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteLinkedBackendResource + StaticSiteLinkedBackendCollection collection = staticSite.GetStaticSiteLinkedBackends(); + + // invoke the operation and iterate over the result + await foreach (StaticSiteLinkedBackendResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get details of the linked backend registered with a static site by name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDetailsOfTheLinkedBackendRegisteredWithAStaticSiteByName() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetLinkedBackendForStaticSite.json + // this example is just showing the usage of "StaticSites_GetLinkedBackend" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteLinkedBackendResource + StaticSiteLinkedBackendCollection collection = staticSite.GetStaticSiteLinkedBackends(); + + // invoke the operation + string linkedBackendName = "testBackend"; + StaticSiteLinkedBackendResource result = await collection.GetAsync(linkedBackendName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get details of the linked backend registered with a static site by name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetDetailsOfTheLinkedBackendRegisteredWithAStaticSiteByName() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetLinkedBackendForStaticSite.json + // this example is just showing the usage of "StaticSites_GetLinkedBackend" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteLinkedBackendResource + StaticSiteLinkedBackendCollection collection = staticSite.GetStaticSiteLinkedBackends(); + + // invoke the operation + string linkedBackendName = "testBackend"; + bool result = await collection.ExistsAsync(linkedBackendName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get details of the linked backend registered with a static site by name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDetailsOfTheLinkedBackendRegisteredWithAStaticSiteByName() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetLinkedBackendForStaticSite.json + // this example is just showing the usage of "StaticSites_GetLinkedBackend" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteLinkedBackendResource + StaticSiteLinkedBackendCollection collection = staticSite.GetStaticSiteLinkedBackends(); + + // invoke the operation + string linkedBackendName = "testBackend"; + NullableResponse response = await collection.GetIfExistsAsync(linkedBackendName); + StaticSiteLinkedBackendResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Link a backend to a static site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_LinkABackendToAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/LinkBackendToStaticSite.json + // this example is just showing the usage of "StaticSites_LinkBackend" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // get the collection of this StaticSiteLinkedBackendResource + StaticSiteLinkedBackendCollection collection = staticSite.GetStaticSiteLinkedBackends(); + + // invoke the operation + string linkedBackendName = "testBackend"; + StaticSiteLinkedBackendARMResourceData data = new StaticSiteLinkedBackendARMResourceData() + { + BackendResourceId = "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/backendRg/providers/Microsoft.Web/sites/testBackend", + Region = "West US 2", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, linkedBackendName, data); + StaticSiteLinkedBackendResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteLinkedBackendResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteLinkedBackendResource.cs new file mode 100644 index 0000000000000..446aba1b18475 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteLinkedBackendResource.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_StaticSiteLinkedBackendResource + { + // Validate if backend can be linked to static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ValidateBackend_ValidateIfBackendCanBeLinkedToStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ValidateLinkedBackendForStaticSite.json + // this example is just showing the usage of "StaticSites_ValidateBackend" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteLinkedBackendResource created on azure + // for more information of creating StaticSiteLinkedBackendResource, please refer to the document of StaticSiteLinkedBackendResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string linkedBackendName = "testBackend"; + ResourceIdentifier staticSiteLinkedBackendResourceId = StaticSiteLinkedBackendResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, linkedBackendName); + StaticSiteLinkedBackendResource staticSiteLinkedBackend = client.GetStaticSiteLinkedBackendResource(staticSiteLinkedBackendResourceId); + + // invoke the operation + StaticSiteLinkedBackendARMResourceData data = new StaticSiteLinkedBackendARMResourceData() + { + BackendResourceId = "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/backendRg/providers/Microsoft.Web/sites/testBackend", + Region = "West US 2", + }; + await staticSiteLinkedBackend.ValidateBackendAsync(WaitUntil.Completed, data); + + Console.WriteLine($"Succeeded"); + } + + // Get details of the linked backend registered with a static site by name. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDetailsOfTheLinkedBackendRegisteredWithAStaticSiteByName() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetLinkedBackendForStaticSite.json + // this example is just showing the usage of "StaticSites_GetLinkedBackend" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteLinkedBackendResource created on azure + // for more information of creating StaticSiteLinkedBackendResource, please refer to the document of StaticSiteLinkedBackendResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string linkedBackendName = "testBackend"; + ResourceIdentifier staticSiteLinkedBackendResourceId = StaticSiteLinkedBackendResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, linkedBackendName); + StaticSiteLinkedBackendResource staticSiteLinkedBackend = client.GetStaticSiteLinkedBackendResource(staticSiteLinkedBackendResourceId); + + // invoke the operation + StaticSiteLinkedBackendResource result = await staticSiteLinkedBackend.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Link a backend to a static site + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_LinkABackendToAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/LinkBackendToStaticSite.json + // this example is just showing the usage of "StaticSites_LinkBackend" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteLinkedBackendResource created on azure + // for more information of creating StaticSiteLinkedBackendResource, please refer to the document of StaticSiteLinkedBackendResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string linkedBackendName = "testBackend"; + ResourceIdentifier staticSiteLinkedBackendResourceId = StaticSiteLinkedBackendResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, linkedBackendName); + StaticSiteLinkedBackendResource staticSiteLinkedBackend = client.GetStaticSiteLinkedBackendResource(staticSiteLinkedBackendResourceId); + + // invoke the operation + StaticSiteLinkedBackendARMResourceData data = new StaticSiteLinkedBackendARMResourceData() + { + BackendResourceId = "/subscription/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/backendRg/providers/Microsoft.Web/sites/testBackend", + Region = "West US 2", + }; + ArmOperation lro = await staticSiteLinkedBackend.UpdateAsync(WaitUntil.Completed, data); + StaticSiteLinkedBackendResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + StaticSiteLinkedBackendARMResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Unlink a backend from a static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_UnlinkABackendFromAStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UnlinkBackendFromStaticSite.json + // this example is just showing the usage of "StaticSites_UnlinkBackend" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteLinkedBackendResource created on azure + // for more information of creating StaticSiteLinkedBackendResource, please refer to the document of StaticSiteLinkedBackendResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + string linkedBackendName = "testBackend"; + ResourceIdentifier staticSiteLinkedBackendResourceId = StaticSiteLinkedBackendResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, linkedBackendName); + StaticSiteLinkedBackendResource staticSiteLinkedBackend = client.GetStaticSiteLinkedBackendResource(staticSiteLinkedBackendResourceId); + + // invoke the operation + await staticSiteLinkedBackend.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionCollection.cs index 58528eaa74acd..e6ec1127e6ee4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_StaticSitePrivateEndpointConnectionCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetAListOfPrivateEndpointConnectionsAssociatedWithASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnectionList.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnectionList.json // this example is just showing the usage of "StaticSites_GetPrivateEndpointConnectionList" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_GetAListOfPrivateEndpointConnectionsAssociatedWithASite [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnection.json // this example is just showing the usage of "StaticSites_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -92,7 +92,7 @@ public async Task Get_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnection.json // this example is just showing the usage of "StaticSites_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -123,7 +123,7 @@ public async Task Exists_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnection.json // this example is just showing the usage of "StaticSites_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -166,7 +166,7 @@ public async Task GetIfExists_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_ApprovesOrRejectsAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ApproveRejectSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ApproveRejectSitePrivateEndpointConnection.json // this example is just showing the usage of "StaticSites_ApproveOrRejectPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -187,7 +187,7 @@ public async Task CreateOrUpdate_ApprovesOrRejectsAPrivateEndpointConnectionForA // invoke the operation string privateEndpointConnectionName = "connection"; - PrivateLinkConnectionApprovalRequestInfo info = new PrivateLinkConnectionApprovalRequestInfo() + RemotePrivateEndpointConnectionARMResourceData data = new RemotePrivateEndpointConnectionARMResourceData() { PrivateLinkServiceConnectionState = new PrivateLinkConnectionState() { @@ -196,7 +196,7 @@ public async Task CreateOrUpdate_ApprovesOrRejectsAPrivateEndpointConnectionForA ActionsRequired = "", }, }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, info); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); StaticSitePrivateEndpointConnectionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionResource.cs index 6fbce2bfea852..0047debefe4d4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSitePrivateEndpointConnectionResource.cs @@ -20,7 +20,7 @@ public partial class Sample_StaticSitePrivateEndpointConnectionResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateEndpointConnection.json // this example is just showing the usage of "StaticSites_GetPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +52,7 @@ public async Task Get_GetAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ApproveRejectSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ApproveRejectSitePrivateEndpointConnection.json // this example is just showing the usage of "StaticSites_ApproveOrRejectPrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -70,7 +70,7 @@ public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() StaticSitePrivateEndpointConnectionResource staticSitePrivateEndpointConnection = client.GetStaticSitePrivateEndpointConnectionResource(staticSitePrivateEndpointConnectionResourceId); // invoke the operation - PrivateLinkConnectionApprovalRequestInfo info = new PrivateLinkConnectionApprovalRequestInfo() + RemotePrivateEndpointConnectionARMResourceData data = new RemotePrivateEndpointConnectionARMResourceData() { PrivateLinkServiceConnectionState = new PrivateLinkConnectionState() { @@ -79,7 +79,7 @@ public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() ActionsRequired = "", }, }; - ArmOperation lro = await staticSitePrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, info); + ArmOperation lro = await staticSitePrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); StaticSitePrivateEndpointConnectionResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well @@ -94,7 +94,7 @@ public async Task Update_ApprovesOrRejectsAPrivateEndpointConnectionForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAPrivateEndpointConnectionForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DeleteSitePrivateEndpointConnection.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteSitePrivateEndpointConnection.json // this example is just showing the usage of "StaticSites_DeletePrivateEndpointConnection" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteResource.cs index b19f6dfc5fc11..80386e14ec778 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteResource.cs @@ -21,7 +21,7 @@ public partial class Sample_StaticSiteResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetStaticSites_GetAllStaticSitesInASubscription() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetAllStaticSites.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetAllStaticSites.json // this example is just showing the usage of "StaticSites_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +53,7 @@ public async Task GetStaticSites_GetAllStaticSitesInASubscription() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDetailsForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSite.json // this example is just showing the usage of "StaticSites_GetStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -84,7 +84,7 @@ public async Task Get_GetDetailsForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DeleteStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteStaticSite.json // this example is just showing the usage of "StaticSites_DeleteStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -111,7 +111,7 @@ public async Task Delete_DeleteAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_PatchAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/PatchStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/PatchStaticSite.json // this example is just showing the usage of "StaticSites_UpdateStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -143,7 +143,7 @@ public async Task Update_PatchAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetUsers_ListUsersForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListStaticSiteUsers.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListStaticSiteUsers.json // this example is just showing the usage of "StaticSites_ListStaticSiteUsers" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -174,7 +174,7 @@ public async Task GetUsers_ListUsersForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task DeleteUser_DeleteAUserForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DeleteStaticSiteUser.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteStaticSiteUser.json // this example is just showing the usage of "StaticSites_DeleteStaticSiteUser" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -203,7 +203,7 @@ public async Task DeleteUser_DeleteAUserForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task UpdateUser_CreateOrUpdateAUserForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/UpdateStaticSiteUser.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdateStaticSiteUser.json // this example is just showing the usage of "StaticSites_UpdateStaticSiteUser" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -236,7 +236,7 @@ public async Task UpdateUser_CreateOrUpdateAUserForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateAppSettings_CreatesOrUpdatesTheAppSettingsOfAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/CreateOrUpdateStaticSiteAppSettings.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSiteAppSettings.json // this example is just showing the usage of "StaticSites_CreateOrUpdateStaticSiteAppSettings" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -271,7 +271,7 @@ public async Task CreateOrUpdateAppSettings_CreatesOrUpdatesTheAppSettingsOfASta [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdateFunctionAppSettings_CreatesOrUpdatesTheFunctionAppSettingsOfAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/CreateOrUpdateStaticSiteFunctionAppSettings.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateStaticSiteFunctionAppSettings.json // this example is just showing the usage of "StaticSites_CreateOrUpdateStaticSiteFunctionAppSettings" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -306,7 +306,7 @@ public async Task CreateOrUpdateFunctionAppSettings_CreatesOrUpdatesTheFunctionA [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateUserRolesInvitationLink_CreateAnInvitationLinkForAUserForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/CreateUserRolesInvitationLink.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateUserRolesInvitationLink.json // this example is just showing the usage of "StaticSites_CreateUserRolesInvitationLink" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -341,7 +341,7 @@ public async Task CreateUserRolesInvitationLink_CreateAnInvitationLinkForAUserFo [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Detach_DetachAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DetachStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DetachStaticSite.json // this example is just showing the usage of "StaticSites_DetachStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -368,7 +368,7 @@ public async Task Detach_DetachAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetStaticSiteFunctions_GetsTheFunctionsOfAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListStaticSiteFunctions.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListStaticSiteFunctions.json // this example is just showing the usage of "StaticSites_ListStaticSiteFunctions" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -398,7 +398,7 @@ public async Task GetStaticSiteFunctions_GetsTheFunctionsOfAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAppSettings_GetAppSettingsOfAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListStaticSiteAppSettings.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListStaticSiteAppSettings.json // this example is just showing the usage of "StaticSites_ListStaticSiteAppSettings" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -425,7 +425,7 @@ public async Task GetAppSettings_GetAppSettingsOfAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetConfiguredRoles_ListsTheConfiguredRolesForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListStaticSiteConfiguredRoles.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListStaticSiteConfiguredRoles.json // this example is just showing the usage of "StaticSites_ListStaticSiteConfiguredRoles" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -452,7 +452,7 @@ public async Task GetConfiguredRoles_ListsTheConfiguredRolesForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetFunctionAppSettings_GetFunctionAppSettingsOfAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListStaticSiteFunctionAppSettings.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListStaticSiteFunctionAppSettings.json // this example is just showing the usage of "StaticSites_ListStaticSiteFunctionAppSettings" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -479,7 +479,7 @@ public async Task GetFunctionAppSettings_GetFunctionAppSettingsOfAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetStaticSiteSecrets_ListSecretsForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListStaticSiteSecrets.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListStaticSiteSecrets.json // this example is just showing the usage of "StaticSites_ListStaticSiteSecrets" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -506,7 +506,7 @@ public async Task GetStaticSiteSecrets_ListSecretsForAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetPrivateLinkResources_GetPrivateLinkResourcesOfASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateLinkResources.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateLinkResources.json // this example is just showing the usage of "StaticSites_GetPrivateLinkResources" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -536,7 +536,7 @@ public async Task GetPrivateLinkResources_GetPrivateLinkResourcesOfASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task ResetApiKey_ResetTheApiKeyForAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ResetStaticSiteApiKey.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ResetStaticSiteApiKey.json // this example is just showing the usage of "StaticSites_ResetStaticSiteApiKey" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -563,12 +563,43 @@ public async Task ResetApiKey_ResetTheApiKeyForAStaticSite() Console.WriteLine($"Succeeded"); } + // List full details of database connections for the static site. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetDatabaseConnectionsWithDetails_ListFullDetailsOfDatabaseConnectionsForTheStaticSite() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetStaticSiteDatabaseConnectionsWithDetails.json + // this example is just showing the usage of "StaticSites_GetDatabaseConnectionsWithDetails" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this StaticSiteResource created on azure + // for more information of creating StaticSiteResource, please refer to the document of StaticSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "rg"; + string name = "testStaticSite0"; + ResourceIdentifier staticSiteResourceId = StaticSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + StaticSiteResource staticSite = client.GetStaticSiteResource(staticSiteResourceId); + + // invoke the operation and iterate over the result + await foreach (DatabaseConnectionData item in staticSite.GetDatabaseConnectionsWithDetailsAsync()) + { + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {item.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + // Deploy a site from a zipped package [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateZipDeploymentForStaticSite_DeployASiteFromAZippedPackage() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/StaticSiteZipDeploy.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/StaticSiteZipDeploy.json // this example is just showing the usage of "StaticSites_CreateZipDeploymentForStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppCollection.cs index a4bc603512756..64d49ada87dba 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_StaticSiteUserProvidedFunctionAppCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetDetailsOfTheUserProvidedFunctionAppsRegisteredWithAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppsForStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUserProvidedFunctionAppsForStaticSite.json // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppsForStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -56,7 +56,7 @@ public async Task GetAll_GetDetailsOfTheUserProvidedFunctionAppsRegisteredWithAS [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppForStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUserProvidedFunctionAppForStaticSite.json // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppForStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -91,7 +91,7 @@ public async Task Get_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStati [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppForStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUserProvidedFunctionAppForStaticSite.json // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppForStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -122,7 +122,7 @@ public async Task Exists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithASt [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppForStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUserProvidedFunctionAppForStaticSite.json // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppForStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -165,7 +165,7 @@ public async Task GetIfExists_GetDetailsOfTheUserProvidedFunctionAppRegisteredWi [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_RegisterAUserProvidedFunctionAppWithAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/RegisterUserProvidedFunctionAppWithStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/RegisterUserProvidedFunctionAppWithStaticSite.json // this example is just showing the usage of "StaticSites_RegisterUserProvidedFunctionAppWithStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppResource.cs index f8115fe5672b2..4c58bc2b006d1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_StaticSiteUserProvidedFunctionAppResource.cs @@ -19,7 +19,7 @@ public partial class Sample_StaticSiteUserProvidedFunctionAppResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetUserProvidedFunctionAppForStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUserProvidedFunctionAppForStaticSite.json // this example is just showing the usage of "StaticSites_GetUserProvidedFunctionAppForStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetDetailsOfTheUserProvidedFunctionAppRegisteredWithAStati [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_RegisterAUserProvidedFunctionAppWithAStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/RegisterUserProvidedFunctionAppWithStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/RegisterUserProvidedFunctionAppWithStaticSite.json // this example is just showing the usage of "StaticSites_RegisterUserProvidedFunctionAppWithStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -90,7 +90,7 @@ public async Task Update_RegisterAUserProvidedFunctionAppWithAStaticSite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DetachTheUserProvidedFunctionAppFromTheStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/DetachUserProvidedFunctionAppFromStaticSite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DetachUserProvidedFunctionAppFromStaticSite.json // this example is just showing the usage of "StaticSites_DetachUserProvidedFunctionAppFromStaticSite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 34d78cd14c49f..eb330985aca3b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -16,12 +16,145 @@ namespace Azure.ResourceManager.AppService.Samples { public partial class Sample_SubscriptionResourceExtensions { + // Validate App Service Certificate purchase information by subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ValidateAppServiceCertificateOrderPurchaseInformation_ValidateAppServiceCertificatePurchaseInformationBySubscription() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/ValidateAppServiceCertificatePurchaseInformationBySubscription.json + // this example is just showing the usage of "AppServiceCertificateOrders_ValidatePurchaseInformation" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + AppServiceCertificateOrderData data = new AppServiceCertificateOrderData(new AzureLocation("Global")) + { + Certificates = +{ +["SampleCertName1"] = new AppServiceCertificateProperties() +{ +KeyVaultId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/testrg123/providers/microsoft.keyvault/vaults/SamplevaultName"), +KeyVaultSecretName = "SampleSecretName1", +}, +["SampleCertName2"] = new AppServiceCertificateProperties() +{ +KeyVaultId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourcegroups/testrg123/providers/microsoft.keyvault/vaults/SamplevaultName"), +KeyVaultSecretName = "SampleSecretName2", +}, +}, + DistinguishedName = "CN=SampleCustomDomain.com", + ValidityInYears = 2, + KeySize = 2048, + ProductType = CertificateProductType.StandardDomainValidatedSsl, + IsAutoRenew = true, + }; + await subscriptionResource.ValidateAppServiceCertificateOrderPurchaseInformationAsync(data); + + Console.WriteLine($"Succeeded"); + } + + // Check domain availability + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckAppServiceDomainRegistrationAvailability_CheckDomainAvailability() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/CheckDomainAvailability.json + // this example is just showing the usage of "Domains_CheckAvailability" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + AppServiceDomainNameIdentifier identifier = new AppServiceDomainNameIdentifier() + { + Name = "abcd.com", + }; + DomainAvailabilityCheckResult result = await subscriptionResource.CheckAppServiceDomainRegistrationAvailabilityAsync(identifier); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get Domain Control Center Sso Request + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetControlCenterSsoRequestDomain_GetDomainControlCenterSsoRequest() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetDomainControlCenterSsoRequest.json + // this example is just showing the usage of "Domains_GetControlCenterSsoRequest" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + DomainControlCenterSsoRequestInfo result = await subscriptionResource.GetControlCenterSsoRequestDomainAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // List domain recommendations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAppServiceDomainRecommendations_ListDomainRecommendations() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/ListDomainRecommendations.json + // this example is just showing the usage of "Domains_ListRecommendations" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + DomainRecommendationSearchContent content = new DomainRecommendationSearchContent() + { + Keywords = "example1", + MaxDomainRecommendations = 10, + }; + await foreach (AppServiceDomainNameIdentifier item in subscriptionResource.GetAppServiceDomainRecommendationsAsync(content)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + // List ResourceHealthMetadata for a subscription [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAllResourceHealthMetadata_ListResourceHealthMetadataForASubscription() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListResourceHealthMetadataBySubscription.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListResourceHealthMetadataBySubscription.json // this example is just showing the usage of "ResourceHealthMetadata_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -45,12 +178,97 @@ public async Task GetAllResourceHealthMetadata_ListResourceHealthMetadataForASub Console.WriteLine($"Succeeded"); } + // Get custom hostnames under subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCustomHostNameSites_GetCustomHostnamesUnderSubscription() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListCustomHostNameSites.json + // this example is just showing the usage of "ListCustomHostNameSites" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (CustomHostnameSites item in subscriptionResource.GetCustomHostNameSitesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get specific custom hostname under subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCustomHostNameSites_GetSpecificCustomHostnameUnderSubscription() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListCustomSpecificHostNameSites.json + // this example is just showing the usage of "ListCustomHostNameSites" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + string hostname = "www.example.com"; + await foreach (CustomHostnameSites item in subscriptionResource.GetCustomHostNameSitesAsync(hostname: hostname)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // List aseregions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAseRegions_ListAseregions() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListAseRegions.json + // this example is just showing the usage of "ListAseRegions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (AseRegion item in subscriptionResource.GetAseRegionsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + // VerifyHostingEnvironmentVnet [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task VerifyHostingEnvironmentVnet_VerifyHostingEnvironmentVnet() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/VerifyHostingEnvironmentVnet.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/VerifyHostingEnvironmentVnet.json // this example is just showing the usage of "VerifyHostingEnvironmentVnet" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -76,12 +294,41 @@ public async Task VerifyHostingEnvironmentVnet_VerifyHostingEnvironmentVnet() Console.WriteLine($"Succeeded: {result}"); } + // Get usages in location for subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetGetUsagesInLocations_GetUsagesInLocationForSubscription() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetUsagesInLocation.json + // this example is just showing the usage of "GetUsagesInLocation_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + AzureLocation location = new AzureLocation("West US"); + await foreach (CsmUsageQuota item in subscriptionResource.GetGetUsagesInLocationsAsync(location)) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + // Generates a preview workflow file for the static site [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task PreviewStaticSiteWorkflow_GeneratesAPreviewWorkflowFileForTheStaticSite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GenerateStaticSiteWorkflowPreview.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GenerateStaticSiteWorkflowPreview.json // this example is just showing the usage of "StaticSites_PreviewWorkflow" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TenantResourceExtensions.cs index 06001376938d6..94af6b61c402f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TenantResourceExtensions.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TenantResourceExtensions.cs @@ -20,7 +20,7 @@ public partial class Sample_TenantResourceExtensions [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetOperationsCertificateRegistrationProviders_ListOperations() { - // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2021-02-01/examples/ListOperations.json + // Generated from example definition: specification/web/resource-manager/Microsoft.CertificateRegistration/stable/2024-04-01/examples/ListOperations.json // this example is just showing the usage of "CertificateRegistrationProvider_ListOperations" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -46,7 +46,7 @@ public async Task GetOperationsCertificateRegistrationProviders_ListOperations() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetOperationsDomainRegistrationProviders_ListOperations() { - // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2021-02-01/examples/ListOperations.json + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/ListOperations.json // this example is just showing the usage of "DomainRegistrationProvider_ListOperations" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -72,7 +72,7 @@ public async Task GetOperationsDomainRegistrationProviders_ListOperations() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetFunctionAppStacksProviders_GetFunctionAppStacks() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetFunctionAppStacks.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetFunctionAppStacks.json // this example is just showing the usage of "Provider_GetFunctionAppStacks" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -98,7 +98,7 @@ public async Task GetFunctionAppStacksProviders_GetFunctionAppStacks() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetFunctionAppStacksForLocationProviders_GetLocationsFunctionAppStacks() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetFunctionAppStacksForLocation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetFunctionAppStacksForLocation.json // this example is just showing the usage of "Provider_GetFunctionAppStacksForLocation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task GetFunctionAppStacksForLocationProviders_GetLocationsFunctionA [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetWebAppStacksByLocation_GetLocationsWebAppStacks() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetWebAppStacksForLocation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppStacksForLocation.json // this example is just showing the usage of "Provider_GetWebAppStacksForLocation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -152,7 +152,7 @@ public async Task GetWebAppStacksByLocation_GetLocationsWebAppStacks() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetOperationsProviders_ListOperations() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListOperations.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListOperations.json // this example is just showing the usage of "Provider_ListOperations" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -178,7 +178,7 @@ public async Task GetOperationsProviders_ListOperations() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetWebAppStacksProviders_GetWebAppStacks() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetWebAppStacks.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppStacks.json // this example is just showing the usage of "Provider_GetWebAppStacks" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainCollection.cs index fc2117cac3baf..2c403299e1b8e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_TopLevelDomainCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListTopLevelDomains() { - // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2021-02-01/examples/ListTopLevelDomains.json + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/ListTopLevelDomains.json // this example is just showing the usage of "TopLevelDomains_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -55,7 +55,7 @@ public async Task GetAll_ListTopLevelDomains() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetTopLevelDomain() { - // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2021-02-01/examples/GetTopLevelDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetTopLevelDomain.json // this example is just showing the usage of "TopLevelDomains_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -88,7 +88,7 @@ public async Task Get_GetTopLevelDomain() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetTopLevelDomain() { - // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2021-02-01/examples/GetTopLevelDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetTopLevelDomain.json // this example is just showing the usage of "TopLevelDomains_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -117,7 +117,7 @@ public async Task Exists_GetTopLevelDomain() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetTopLevelDomain() { - // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2021-02-01/examples/GetTopLevelDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetTopLevelDomain.json // this example is just showing the usage of "TopLevelDomains_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainResource.cs index 4f317ce049b80..5a2eadfd595d8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_TopLevelDomainResource.cs @@ -20,7 +20,7 @@ public partial class Sample_TopLevelDomainResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetTopLevelDomain() { - // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2021-02-01/examples/GetTopLevelDomain.json + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/GetTopLevelDomain.json // this example is just showing the usage of "TopLevelDomains_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetTopLevelDomain() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAgreements_ListTopLevelDomainAgreements() { - // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2021-02-01/examples/ListTopLevelDomainAgreements.json + // Generated from example definition: specification/web/resource-manager/Microsoft.DomainRegistration/stable/2024-04-01/examples/ListTopLevelDomainAgreements.json // this example is just showing the usage of "TopLevelDomains_ListAgreements" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteCollection.cs new file mode 100644 index 0000000000000..aad3f71bdd94c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteCollection.cs @@ -0,0 +1,417 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WebSiteCollection + { + // List Web Apps by Resource group + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListWebAppsByResourceGroup() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListWebAppsByResourceGroup.json + // this example is just showing the usage of "WebApps_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebSiteResource + WebSiteCollection collection = resourceGroupResource.GetWebSites(); + + // invoke the operation and iterate over the result + await foreach (WebSiteResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Web App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetWebApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebApp.json + // this example is just showing the usage of "WebApps_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebSiteResource + WebSiteCollection collection = resourceGroupResource.GetWebSites(); + + // invoke the operation + string name = "sitef6141"; + WebSiteResource result = await collection.GetAsync(name); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get Web App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetWebApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebApp.json + // this example is just showing the usage of "WebApps_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebSiteResource + WebSiteCollection collection = resourceGroupResource.GetWebSites(); + + // invoke the operation + string name = "sitef6141"; + bool result = await collection.ExistsAsync(name); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get Web App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWebApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebApp.json + // this example is just showing the usage of "WebApps_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebSiteResource + WebSiteCollection collection = resourceGroupResource.GetWebSites(); + + // invoke the operation + string name = "sitef6141"; + NullableResponse response = await collection.GetIfExistsAsync(name); + WebSiteResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Clone web app + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CloneWebApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CloneWebApp.json + // this example is just showing the usage of "WebApps_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebSiteResource + WebSiteCollection collection = resourceGroupResource.GetWebSites(); + + // invoke the operation + string name = "sitef6141"; + WebSiteData data = new WebSiteData(new AzureLocation("East US")) + { + CloningInfo = new CloningInfo(new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg456/providers/Microsoft.Web/sites/srcsiteg478")) + { + CanOverwrite = false, + CloneCustomHostNames = true, + CloneSourceControl = true, + SourceWebAppLocation = new AzureLocation("West Europe"), + HostingEnvironment = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg456/providers/Microsoft.Web/hostingenvironments/aseforsites", + AppSettingsOverrides = +{ +["Setting1"] = "NewValue1", +["Setting3"] = "NewValue5", +}, + ConfigureLoadBalancing = false, + }, + Kind = "app", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + WebSiteResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or Update Flex Consumption function app + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateFlexConsumptionFunctionApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateFunctionAppFlexConsumption.json + // this example is just showing the usage of "WebApps_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebSiteResource + WebSiteCollection collection = resourceGroupResource.GetWebSites(); + + // invoke the operation + string name = "sitef6141"; + WebSiteData data = new WebSiteData(new AzureLocation("East US")) + { + SiteConfig = new SiteConfigProperties() + { + AppSettings = +{ +new AppServiceNameValuePair() +{ +Name = "AzureWebJobsStorage", +Value = "DefaultEndpointsProtocol=https;AccountName=StorageAccountName;AccountKey=Sanitized;EndpointSuffix=core.windows.net", +},new AppServiceNameValuePair() +{ +Name = "APPLICATIONINSIGHTS_CONNECTION_STRING", +Value = "InstrumentationKey=Sanitized;IngestionEndpoint=Sanitized;LiveEndpoint=Sanitized", +} +}, + }, + FunctionAppConfig = new FunctionAppConfig() + { + DeploymentStorage = new FunctionsDeploymentStorage() + { + StorageType = FunctionsDeploymentStorageType.BlobContainer, + Value = new Uri("https://storageAccountName.blob.core.windows.net/containername"), + Authentication = new FunctionsDeploymentStorageAuthentication() + { + AuthenticationType = AuthenticationType.StorageAccountConnectionString, + StorageAccountConnectionStringName = "TheAppSettingName", + }, + }, + Runtime = new FunctionsRuntime() + { + Name = RuntimeName.Python, + Version = "3.11", + }, + ScaleAndConcurrency = new FunctionsScaleAndConcurrency() + { + MaximumInstanceCount = 100, + InstanceMemoryMB = 2048, + }, + }, + Kind = "functionapp,linux", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + WebSiteResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or Update Flex Consumption function app with details + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateFlexConsumptionFunctionAppWithDetails() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateFunctionAppFlexConsumptionWithDetails.json + // this example is just showing the usage of "WebApps_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebSiteResource + WebSiteCollection collection = resourceGroupResource.GetWebSites(); + + // invoke the operation + string name = "sitef6141"; + WebSiteData data = new WebSiteData(new AzureLocation("East US")) + { + SiteConfig = new SiteConfigProperties() + { + AppSettings = +{ +new AppServiceNameValuePair() +{ +Name = "AzureWebJobsStorage", +Value = "DefaultEndpointsProtocol=https;AccountName=StorageAccountName;AccountKey=Sanitized;EndpointSuffix=core.windows.net", +},new AppServiceNameValuePair() +{ +Name = "APPLICATIONINSIGHTS_CONNECTION_STRING", +Value = "InstrumentationKey=Sanitized;IngestionEndpoint=Sanitized;LiveEndpoint=Sanitized", +} +}, + }, + FunctionAppConfig = new FunctionAppConfig() + { + DeploymentStorage = new FunctionsDeploymentStorage() + { + StorageType = FunctionsDeploymentStorageType.BlobContainer, + Value = new Uri("https://storageAccountName.blob.core.windows.net/containername"), + Authentication = new FunctionsDeploymentStorageAuthentication() + { + AuthenticationType = AuthenticationType.StorageAccountConnectionString, + StorageAccountConnectionStringName = "TheAppSettingName", + }, + }, + Runtime = new FunctionsRuntime() + { + Name = RuntimeName.Python, + Version = "3.11", + }, + ScaleAndConcurrency = new FunctionsScaleAndConcurrency() + { + AlwaysReady = +{ +new FunctionsAlwaysReadyConfig() +{ +Name = "http", +InstanceCount = 2, +} +}, + MaximumInstanceCount = 100, + InstanceMemoryMB = 2048, + HttpPerInstanceConcurrency = 16, + }, + }, + Kind = "functionapp,linux", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + WebSiteResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or Update web app + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateWebApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateWebApp.json + // this example is just showing the usage of "WebApps_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this WebSiteResource + WebSiteCollection collection = resourceGroupResource.GetWebSites(); + + // invoke the operation + string name = "sitef6141"; + WebSiteData data = new WebSiteData(new AzureLocation("East US")) + { + AppServicePlanId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/serverfarms/DefaultAsp"), + Kind = "app", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + WebSiteResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteConfigResource.cs new file mode 100644 index 0000000000000..8a8ea71ed9f10 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteConfigResource.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WebSiteConfigResource + { + // Get Site Config + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetSiteConfig() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSiteConfig.json + // this example is just showing the usage of "WebApps_GetConfiguration" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteConfigResource created on azure + // for more information of creating WebSiteConfigResource, please refer to the document of WebSiteConfigResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteConfigResourceId = WebSiteConfigResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteConfigResource webSiteConfig = client.GetWebSiteConfigResource(webSiteConfigResourceId); + + // invoke the operation + WebSiteConfigResource result = await webSiteConfig.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteConfigData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Update Site Config + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_UpdateSiteConfig() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdateSiteConfig.json + // this example is just showing the usage of "WebApps_CreateOrUpdateConfiguration" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteConfigResource created on azure + // for more information of creating WebSiteConfigResource, please refer to the document of WebSiteConfigResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteConfigResourceId = WebSiteConfigResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteConfigResource webSiteConfig = client.GetWebSiteConfigResource(webSiteConfigResourceId); + + // invoke the operation + SiteConfigData data = new SiteConfigData() + { + NumberOfWorkers = 1, + DefaultDocuments = +{ +"Default.htm","Default.html","Default.asp","index.htm","index.html","iisstart.htm","default.aspx","index.php","hostingstart.html" +}, + NetFrameworkVersion = "v4.0", + PhpVersion = "5.6", + PythonVersion = "", + NodeVersion = "", + PowerShellVersion = "", + LinuxFxVersion = "", + IsRequestTracingEnabled = false, + IsRemoteDebuggingEnabled = false, + IsHttpLoggingEnabled = false, + UseManagedIdentityCreds = false, + LogsDirectorySizeLimit = 35, + IsDetailedErrorLoggingEnabled = false, + Use32BitWorkerProcess = true, + IsWebSocketsEnabled = false, + IsAlwaysOn = false, + AppCommandLine = "", + ManagedPipelineMode = ManagedPipelineMode.Integrated, + VirtualApplications = +{ +new VirtualApplication() +{ +VirtualPath = "/", +PhysicalPath = "site\\wwwroot", +IsPreloadEnabled = false, +} +}, + LoadBalancing = SiteLoadBalancing.LeastRequests, + IsAutoHealEnabled = false, + VnetName = "", + IsVnetRouteAllEnabled = false, + VnetPrivatePortsCount = 0, + IsHttp20Enabled = false, + MinTlsVersion = AppServiceSupportedTlsVersion.Tls1_2, + ScmMinTlsVersion = AppServiceSupportedTlsVersion.Tls1_2, + FtpsState = AppServiceFtpsState.AllAllowed, + FunctionAppScaleLimit = 0, + IsFunctionsRuntimeScaleMonitoringEnabled = false, + MinimumElasticInstanceCount = 0, + AzureStorageAccounts = +{ +}, + }; + ArmOperation lro = await webSiteConfig.CreateOrUpdateAsync(WaitUntil.Completed, data); + WebSiteConfigResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SiteConfigData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteFtpPublishingCredentialsPolicyResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteFtpPublishingCredentialsPolicyResource.cs index 9fd1d87a63fc1..0e589d098a2d4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteFtpPublishingCredentialsPolicyResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteFtpPublishingCredentialsPolicyResource.cs @@ -19,7 +19,7 @@ public partial class Sample_WebSiteFtpPublishingCredentialsPolicyResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetFTPAllowed() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetPublishingCredentialsPolicy.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetPublishingCredentialsPolicy.json // this example is just showing the usage of "WebApps_GetFtpAllowed" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -50,7 +50,7 @@ public async Task Get_GetFTPAllowed() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_UpdateFTPAllowed() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/UpdatePublishingCredentialsPolicy.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdatePublishingCredentialsPolicy.json // this example is just showing the usage of "WebApps_UpdateFtpAllowed" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteResource.cs index b77cb3b47ffb1..49213521dc2be 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteResource.cs @@ -11,17 +11,452 @@ using Azure.Core; using Azure.Identity; using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Resources; namespace Azure.ResourceManager.AppService.Samples { public partial class Sample_WebSiteResource { + // List Web apps for subscription + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWebSites_ListWebAppsForSubscription() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListWebApps.json + // this example is just showing the usage of "WebApps_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (WebSiteResource item in subscriptionResource.GetWebSitesAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Web App + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetWebApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebApp.json + // this example is just showing the usage of "WebApps_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + WebSiteResource result = await webSite.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete Web app + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteWebApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteWebApp.json + // this example is just showing the usage of "WebApps_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + await webSite.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Update web app + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateWebApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdateWebApp.json + // this example is just showing the usage of "WebApps_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + SitePatchInfo info = new SitePatchInfo() + { + ServerFarmId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/serverfarms/DefaultAsp"), + }; + WebSiteResource result = await webSite.UpdateAsync(info); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Analyze custom hostname for webapp. + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task AnalyzeCustomHostname_AnalyzeCustomHostnameForWebapp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AnalyzeCustomHostName.json + // this example is just showing the usage of "WebApps_AnalyzeCustomHostname" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + CustomHostnameAnalysisResult result = await webSite.AnalyzeCustomHostnameAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Apply web app slot config + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ApplySlotConfigToProduction_ApplyWebAppSlotConfig() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ApplySlotConfig.json + // this example is just showing the usage of "WebApps_ApplySlotConfigToProduction" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + CsmSlotEntity slotSwapEntity = new CsmSlotEntity("staging", true); + await webSite.ApplySlotConfigToProductionAsync(slotSwapEntity); + + Console.WriteLine($"Succeeded"); + } + + // Backup web app + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Backup_BackupWebApp() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/BackupWebApp.json + // this example is just showing the usage of "WebApps_Backup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + WebAppBackupInfo info = new WebAppBackupInfo() + { + BackupName = "abcdwe", + IsEnabled = true, + StorageAccountUri = new Uri("DefaultEndpointsProtocol=https;AccountName=storagesample;AccountKey="), + BackupSchedule = new WebAppBackupSchedule(7, BackupFrequencyUnit.Day, true, 30) + { + StartOn = DateTimeOffset.Parse("2022-09-02T17:33:11.641Z"), + }, + Databases = +{ +new AppServiceDatabaseBackupSetting(AppServiceDatabaseType.SqlAzure) +{ +Name = "backenddb", +ConnectionStringName = "backend", +ConnectionString = "DSN=data-source-name[;SERVER=value] [;PWD=value] [;UID=value] [;=]", +},new AppServiceDatabaseBackupSetting(AppServiceDatabaseType.SqlAzure) +{ +Name = "statsdb", +ConnectionStringName = "stats", +ConnectionString = "DSN=data-source-name[;SERVER=value] [;PWD=value] [;UID=value] [;=]", +} +}, + }; + WebAppBackupData result = await webSite.BackupAsync(info); + + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {result.Id}"); + } + + // List web app configurations + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAllConfigurationData_ListWebAppConfigurations() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListWebAppConfigurations.json + // this example is just showing the usage of "WebApps_ListConfigurations" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation and iterate over the result + await foreach (SiteConfigData item in webSite.GetAllConfigurationDataAsync()) + { + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {item.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Update App Settings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateApplicationSettings_UpdateAppSettings() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdateAppSettings.json + // this example is just showing the usage of "WebApps_UpdateApplicationSettings" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + AppServiceConfigurationDictionary appSettings = new AppServiceConfigurationDictionary() + { + Properties = +{ +["Setting1"] = "Value1", +["Setting2"] = "Value2", +}, + }; + AppServiceConfigurationDictionary result = await webSite.UpdateApplicationSettingsAsync(appSettings); + + Console.WriteLine($"Succeeded: {result}"); + } + + // List App Settings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetApplicationSettings_ListAppSettings() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListAppSettings.json + // this example is just showing the usage of "WebApps_ListApplicationSettings" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + AppServiceConfigurationDictionary result = await webSite.GetApplicationSettingsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Update Auth Settings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateAuthSettings_UpdateAuthSettings() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdateAuthSettings.json + // this example is just showing the usage of "WebApps_UpdateAuthSettings" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + SiteAuthSettings siteAuthSettings = new SiteAuthSettings() + { + IsEnabled = true, + RuntimeVersion = "~1", + UnauthenticatedClientAction = UnauthenticatedClientAction.RedirectToLoginPage, + IsTokenStoreEnabled = true, + AllowedExternalRedirectUrls = +{ +"sitef6141.customdomain.net","sitef6141.customdomain.info" +}, + DefaultProvider = BuiltInAuthenticationProvider.Google, + TokenRefreshExtensionHours = 120, + ClientId = "42d795a9-8abb-4d06-8534-39528af40f8e.apps.googleusercontent.com", + }; + SiteAuthSettings result = await webSite.UpdateAuthSettingsAsync(siteAuthSettings); + + Console.WriteLine($"Succeeded: {result}"); + } + + // List Auth Settings + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAuthSettings_ListAuthSettings() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListAuthSettings.json + // this example is just showing the usage of "WebApps_GetAuthSettings" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + SiteAuthSettings result = await webSite.GetAuthSettingsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Update Azure Storage Accounts + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task UpdateAzureStorageAccounts_UpdateAzureStorageAccounts() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdateAzureStorageAccounts.json + // this example is just showing the usage of "WebApps_UpdateAzureStorageAccounts" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + AzureStoragePropertyDictionary azureStorageAccounts = new AzureStoragePropertyDictionary() + { + Properties = +{ +["account1"] = new AppServiceStorageAccessInfo() +{ +StorageType = AppServiceStorageType.AzureFiles, +AccountName = "testsa", +ShareName = "web", +AccessKey = "26515^%@#*", +MountPath = "/mounts/a/files", +}, +}, + }; + AzureStoragePropertyDictionary result = await webSite.UpdateAzureStorageAccountsAsync(azureStorageAccounts); + + Console.WriteLine($"Succeeded: {result}"); + } + // List backups [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAllSiteBackupData_ListBackups() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListSlotBackups.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListSlotBackups.json // this example is just showing the usage of "WebApps_ListSiteBackups" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +487,7 @@ public async Task GetAllSiteBackupData_ListBackups() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNetworkTraceOperation_GetTheCurrentStatusOfANetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetWebSiteNetworkTraceOperation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebSiteNetworkTraceOperation.json // this example is just showing the usage of "WebApps_GetNetworkTraceOperation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -83,7 +518,7 @@ public async Task GetNetworkTraceOperation_GetTheCurrentStatusOfANetworkTraceOpe [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task StartWebSiteNetworkTraceOperation_StartANewNetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/StartWebSiteNetworkTraceOperation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/StartWebSiteNetworkTraceOperation.json // this example is just showing the usage of "WebApps_StartWebSiteNetworkTraceOperation" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -112,7 +547,7 @@ public async Task StartWebSiteNetworkTraceOperation_StartANewNetworkTraceOperati [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task StopWebSiteNetworkTrace_StopACurrentlyRunningNetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/StopWebSiteNetworkTrace.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/StopWebSiteNetworkTrace.json // this example is just showing the usage of "WebApps_StopWebSiteNetworkTrace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -139,7 +574,7 @@ public async Task StopWebSiteNetworkTrace_StopACurrentlyRunningNetworkTraceOpera [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNetworkTraces_GetNetworkTracesForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetWebSiteNetworkTraces.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebSiteNetworkTraces.json // this example is just showing the usage of "WebApps_GetNetworkTraces" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -170,7 +605,7 @@ public async Task GetNetworkTraces_GetNetworkTracesForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNetworkTraceOperationV2_GetTheCurrentStatusOfANetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetWebSiteNetworkTraceOperation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebSiteNetworkTraceOperation.json // this example is just showing the usage of "WebApps_GetNetworkTraceOperationV2" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -201,7 +636,7 @@ public async Task GetNetworkTraceOperationV2_GetTheCurrentStatusOfANetworkTraceO [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNetworkTracesV2_GetNetworkTracesForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetWebSiteNetworkTraces.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebSiteNetworkTraces.json // this example is just showing the usage of "WebApps_GetNetworkTracesV2" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -232,7 +667,7 @@ public async Task GetNetworkTracesV2_GetNetworkTracesForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetPrivateLinkResources_GetPrivateLinkResourcesOfASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateLinkResources.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateLinkResources.json // this example is just showing the usage of "WebApps_GetPrivateLinkResources" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -262,7 +697,7 @@ public async Task GetPrivateLinkResources_GetPrivateLinkResourcesOfASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task StartNetworkTrace_StartANewNetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/StartWebSiteNetworkTraceOperation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/StartWebSiteNetworkTraceOperation.json // this example is just showing the usage of "WebApps_StartNetworkTrace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -291,7 +726,7 @@ public async Task StartNetworkTrace_StartANewNetworkTraceOperationForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task StopNetworkTrace_StopACurrentlyRunningNetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/StopWebSiteNetworkTrace.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/StopWebSiteNetworkTrace.json // this example is just showing the usage of "WebApps_StopNetworkTrace" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -312,5 +747,230 @@ public async Task StopNetworkTrace_StopACurrentlyRunningNetworkTraceOperationFor Console.WriteLine($"Succeeded"); } + + // Delete workflow artifacts + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task DeployWorkflowArtifacts_DeleteWorkflowArtifacts() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteDeployWorkflowArtifacts.json + // this example is just showing the usage of "WebApps_DeployWorkflowArtifacts" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + WorkflowArtifacts workflowArtifacts = new WorkflowArtifacts() + { + FilesToDelete = +{ +"test/workflow.json","test/" +}, + }; + await webSite.DeployWorkflowArtifactsAsync(workflowArtifacts: workflowArtifacts); + + Console.WriteLine($"Succeeded"); + } + + // Deploys workflow artifacts + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task DeployWorkflowArtifacts_DeploysWorkflowArtifacts() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/PostDeployWorkflowArtifacts.json + // this example is just showing the usage of "WebApps_DeployWorkflowArtifacts" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + WorkflowArtifacts workflowArtifacts = new WorkflowArtifacts() + { + AppSettings = BinaryData.FromObjectAsJson(new Dictionary() + { + ["eventHub_connectionString"] = "Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=EXAMPLE1a2b3c4d5e6fEXAMPLE=" + }), + Files = +{ +["connections.json"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["managedApiConnections"] = new Dictionary() +{ +}, +["serviceProviderConnections"] = new Dictionary() +{ +["eventHub"] = new Dictionary() +{ +["displayName"] = "example1", +["parameterValues"] = new Dictionary() +{ +["connectionString"] = "@appsetting('eventHub_connectionString')"}, +["serviceProvider"] = new Dictionary() +{ +["id"] = "/serviceProviders/eventHub"}}}}), +["test1/workflow.json"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["definition"] = new Dictionary() +{ +["$schema"] = "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", +["actions"] = new Dictionary() +{ +}, +["contentVersion"] = "1.0.0.0", +["outputs"] = new Dictionary() +{ +}, +["triggers"] = new Dictionary() +{ +["When_events_are_available_in_Event_hub"] = new Dictionary() +{ +["type"] = "ServiceProvider", +["inputs"] = new Dictionary() +{ +["parameters"] = new Dictionary() +{ +["eventHubName"] = "test123"}, +["serviceProviderConfiguration"] = new Dictionary() +{ +["operationId"] = "receiveEvents", +["connectionName"] = "eventHub", +["serviceProviderId"] = "/serviceProviders/eventHub"}}, +["splitOn"] = "@triggerOutputs()?['body']"}}}, +["kind"] = "Stateful"}), +}, + }; + await webSite.DeployWorkflowArtifactsAsync(workflowArtifacts: workflowArtifacts); + + Console.WriteLine($"Succeeded"); + } + + // List the Instance Workflows Configuration Connections + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWorkflowsConnections_ListTheInstanceWorkflowsConfigurationConnections() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListWorkflowsConfigurationConnections.json + // this example is just showing the usage of "WebApps_ListWorkflowsConnections" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + WorkflowEnvelopeData result = await webSite.GetWorkflowsConnectionsAsync(); + + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {result.Id}"); + } + + // Regenerate the callback URL access key for request triggers + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RegenerateAccessKeyWorkflow_RegenerateTheCallbackURLAccessKeyForRequestTriggers() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Workflows_RegenerateAccessKey.json + // this example is just showing the usage of "Workflows_RegenerateAccessKey" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + string workflowName = "testWorkflowName"; + RegenerateActionParameter keyType = new RegenerateActionParameter() + { + KeyType = KeyType.Primary, + }; + await webSite.RegenerateAccessKeyWorkflowAsync(workflowName, keyType); + + Console.WriteLine($"Succeeded"); + } + + // Validate a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task ValidateWorkflow_ValidateAWorkflow() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/Workflows_Validate.json + // this example is just showing the usage of "Workflows_Validate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // invoke the operation + string workflowName = "test-workflow"; + Workflow validate = new Workflow(new AzureLocation("placeholder")) + { + Definition = BinaryData.FromObjectAsJson(new Dictionary() + { + ["$schema"] = "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", + ["actions"] = new Dictionary() + { + }, + ["contentVersion"] = "1.0.0.0", + ["outputs"] = new Dictionary() + { + }, + ["parameters"] = new Dictionary() + { + }, + ["triggers"] = new Dictionary() + { + } + }), + Kind = AppServiceKind.Stateful, + }; + await webSite.ValidateWorkflowAsync(workflowName, validate); + + Console.WriteLine($"Succeeded"); + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteResourceHealthMetadataResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteResourceHealthMetadataResource.cs index 1eaef0c4cd4f8..3c8fb9e9d49a8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteResourceHealthMetadataResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteResourceHealthMetadataResource.cs @@ -19,7 +19,7 @@ public partial class Sample_WebSiteResourceHealthMetadataResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetResourceHealthMetadata() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetResourceHealthMetadataBySite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetResourceHealthMetadataBySite.json // this example is just showing the usage of "ResourceHealthMetadata_GetBySite" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotCollection.cs new file mode 100644 index 0000000000000..2cea4a4044b02 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotCollection.cs @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WebSiteSlotCollection + { + // List Web App Slots + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListWebAppSlots() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListWebAppSlots.json + // this example is just showing the usage of "WebApps_ListSlots" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WebSiteSlotResource + WebSiteSlotCollection collection = webSite.GetWebSiteSlots(); + + // invoke the operation and iterate over the result + await foreach (WebSiteSlotResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get Web App Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetWebAppSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppSlot.json + // this example is just showing the usage of "WebApps_GetSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WebSiteSlotResource + WebSiteSlotCollection collection = webSite.GetWebSiteSlots(); + + // invoke the operation + string slot = "staging"; + WebSiteSlotResource result = await collection.GetAsync(slot); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get Web App Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetWebAppSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppSlot.json + // this example is just showing the usage of "WebApps_GetSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WebSiteSlotResource + WebSiteSlotCollection collection = webSite.GetWebSiteSlots(); + + // invoke the operation + string slot = "staging"; + bool result = await collection.ExistsAsync(slot); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get Web App Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetWebAppSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppSlot.json + // this example is just showing the usage of "WebApps_GetSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WebSiteSlotResource + WebSiteSlotCollection collection = webSite.GetWebSiteSlots(); + + // invoke the operation + string slot = "staging"; + NullableResponse response = await collection.GetIfExistsAsync(slot); + WebSiteSlotResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // Clone web app slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CloneWebAppSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CloneWebAppSlot.json + // this example is just showing the usage of "WebApps_CreateOrUpdateSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WebSiteSlotResource + WebSiteSlotCollection collection = webSite.GetWebSiteSlots(); + + // invoke the operation + string slot = "staging"; + WebSiteData data = new WebSiteData(new AzureLocation("East US")) + { + CloningInfo = new CloningInfo(new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg456/providers/Microsoft.Web/sites/srcsiteg478/slot/qa")) + { + CanOverwrite = false, + CloneCustomHostNames = true, + CloneSourceControl = true, + SourceWebAppLocation = new AzureLocation("West Europe"), + HostingEnvironment = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg456/providers/Microsoft.Web/hostingenvironments/aseforsites", + AppSettingsOverrides = +{ +["Setting1"] = "NewValue1", +["Setting3"] = "NewValue5", +}, + ConfigureLoadBalancing = false, + }, + Kind = "app", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, slot, data); + WebSiteSlotResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Create or Update Web App Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateWebAppSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/CreateOrUpdateWebAppSlot.json + // this example is just showing the usage of "WebApps_CreateOrUpdateSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WebSiteSlotResource + WebSiteSlotCollection collection = webSite.GetWebSiteSlots(); + + // invoke the operation + string slot = "staging"; + WebSiteData data = new WebSiteData(new AzureLocation("East US")) + { + AppServicePlanId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/serverfarms/DefaultAsp"), + Kind = "app", + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, slot, data); + WebSiteSlotResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingCollection.cs index 21cb49889d92c..ab3c28f7a6b0c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingCollection.cs @@ -19,7 +19,7 @@ public partial class Sample_WebSiteSlotConfigAppSettingCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_GetAzureKeyVaultReferencesForAppSettingsForSlot() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSettingsSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetKeyVaultReferencesForAppSettingsSlot.json // this example is just showing the usage of "WebApps_GetAppSettingsKeyVaultReferencesSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -57,7 +57,7 @@ public async Task GetAll_GetAzureKeyVaultReferencesForAppSettingsForSlot() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAzureKeyVaultSlotAppSettingReference() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSettingSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetKeyVaultReferencesForAppSettingSlot.json // this example is just showing the usage of "WebApps_GetAppSettingKeyVaultReferenceSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -93,7 +93,7 @@ public async Task Get_GetAzureKeyVaultSlotAppSettingReference() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAzureKeyVaultSlotAppSettingReference() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSettingSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetKeyVaultReferencesForAppSettingSlot.json // this example is just showing the usage of "WebApps_GetAppSettingKeyVaultReferenceSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +125,7 @@ public async Task Exists_GetAzureKeyVaultSlotAppSettingReference() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAzureKeyVaultSlotAppSettingReference() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSettingSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetKeyVaultReferencesForAppSettingSlot.json // this example is just showing the usage of "WebApps_GetAppSettingKeyVaultReferenceSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingResource.cs index 4e8b4fb08795a..3023856487fb3 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotConfigAppSettingResource.cs @@ -19,7 +19,7 @@ public partial class Sample_WebSiteSlotConfigAppSettingResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAzureKeyVaultSlotAppSettingReference() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetKeyVaultReferencesForAppSettingSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetKeyVaultReferencesForAppSettingSlot.json // this example is just showing the usage of "WebApps_GetAppSettingKeyVaultReferenceSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotFtpPublishingCredentialsPolicyResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotFtpPublishingCredentialsPolicyResource.cs index 4cd228adb61dc..d92803e4cd739 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotFtpPublishingCredentialsPolicyResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotFtpPublishingCredentialsPolicyResource.cs @@ -19,7 +19,7 @@ public partial class Sample_WebSiteSlotFtpPublishingCredentialsPolicyResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetFTPAllowed() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetPublishingCredentialsPolicySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetPublishingCredentialsPolicySlot.json // this example is just showing the usage of "WebApps_GetFtpAllowedSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -51,7 +51,7 @@ public async Task Get_GetFTPAllowed() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_UpdateFTPAllowed() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/UpdatePublishingCredentialsPolicySlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdatePublishingCredentialsPolicySlot.json // this example is just showing the usage of "WebApps_UpdateFtpAllowedSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotResource.cs index 08590fc21e670..360511c6f3055 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotResource.cs @@ -16,12 +16,136 @@ namespace Azure.ResourceManager.AppService.Samples { public partial class Sample_WebSiteSlotResource { + // Get Web App Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetWebAppSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebAppSlot.json + // this example is just showing the usage of "WebApps_GetSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // invoke the operation + WebSiteSlotResource result = await webSiteSlot.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete Web App Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteWebAppSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/DeleteWebAppSlot.json + // this example is just showing the usage of "WebApps_DeleteSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // invoke the operation + await webSiteSlot.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Update Web App Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_UpdateWebAppSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/UpdateWebAppSlot.json + // this example is just showing the usage of "WebApps_UpdateSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // invoke the operation + SitePatchInfo info = new SitePatchInfo() + { + ServerFarmId = new ResourceIdentifier("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/testrg123/providers/Microsoft.Web/serverfarms/DefaultAsp"), + }; + WebSiteSlotResource result = await webSiteSlot.UpdateAsync(info); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WebSiteData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Analyze custom hostname for slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task AnalyzeCustomHostnameSlot_AnalyzeCustomHostnameForSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/AnalyzeCustomHostNameSlot.json + // this example is just showing the usage of "WebApps_AnalyzeCustomHostnameSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "sitef6141"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // invoke the operation + CustomHostnameAnalysisResult result = await webSiteSlot.AnalyzeCustomHostnameSlotAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + // List backups [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAllSiteBackupSlotData_ListBackups() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/ListSlotBackups.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListSlotBackups.json // this example is just showing the usage of "WebApps_ListSiteBackupsSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +177,7 @@ public async Task GetAllSiteBackupSlotData_ListBackups() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNetworkTraceOperationSlot_GetTheCurrentStatusOfANetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetWebSiteNetworkTraceOperation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebSiteNetworkTraceOperation.json // this example is just showing the usage of "WebApps_GetNetworkTraceOperationSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -85,7 +209,7 @@ public async Task GetNetworkTraceOperationSlot_GetTheCurrentStatusOfANetworkTrac [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task StartWebSiteNetworkTraceOperationSlot_StartANewNetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/StartWebSiteNetworkTraceOperation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/StartWebSiteNetworkTraceOperation.json // this example is just showing the usage of "WebApps_StartWebSiteNetworkTraceOperationSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -115,7 +239,7 @@ public async Task StartWebSiteNetworkTraceOperationSlot_StartANewNetworkTraceOpe [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task StopWebSiteNetworkTraceSlot_StopACurrentlyRunningNetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/StopWebSiteNetworkTrace.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/StopWebSiteNetworkTrace.json // this example is just showing the usage of "WebApps_StopWebSiteNetworkTraceSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -143,7 +267,7 @@ public async Task StopWebSiteNetworkTraceSlot_StopACurrentlyRunningNetworkTraceO [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNetworkTracesSlot_GetNetworkTracesForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetWebSiteNetworkTraces.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebSiteNetworkTraces.json // this example is just showing the usage of "WebApps_GetNetworkTracesSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -175,7 +299,7 @@ public async Task GetNetworkTracesSlot_GetNetworkTracesForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNetworkTraceOperationSlotV2_GetTheCurrentStatusOfANetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetWebSiteNetworkTraceOperation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebSiteNetworkTraceOperation.json // this example is just showing the usage of "WebApps_GetNetworkTraceOperationSlotV2" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -207,7 +331,7 @@ public async Task GetNetworkTraceOperationSlotV2_GetTheCurrentStatusOfANetworkTr [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetNetworkTracesSlotV2_GetNetworkTracesForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetWebSiteNetworkTraces.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetWebSiteNetworkTraces.json // this example is just showing the usage of "WebApps_GetNetworkTracesSlotV2" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -239,7 +363,7 @@ public async Task GetNetworkTracesSlotV2_GetNetworkTracesForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetPrivateLinkResourcesSlot_GetPrivateLinkResourcesOfASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetSitePrivateLinkResourcesSlot.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetSitePrivateLinkResourcesSlot.json // this example is just showing the usage of "WebApps_GetPrivateLinkResourcesSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -270,7 +394,7 @@ public async Task GetPrivateLinkResourcesSlot_GetPrivateLinkResourcesOfASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task StartNetworkTraceSlot_StartANewNetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/StartWebSiteNetworkTraceOperation.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/StartWebSiteNetworkTraceOperation.json // this example is just showing the usage of "WebApps_StartNetworkTraceSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -300,7 +424,7 @@ public async Task StartNetworkTraceSlot_StartANewNetworkTraceOperationForASite() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task StopNetworkTraceSlot_StopACurrentlyRunningNetworkTraceOperationForASite() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/StopWebSiteNetworkTrace.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/StopWebSiteNetworkTrace.json // this example is just showing the usage of "WebApps_StopNetworkTraceSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -322,5 +446,117 @@ public async Task StopNetworkTraceSlot_StopACurrentlyRunningNetworkTraceOperatio Console.WriteLine($"Succeeded"); } + + // Deploys workflow artifacts slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task DeployWorkflowArtifactsSlot_DeploysWorkflowArtifactsSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/PostDeployWorkflowArtifactsSlot.json + // this example is just showing the usage of "WebApps_DeployWorkflowArtifactsSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + string slot = "testsSlot"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // invoke the operation + WorkflowArtifacts workflowArtifacts = new WorkflowArtifacts() + { + AppSettings = BinaryData.FromObjectAsJson(new Dictionary() + { + ["eventHub_connectionString"] = "Endpoint=sb://example.servicebus.windows.net/;SharedAccessKeyName=RootManageSharedAccessKey;SharedAccessKey=EXAMPLE1a2b3c4d5e6fEXAMPLE=" + }), + Files = +{ +["connections.json"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["managedApiConnections"] = new Dictionary() +{ +}, +["serviceProviderConnections"] = new Dictionary() +{ +["eventHub"] = new Dictionary() +{ +["displayName"] = "example1", +["parameterValues"] = new Dictionary() +{ +["connectionString"] = "@appsetting('eventHub_connectionString')"}, +["serviceProvider"] = new Dictionary() +{ +["id"] = "/serviceProviders/eventHub"}}}}), +["test1/workflow.json"] = BinaryData.FromObjectAsJson(new Dictionary() +{ +["definition"] = new Dictionary() +{ +["$schema"] = "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#", +["actions"] = new Dictionary() +{ +}, +["contentVersion"] = "1.0.0.0", +["outputs"] = new Dictionary() +{ +}, +["triggers"] = new Dictionary() +{ +["When_events_are_available_in_Event_hub"] = new Dictionary() +{ +["type"] = "ServiceProvider", +["inputs"] = new Dictionary() +{ +["parameters"] = new Dictionary() +{ +["eventHubName"] = "test123"}, +["serviceProviderConfiguration"] = new Dictionary() +{ +["operationId"] = "receiveEvents", +["connectionName"] = "eventHub", +["serviceProviderId"] = "/serviceProviders/eventHub"}}, +["splitOn"] = "@triggerOutputs()?['body']"}}}, +["kind"] = "Stateful"}), +}, + }; + await webSiteSlot.DeployWorkflowArtifactsSlotAsync(workflowArtifacts: workflowArtifacts); + + Console.WriteLine($"Succeeded"); + } + + // List the Instance Workflows Configuration Connections Slot + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetWorkflowsConnectionsSlot_ListTheInstanceWorkflowsConfigurationConnectionsSlot() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/ListWorkflowsConfigurationConnections.json + // this example is just showing the usage of "WebApps_ListWorkflowsConnectionsSlot" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteSlotResource created on azure + // for more information of creating WebSiteSlotResource, please refer to the document of WebSiteSlotResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testrg123"; + string name = "testsite2"; + string slot = "staging"; + ResourceIdentifier webSiteSlotResourceId = WebSiteSlotResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, slot); + WebSiteSlotResource webSiteSlot = client.GetWebSiteSlotResource(webSiteSlotResourceId); + + // invoke the operation + WorkflowEnvelopeData result = await webSiteSlot.GetWorkflowsConnectionsSlotAsync(); + + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {result.Id}"); + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotResourceHealthMetadataResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotResourceHealthMetadataResource.cs index c1b15fe7741ea..6ccda91ab3216 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotResourceHealthMetadataResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WebSiteSlotResourceHealthMetadataResource.cs @@ -19,7 +19,7 @@ public partial class Sample_WebSiteSlotResourceHealthMetadataResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetResourceHealthMetadata() { - // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2021-02-01/examples/GetResourceHealthMetadataBySite.json + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/GetResourceHealthMetadataBySite.json // this example is just showing the usage of "ResourceHealthMetadata_GetBySiteSlot" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunActionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunActionCollection.cs new file mode 100644 index 0000000000000..9fbfe0a5bce10 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunActionCollection.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WorkflowRunActionCollection + { + // List a workflow run actions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAWorkflowRunActions() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActions_List.json + // this example is just showing the usage of "WorkflowRunActions_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunResource created on azure + // for more information of creating WorkflowRunResource, please refer to the document of WorkflowRunResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586676746934337772206998657CU22"; + ResourceIdentifier workflowRunResourceId = WorkflowRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName); + WorkflowRunResource workflowRun = client.GetWorkflowRunResource(workflowRunResourceId); + + // get the collection of this WorkflowRunActionResource + WorkflowRunActionCollection collection = workflowRun.GetWorkflowRunActions(); + + // invoke the operation and iterate over the result + await foreach (WorkflowRunActionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a workflow run action + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAWorkflowRunAction() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActions_Get.json + // this example is just showing the usage of "WorkflowRunActions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunResource created on azure + // for more information of creating WorkflowRunResource, please refer to the document of WorkflowRunResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586676746934337772206998657CU22"; + ResourceIdentifier workflowRunResourceId = WorkflowRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName); + WorkflowRunResource workflowRun = client.GetWorkflowRunResource(workflowRunResourceId); + + // get the collection of this WorkflowRunActionResource + WorkflowRunActionCollection collection = workflowRun.GetWorkflowRunActions(); + + // invoke the operation + string actionName = "HTTP"; + WorkflowRunActionResource result = await collection.GetAsync(actionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a workflow run action + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAWorkflowRunAction() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActions_Get.json + // this example is just showing the usage of "WorkflowRunActions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunResource created on azure + // for more information of creating WorkflowRunResource, please refer to the document of WorkflowRunResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586676746934337772206998657CU22"; + ResourceIdentifier workflowRunResourceId = WorkflowRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName); + WorkflowRunResource workflowRun = client.GetWorkflowRunResource(workflowRunResourceId); + + // get the collection of this WorkflowRunActionResource + WorkflowRunActionCollection collection = workflowRun.GetWorkflowRunActions(); + + // invoke the operation + string actionName = "HTTP"; + bool result = await collection.ExistsAsync(actionName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a workflow run action + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkflowRunAction() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActions_Get.json + // this example is just showing the usage of "WorkflowRunActions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunResource created on azure + // for more information of creating WorkflowRunResource, please refer to the document of WorkflowRunResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586676746934337772206998657CU22"; + ResourceIdentifier workflowRunResourceId = WorkflowRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName); + WorkflowRunResource workflowRun = client.GetWorkflowRunResource(workflowRunResourceId); + + // get the collection of this WorkflowRunActionResource + WorkflowRunActionCollection collection = workflowRun.GetWorkflowRunActions(); + + // invoke the operation + string actionName = "HTTP"; + NullableResponse response = await collection.GetIfExistsAsync(actionName); + WorkflowRunActionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunActionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunActionResource.cs new file mode 100644 index 0000000000000..3a44f50443d0a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunActionResource.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WorkflowRunActionResource + { + // Get a workflow run action + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAWorkflowRunAction() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActions_Get.json + // this example is just showing the usage of "WorkflowRunActions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunActionResource created on azure + // for more information of creating WorkflowRunActionResource, please refer to the document of WorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586676746934337772206998657CU22"; + string actionName = "HTTP"; + ResourceIdentifier workflowRunActionResourceId = WorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName); + WorkflowRunActionResource workflowRunAction = client.GetWorkflowRunActionResource(workflowRunActionResourceId); + + // invoke the operation + WorkflowRunActionResource result = await workflowRunAction.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunActionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // List expression traces + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetExpressionTraces_ListExpressionTraces() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRunActions_ListExpressionTraces.json + // this example is just showing the usage of "WorkflowRunActions_ListExpressionTraces" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunActionResource created on azure + // for more information of creating WorkflowRunActionResource, please refer to the document of WorkflowRunActionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testFlow"; + string runName = "08586776228332053161046300351"; + string actionName = "testAction"; + ResourceIdentifier workflowRunActionResourceId = WorkflowRunActionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName, actionName); + WorkflowRunActionResource workflowRunAction = client.GetWorkflowRunActionResource(workflowRunActionResourceId); + + // invoke the operation and iterate over the result + await foreach (ExpressionRoot item in workflowRunAction.GetExpressionTracesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunCollection.cs new file mode 100644 index 0000000000000..ef729a5b377f5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunCollection.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WorkflowRunCollection + { + // List workflow runs + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListWorkflowRuns() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRuns_List.json + // this example is just showing the usage of "WorkflowRuns_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowRunResource + string workflowName = "test-workflow"; + WorkflowRunCollection collection = webSite.GetWorkflowRuns(workflowName); + + // invoke the operation and iterate over the result + await foreach (WorkflowRunResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a run for a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetARunForAWorkflow() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRuns_Get.json + // this example is just showing the usage of "WorkflowRuns_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowRunResource + string workflowName = "test-workflow"; + WorkflowRunCollection collection = webSite.GetWorkflowRuns(workflowName); + + // invoke the operation + string runName = "08586676746934337772206998657CU22"; + WorkflowRunResource result = await collection.GetAsync(runName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a run for a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetARunForAWorkflow() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRuns_Get.json + // this example is just showing the usage of "WorkflowRuns_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowRunResource + string workflowName = "test-workflow"; + WorkflowRunCollection collection = webSite.GetWorkflowRuns(workflowName); + + // invoke the operation + string runName = "08586676746934337772206998657CU22"; + bool result = await collection.ExistsAsync(runName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a run for a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetARunForAWorkflow() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRuns_Get.json + // this example is just showing the usage of "WorkflowRuns_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowRunResource + string workflowName = "test-workflow"; + WorkflowRunCollection collection = webSite.GetWorkflowRuns(workflowName); + + // invoke the operation + string runName = "08586676746934337772206998657CU22"; + NullableResponse response = await collection.GetIfExistsAsync(runName); + WorkflowRunResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunResource.cs new file mode 100644 index 0000000000000..44e7014e76c45 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowRunResource.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WorkflowRunResource + { + // Get a run for a workflow + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetARunForAWorkflow() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRuns_Get.json + // this example is just showing the usage of "WorkflowRuns_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunResource created on azure + // for more information of creating WorkflowRunResource, please refer to the document of WorkflowRunResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586676746934337772206998657CU22"; + ResourceIdentifier workflowRunResourceId = WorkflowRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName); + WorkflowRunResource workflowRun = client.GetWorkflowRunResource(workflowRunResourceId); + + // invoke the operation + WorkflowRunResource result = await workflowRun.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowRunData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Cancel a workflow run + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Cancel_CancelAWorkflowRun() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowRuns_Cancel.json + // this example is just showing the usage of "WorkflowRuns_Cancel" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowRunResource created on azure + // for more information of creating WorkflowRunResource, please refer to the document of WorkflowRunResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string runName = "08586676746934337772206998657CU22"; + ResourceIdentifier workflowRunResourceId = WorkflowRunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, runName); + WorkflowRunResource workflowRun = client.GetWorkflowRunResource(workflowRunResourceId); + + // invoke the operation + await workflowRun.CancelAsync(); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerCollection.cs new file mode 100644 index 0000000000000..581d8812e1e45 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerCollection.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WorkflowTriggerCollection + { + // List workflow triggers + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListWorkflowTriggers() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggers_List.json + // this example is just showing the usage of "WorkflowTriggers_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowTriggerResource + string workflowName = "test-workflow"; + WorkflowTriggerCollection collection = webSite.GetWorkflowTriggers(workflowName); + + // invoke the operation and iterate over the result + await foreach (WorkflowTriggerResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowTriggerData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a workflow trigger + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAWorkflowTrigger() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggers_Get.json + // this example is just showing the usage of "WorkflowTriggers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowTriggerResource + string workflowName = "test-workflow"; + WorkflowTriggerCollection collection = webSite.GetWorkflowTriggers(workflowName); + + // invoke the operation + string triggerName = "manual"; + WorkflowTriggerResource result = await collection.GetAsync(triggerName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a workflow trigger + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAWorkflowTrigger() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggers_Get.json + // this example is just showing the usage of "WorkflowTriggers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowTriggerResource + string workflowName = "test-workflow"; + WorkflowTriggerCollection collection = webSite.GetWorkflowTriggers(workflowName); + + // invoke the operation + string triggerName = "manual"; + bool result = await collection.ExistsAsync(triggerName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a workflow trigger + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkflowTrigger() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggers_Get.json + // this example is just showing the usage of "WorkflowTriggers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowTriggerResource + string workflowName = "test-workflow"; + WorkflowTriggerCollection collection = webSite.GetWorkflowTriggers(workflowName); + + // invoke the operation + string triggerName = "manual"; + NullableResponse response = await collection.GetIfExistsAsync(triggerName); + WorkflowTriggerResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerHistoryCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerHistoryCollection.cs new file mode 100644 index 0000000000000..78b72ecf3b59b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerHistoryCollection.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WorkflowTriggerHistoryCollection + { + // List a workflow trigger history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAWorkflowTriggerHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggerHistories_List.json + // this example is just showing the usage of "WorkflowTriggerHistories_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowTriggerResource created on azure + // for more information of creating WorkflowTriggerResource, please refer to the document of WorkflowTriggerResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testWorkflowName"; + string triggerName = "testTriggerName"; + ResourceIdentifier workflowTriggerResourceId = WorkflowTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, triggerName); + WorkflowTriggerResource workflowTrigger = client.GetWorkflowTriggerResource(workflowTriggerResourceId); + + // get the collection of this WorkflowTriggerHistoryResource + WorkflowTriggerHistoryCollection collection = workflowTrigger.GetWorkflowTriggerHistories(); + + // invoke the operation and iterate over the result + await foreach (WorkflowTriggerHistoryResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowTriggerHistoryData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a workflow trigger history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAWorkflowTriggerHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggerHistories_Get.json + // this example is just showing the usage of "WorkflowTriggerHistories_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowTriggerResource created on azure + // for more information of creating WorkflowTriggerResource, please refer to the document of WorkflowTriggerResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testWorkflowName"; + string triggerName = "testTriggerName"; + ResourceIdentifier workflowTriggerResourceId = WorkflowTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, triggerName); + WorkflowTriggerResource workflowTrigger = client.GetWorkflowTriggerResource(workflowTriggerResourceId); + + // get the collection of this WorkflowTriggerHistoryResource + WorkflowTriggerHistoryCollection collection = workflowTrigger.GetWorkflowTriggerHistories(); + + // invoke the operation + string historyName = "08586676746934337772206998657CU22"; + WorkflowTriggerHistoryResource result = await collection.GetAsync(historyName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowTriggerHistoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a workflow trigger history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAWorkflowTriggerHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggerHistories_Get.json + // this example is just showing the usage of "WorkflowTriggerHistories_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowTriggerResource created on azure + // for more information of creating WorkflowTriggerResource, please refer to the document of WorkflowTriggerResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testWorkflowName"; + string triggerName = "testTriggerName"; + ResourceIdentifier workflowTriggerResourceId = WorkflowTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, triggerName); + WorkflowTriggerResource workflowTrigger = client.GetWorkflowTriggerResource(workflowTriggerResourceId); + + // get the collection of this WorkflowTriggerHistoryResource + WorkflowTriggerHistoryCollection collection = workflowTrigger.GetWorkflowTriggerHistories(); + + // invoke the operation + string historyName = "08586676746934337772206998657CU22"; + bool result = await collection.ExistsAsync(historyName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a workflow trigger history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkflowTriggerHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggerHistories_Get.json + // this example is just showing the usage of "WorkflowTriggerHistories_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowTriggerResource created on azure + // for more information of creating WorkflowTriggerResource, please refer to the document of WorkflowTriggerResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testWorkflowName"; + string triggerName = "testTriggerName"; + ResourceIdentifier workflowTriggerResourceId = WorkflowTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, triggerName); + WorkflowTriggerResource workflowTrigger = client.GetWorkflowTriggerResource(workflowTriggerResourceId); + + // get the collection of this WorkflowTriggerHistoryResource + WorkflowTriggerHistoryCollection collection = workflowTrigger.GetWorkflowTriggerHistories(); + + // invoke the operation + string historyName = "08586676746934337772206998657CU22"; + NullableResponse response = await collection.GetIfExistsAsync(historyName); + WorkflowTriggerHistoryResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowTriggerHistoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerHistoryResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerHistoryResource.cs new file mode 100644 index 0000000000000..f31fc816cb655 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerHistoryResource.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WorkflowTriggerHistoryResource + { + // Get a workflow trigger history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAWorkflowTriggerHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggerHistories_Get.json + // this example is just showing the usage of "WorkflowTriggerHistories_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowTriggerHistoryResource created on azure + // for more information of creating WorkflowTriggerHistoryResource, please refer to the document of WorkflowTriggerHistoryResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testWorkflowName"; + string triggerName = "testTriggerName"; + string historyName = "08586676746934337772206998657CU22"; + ResourceIdentifier workflowTriggerHistoryResourceId = WorkflowTriggerHistoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, triggerName, historyName); + WorkflowTriggerHistoryResource workflowTriggerHistory = client.GetWorkflowTriggerHistoryResource(workflowTriggerHistoryResourceId); + + // invoke the operation + WorkflowTriggerHistoryResource result = await workflowTriggerHistory.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowTriggerHistoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Resubmit a workflow run based on the trigger history + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Resubmit_ResubmitAWorkflowRunBasedOnTheTriggerHistory() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggerHistories_Resubmit.json + // this example is just showing the usage of "WorkflowTriggerHistories_Resubmit" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowTriggerHistoryResource created on azure + // for more information of creating WorkflowTriggerHistoryResource, please refer to the document of WorkflowTriggerHistoryResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testWorkflowName"; + string triggerName = "testTriggerName"; + string historyName = "testHistoryName"; + ResourceIdentifier workflowTriggerHistoryResourceId = WorkflowTriggerHistoryResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, triggerName, historyName); + WorkflowTriggerHistoryResource workflowTriggerHistory = client.GetWorkflowTriggerHistoryResource(workflowTriggerHistoryResourceId); + + // invoke the operation + await workflowTriggerHistory.ResubmitAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerResource.cs new file mode 100644 index 0000000000000..7c7ef9fa0b854 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowTriggerResource.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AppService.Models; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WorkflowTriggerResource + { + // Get a workflow trigger + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAWorkflowTrigger() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggers_Get.json + // this example is just showing the usage of "WorkflowTriggers_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowTriggerResource created on azure + // for more information of creating WorkflowTriggerResource, please refer to the document of WorkflowTriggerResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string triggerName = "manual"; + ResourceIdentifier workflowTriggerResourceId = WorkflowTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, triggerName); + WorkflowTriggerResource workflowTrigger = client.GetWorkflowTriggerResource(workflowTriggerResourceId); + + // invoke the operation + WorkflowTriggerResource result = await workflowTrigger.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowTriggerData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get the callback URL for a trigger + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetCallbackUrl_GetTheCallbackURLForATrigger() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggers_ListCallbackUrl.json + // this example is just showing the usage of "WorkflowTriggers_ListCallbackUrl" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowTriggerResource created on azure + // for more information of creating WorkflowTriggerResource, please refer to the document of WorkflowTriggerResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string triggerName = "manual"; + ResourceIdentifier workflowTriggerResourceId = WorkflowTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, triggerName); + WorkflowTriggerResource workflowTrigger = client.GetWorkflowTriggerResource(workflowTriggerResourceId); + + // invoke the operation + WorkflowTriggerCallbackUri result = await workflowTrigger.GetCallbackUrlAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Run a workflow trigger + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Run_RunAWorkflowTrigger() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggers_Run.json + // this example is just showing the usage of "WorkflowTriggers_Run" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowTriggerResource created on azure + // for more information of creating WorkflowTriggerResource, please refer to the document of WorkflowTriggerResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string triggerName = "recurrence"; + ResourceIdentifier workflowTriggerResourceId = WorkflowTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, triggerName); + WorkflowTriggerResource workflowTrigger = client.GetWorkflowTriggerResource(workflowTriggerResourceId); + + // invoke the operation + await workflowTrigger.RunAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // Get trigger schema + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSchemaJson_GetTriggerSchema() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowTriggers_GetSchemaJson.json + // this example is just showing the usage of "WorkflowTriggers_GetSchemaJson" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowTriggerResource created on azure + // for more information of creating WorkflowTriggerResource, please refer to the document of WorkflowTriggerResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "testResourceGroup"; + string name = "test-name"; + string workflowName = "testWorkflow"; + string triggerName = "testTrigger"; + ResourceIdentifier workflowTriggerResourceId = WorkflowTriggerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, triggerName); + WorkflowTriggerResource workflowTrigger = client.GetWorkflowTriggerResource(workflowTriggerResourceId); + + // invoke the operation + JsonSchema result = await workflowTrigger.GetSchemaJsonAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowVersionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowVersionCollection.cs new file mode 100644 index 0000000000000..dbc5713adb99e --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowVersionCollection.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WorkflowVersionCollection + { + // List a workflows versions + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAWorkflowsVersions() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowVersions_List.json + // this example is just showing the usage of "WorkflowVersions_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowVersionResource + string workflowName = "test-workflow"; + WorkflowVersionCollection collection = webSite.GetWorkflowVersions(workflowName); + + // invoke the operation and iterate over the result + await foreach (WorkflowVersionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowVersionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a workflow version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAWorkflowVersion() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowVersions_Get.json + // this example is just showing the usage of "WorkflowVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowVersionResource + string workflowName = "test-workflow"; + WorkflowVersionCollection collection = webSite.GetWorkflowVersions(workflowName); + + // invoke the operation + string versionId = "08586676824806722526"; + WorkflowVersionResource result = await collection.GetAsync(versionId); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a workflow version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAWorkflowVersion() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowVersions_Get.json + // this example is just showing the usage of "WorkflowVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowVersionResource + string workflowName = "test-workflow"; + WorkflowVersionCollection collection = webSite.GetWorkflowVersions(workflowName); + + // invoke the operation + string versionId = "08586676824806722526"; + bool result = await collection.ExistsAsync(versionId); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a workflow version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAWorkflowVersion() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowVersions_Get.json + // this example is just showing the usage of "WorkflowVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WebSiteResource created on azure + // for more information of creating WebSiteResource, please refer to the document of WebSiteResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + ResourceIdentifier webSiteResourceId = WebSiteResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name); + WebSiteResource webSite = client.GetWebSiteResource(webSiteResourceId); + + // get the collection of this WorkflowVersionResource + string workflowName = "test-workflow"; + WorkflowVersionCollection collection = webSite.GetWorkflowVersions(workflowName); + + // invoke the operation + string versionId = "08586676824806722526"; + NullableResponse response = await collection.GetIfExistsAsync(versionId); + WorkflowVersionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowVersionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowVersionResource.cs new file mode 100644 index 0000000000000..b87a268674046 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/samples/Generated/Samples/Sample_WorkflowVersionResource.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; + +namespace Azure.ResourceManager.AppService.Samples +{ + public partial class Sample_WorkflowVersionResource + { + // Get a workflow version + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAWorkflowVersion() + { + // Generated from example definition: specification/web/resource-manager/Microsoft.Web/stable/2024-04-01/examples/WorkflowVersions_Get.json + // this example is just showing the usage of "WorkflowVersions_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkflowVersionResource created on azure + // for more information of creating WorkflowVersionResource, please refer to the document of WorkflowVersionResource + string subscriptionId = "34adfa4f-cedf-4dc0-ba29-b6d1a69ab345"; + string resourceGroupName = "test-resource-group"; + string name = "test-name"; + string workflowName = "test-workflow"; + string versionId = "08586676824806722526"; + ResourceIdentifier workflowVersionResourceId = WorkflowVersionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, name, workflowName, versionId); + WorkflowVersionResource workflowVersion = client.GetWorkflowVersionResource(workflowVersionResourceId); + + // invoke the operation + WorkflowVersionResource result = await workflowVersion.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkflowVersionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateCollection.cs index ca8f8d5ea11c7..c8fba557f9a71 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateOrUpdateAs /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(string name /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string name, CancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -287,7 +287,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -317,7 +317,7 @@ public virtual Pageable GetAll(CancellationToken cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -360,7 +360,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -403,7 +403,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -448,7 +448,7 @@ public virtual async Task> GetIfExistsA /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateData.cs index 2d2f8175d1c1c..8acd7bac3fa08 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateData.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateData.cs @@ -86,7 +86,7 @@ public AppCertificateData(AzureLocation location) : base(location) /// Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". /// CNAME of the certificate to be issued via free certificate. /// Method of domain validation for free cert. - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// Keeps track of any properties unknown to the library. internal AppCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string password, string friendlyName, string subjectName, IList hostNames, byte[] pfxBlob, string siteName, string selfLink, string issuer, DateTimeOffset? issueOn, DateTimeOffset? expireOn, string thumbprintString, bool? isValid, byte[] cerBlob, string publicKeyHash, HostingEnvironmentProfile hostingEnvironmentProfile, ResourceIdentifier keyVaultId, string keyVaultSecretName, KeyVaultSecretStatus? keyVaultSecretStatus, ResourceIdentifier serverFarmId, string canonicalName, string domainValidationMethod, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { @@ -183,7 +183,7 @@ internal AppCertificateData() /// Method of domain validation for free cert. [WirePath("properties.domainValidationMethod")] public string DomainValidationMethod { get; set; } - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. [WirePath("kind")] public string Kind { get; set; } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateResource.cs index ebea65ab843e0..6ab2153151c6d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppCertificateResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(Cancellatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancellati /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -312,7 +312,7 @@ public virtual async Task> UpdateAsync(AppCerti /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateCollection.cs index 908ecb0891251..8cbf23b75964d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> CreateOrU /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task> GetAsync(stri /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(string name, Cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllAsync(Cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(CancellationToken /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task> GetIf /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateData.cs index 0704420ae6272..a4e6d5e31379a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateData.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateData.cs @@ -67,7 +67,7 @@ public AppServiceCertificateData(AzureLocation location) : base(location) /// Key Vault resource Id. /// Key Vault secret name. /// Status of the Key Vault secret. - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// Keeps track of any properties unknown to the library. internal AppServiceCertificateData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ResourceIdentifier keyVaultId, string keyVaultSecretName, KeyVaultSecretStatus? provisioningState, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { @@ -92,7 +92,7 @@ internal AppServiceCertificateData() /// Status of the Key Vault secret. [WirePath("properties.provisioningState")] public KeyVaultSecretStatus? ProvisioningState { get; } - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. [WirePath("kind")] public string Kind { get; set; } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderCollection.cs index ef6623da02946..e4e6eab277679 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> Crea /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(W /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string certifica /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(Can /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string certificateOrderNam /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string certificateOrderName, CancellationTo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderData.cs index 88028086dccf5..f6bbd2d52fcdd 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderData.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderData.cs @@ -86,7 +86,7 @@ public AppServiceCertificateOrderData(AzureLocation location) : base(location) /// Reasons why App Service Certificate is not renewable at the current moment. /// Time stamp when the certificate would be auto renewed next. /// Contact info. - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// Keeps track of any properties unknown to the library. internal AppServiceCertificateOrderData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, IDictionary certificates, string distinguishedName, string domainVerificationToken, int? validityInYears, int? keySize, CertificateProductType? productType, bool? isAutoRenew, ProvisioningState? provisioningState, CertificateOrderStatus? status, AppServiceCertificateDetails signedCertificate, string csr, AppServiceCertificateDetails intermediate, AppServiceCertificateDetails root, string serialNumber, DateTimeOffset? lastCertificateIssuedOn, DateTimeOffset? expireOn, bool? isPrivateKeyExternal, IReadOnlyList appServiceCertificateNotRenewableReasons, DateTimeOffset? nextAutoRenewTimeStamp, CertificateOrderContact contact, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { @@ -179,7 +179,7 @@ internal AppServiceCertificateOrderData() /// Contact info. [WirePath("properties.contact")] public CertificateOrderContact Contact { get; } - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. [WirePath("kind")] public string Kind { get; set; } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs index 4ef0df0656c6c..667aeb2808a90 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateOrderResource.cs @@ -110,7 +110,7 @@ public virtual AppServiceCertificateCollection GetAppServiceCertificates() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAppService /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -179,7 +179,7 @@ public virtual CertificateOrderDetectorCollection GetCertificateOrderDetectors() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -213,7 +213,7 @@ public virtual async Task> GetCertifi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -247,7 +247,7 @@ public virtual Response GetCertificateOrderDet /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -287,7 +287,7 @@ public virtual async Task> GetAsync /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -327,7 +327,7 @@ public virtual Response Get(CancellationToke /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -371,7 +371,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -415,7 +415,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -457,7 +457,7 @@ public virtual async Task> UpdateAs /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -499,7 +499,7 @@ public virtual Response Update(AppServiceCer /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -541,7 +541,7 @@ public virtual async Task ReissueAsync(ReissueCertificateOrderContent /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -583,7 +583,7 @@ public virtual Response Reissue(ReissueCertificateOrderContent content, Cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -625,7 +625,7 @@ public virtual async Task RenewAsync(RenewCertificateOrderContent cont /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -667,7 +667,7 @@ public virtual Response Renew(RenewCertificateOrderContent content, Cancellation /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -705,7 +705,7 @@ public virtual async Task ResendEmailAsync(CancellationToken cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -743,7 +743,7 @@ public virtual Response ResendEmail(CancellationToken cancellationToken = defaul /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -785,7 +785,7 @@ public virtual async Task ResendRequestEmailsAsync(AppServiceDomainNam /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -827,7 +827,7 @@ public virtual Response ResendRequestEmails(AppServiceDomainNameIdentifier nameI /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -869,7 +869,7 @@ public virtual async Task> RetrieveSiteSealAsync(SiteSealCont /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -911,7 +911,7 @@ public virtual Response RetrieveSiteSeal(SiteSealContent content, Canc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -949,7 +949,7 @@ public virtual async Task VerifyDomainOwnershipAsync(CancellationToken /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -987,7 +987,7 @@ public virtual Response VerifyDomainOwnership(CancellationToken cancellationToke /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1016,7 +1016,7 @@ public virtual AsyncPageable RetrieveCertificateActionsA /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1045,7 +1045,7 @@ public virtual Pageable RetrieveCertificateActions(Cance /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1074,7 +1074,7 @@ public virtual AsyncPageable RetrieveCertificateEmai /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateResource.cs index a854272bb62e1..617d32e408578 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceCertificateResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(Canc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken can /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -226,7 +226,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -270,7 +270,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -312,7 +312,7 @@ public virtual async Task> UpdateAsync(A /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainCollection.cs index cbb85219f2ac9..cca7a23809b56 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrUpdate /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil w /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync(string do /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string domainName, Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(CancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationToken cance /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string domainName, Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string domainName, CancellationToken cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> GetIfExist /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainData.cs index 6013366065bf0..51be30c5bc055 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainData.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainData.cs @@ -90,7 +90,7 @@ public AppServiceDomainData(AzureLocation location) : base(location) /// Azure DNS Zone to use. /// Target DNS type (would be used for migration). /// - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// Keeps track of any properties unknown to the library. internal AppServiceDomainData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, RegistrationContactInfo contactAdmin, RegistrationContactInfo contactBilling, RegistrationContactInfo contactRegistrant, RegistrationContactInfo contactTech, AppServiceDomainStatus? registrationStatus, ProvisioningState? provisioningState, IReadOnlyList nameServers, bool? isDomainPrivacyEnabled, DateTimeOffset? createdOn, DateTimeOffset? expireOn, DateTimeOffset? lastRenewedOn, bool? isAutoRenew, bool? isDnsRecordManagementReady, IReadOnlyList managedHostNames, DomainPurchaseConsent consent, IReadOnlyList domainNotRenewableReasons, AppServiceDnsType? dnsType, string dnsZoneId, AppServiceDnsType? targetDnsType, string authCode, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { @@ -186,7 +186,7 @@ internal AppServiceDomainData() /// Gets or sets the auth code. [WirePath("properties.authCode")] public string AuthCode { get; set; } - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. [WirePath("kind")] public string Kind { get; set; } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs index 2bee5a5425df4..c0f01a5807407 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceDomainResource.cs @@ -109,7 +109,7 @@ public virtual DomainOwnershipIdentifierCollection GetDomainOwnershipIdentifiers /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -140,7 +140,7 @@ public virtual async Task> GetDomain /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -171,7 +171,7 @@ public virtual Response GetDomainOwnershipIde /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync(Cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -251,7 +251,7 @@ public virtual Response Get(CancellationToken cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -296,7 +296,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? f /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -341,7 +341,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, bool? forceHardDeleteDom /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -383,7 +383,7 @@ public virtual async Task> UpdateAsync(AppSer /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -425,7 +425,7 @@ public virtual Response Update(AppServiceDomainPatch p /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -463,7 +463,7 @@ public virtual async Task RenewAsync(CancellationToken cancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -487,5 +487,81 @@ public virtual Response Renew(CancellationToken cancellationToken = default) throw; } } + + /// + /// Transfer out domain to another registrar + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/transferOut + /// + /// + /// Operation Id + /// Domains_TransferOut + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> TransferOutAsync(CancellationToken cancellationToken = default) + { + using var scope = _appServiceDomainDomainsClientDiagnostics.CreateScope("AppServiceDomainResource.TransferOut"); + scope.Start(); + try + { + var response = await _appServiceDomainDomainsRestClient.TransferOutAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AppServiceDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Transfer out domain to another registrar + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DomainRegistration/domains/{domainName}/transferOut + /// + /// + /// Operation Id + /// Domains_TransferOut + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response TransferOut(CancellationToken cancellationToken = default) + { + using var scope = _appServiceDomainDomainsClientDiagnostics.CreateScope("AppServiceDomainResource.TransferOut"); + scope.Start(); + try + { + var response = _appServiceDomainDomainsRestClient.TransferOut(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AppServiceDomainResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentCollection.cs index 22dc6fa11af7e..312b8c5ad4feb 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrU /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync(stri /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string name, Cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(Cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationToken /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> GetIf /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentData.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentData.Serialization.cs index 3f5f1824a7e07..a92005cc84f83 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentData.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentData.Serialization.cs @@ -150,6 +150,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea writer.WritePropertyName("hasLinuxWorkers"u8); writer.WriteBooleanValue(HasLinuxWorkers.Value); } + if (Optional.IsDefined(UpgradePreference)) + { + writer.WritePropertyName("upgradePreference"u8); + writer.WriteStringValue(UpgradePreference.Value.ToString()); + } if (Optional.IsDefined(DedicatedHostCount)) { writer.WritePropertyName("dedicatedHostCount"u8); @@ -160,6 +165,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea writer.WritePropertyName("zoneRedundant"u8); writer.WriteBooleanValue(IsZoneRedundant.Value); } + if (Optional.IsDefined(CustomDnsSuffixConfiguration)) + { + writer.WritePropertyName("customDnsSuffixConfiguration"u8); + writer.WriteObjectValue(CustomDnsSuffixConfiguration, options); + } + if (Optional.IsDefined(NetworkingConfiguration)) + { + writer.WritePropertyName("networkingConfiguration"u8); + writer.WriteObjectValue(NetworkingConfiguration, options); + } + if (options.Format != "W" && Optional.IsDefined(UpgradeAvailability)) + { + writer.WritePropertyName("upgradeAvailability"u8); + writer.WriteStringValue(UpgradeAvailability.Value.ToString()); + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -220,8 +240,12 @@ internal static AppServiceEnvironmentData DeserializeAppServiceEnvironmentData(J IList clusterSettings = default; IList userWhitelistedIPRanges = default; bool? hasLinuxWorkers = default; + UpgradePreference? upgradePreference = default; int? dedicatedHostCount = default; bool? zoneRedundant = default; + CustomDnsSuffixConfigurationData customDnsSuffixConfiguration = default; + AseV3NetworkingConfigurationData networkingConfiguration = default; + UpgradeAvailability? upgradeAvailability = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -411,6 +435,15 @@ internal static AppServiceEnvironmentData DeserializeAppServiceEnvironmentData(J hasLinuxWorkers = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("upgradePreference"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upgradePreference = new UpgradePreference(property0.Value.GetString()); + continue; + } if (property0.NameEquals("dedicatedHostCount"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -429,6 +462,33 @@ internal static AppServiceEnvironmentData DeserializeAppServiceEnvironmentData(J zoneRedundant = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("customDnsSuffixConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customDnsSuffixConfiguration = CustomDnsSuffixConfigurationData.DeserializeCustomDnsSuffixConfigurationData(property0.Value, options); + continue; + } + if (property0.NameEquals("networkingConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkingConfiguration = AseV3NetworkingConfigurationData.DeserializeAseV3NetworkingConfigurationData(property0.Value, options); + continue; + } + if (property0.NameEquals("upgradeAvailability"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upgradeAvailability = new UpgradeAvailability(property0.Value.GetString()); + continue; + } } continue; } @@ -459,8 +519,12 @@ internal static AppServiceEnvironmentData DeserializeAppServiceEnvironmentData(J clusterSettings ?? new ChangeTrackingList(), userWhitelistedIPRanges ?? new ChangeTrackingList(), hasLinuxWorkers, + upgradePreference, dedicatedHostCount, zoneRedundant, + customDnsSuffixConfiguration, + networkingConfiguration, + upgradeAvailability, kind, serializedAdditionalRawData); } @@ -860,6 +924,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpgradePreference), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" upgradePreference: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UpgradePreference)) + { + builder.Append(" upgradePreference: "); + builder.AppendLine($"'{UpgradePreference.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DedicatedHostCount), out propertyOverride); if (hasPropertyOverride) { @@ -891,6 +970,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomDnsSuffixConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customDnsSuffixConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CustomDnsSuffixConfiguration)) + { + builder.Append(" customDnsSuffixConfiguration: "); + BicepSerializationHelpers.AppendChildObject(builder, CustomDnsSuffixConfiguration, options, 4, false, " customDnsSuffixConfiguration: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkingConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkingConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkingConfiguration)) + { + builder.Append(" networkingConfiguration: "); + BicepSerializationHelpers.AppendChildObject(builder, NetworkingConfiguration, options, 4, false, " networkingConfiguration: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpgradeAvailability), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" upgradeAvailability: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UpgradeAvailability)) + { + builder.Append(" upgradeAvailability: "); + builder.AppendLine($"'{UpgradeAvailability.Value.ToString()}'"); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentData.cs index 1ef631910c4a8..8f44c57767001 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentData.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentData.cs @@ -83,11 +83,15 @@ public AppServiceEnvironmentData(AzureLocation location) : base(location) /// Custom settings for changing the behavior of the App Service Environment. /// User added ip ranges to whitelist on ASE db. /// Flag that displays whether an ASE has linux workers or not. + /// Upgrade Preference. /// Dedicated Host Count. /// Whether or not this App Service Environment is zone-redundant. - /// Kind of resource. + /// Full view of the custom domain suffix configuration for ASEv3. + /// Full view of networking configuration for an ASE. + /// Whether an upgrade is available for this App Service Environment. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// Keeps track of any properties unknown to the library. - internal AppServiceEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ProvisioningState? provisioningState, HostingEnvironmentStatus? status, AppServiceVirtualNetworkProfile virtualNetwork, LoadBalancingMode? internalLoadBalancingMode, string multiSize, int? multiRoleCount, int? ipSslAddressCount, string dnsSuffix, int? maximumNumberOfMachines, int? frontEndScaleFactor, bool? isSuspended, IList clusterSettings, IList userWhitelistedIPRanges, bool? hasLinuxWorkers, int? dedicatedHostCount, bool? isZoneRedundant, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal AppServiceEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ProvisioningState? provisioningState, HostingEnvironmentStatus? status, AppServiceVirtualNetworkProfile virtualNetwork, LoadBalancingMode? internalLoadBalancingMode, string multiSize, int? multiRoleCount, int? ipSslAddressCount, string dnsSuffix, int? maximumNumberOfMachines, int? frontEndScaleFactor, bool? isSuspended, IList clusterSettings, IList userWhitelistedIPRanges, bool? hasLinuxWorkers, UpgradePreference? upgradePreference, int? dedicatedHostCount, bool? isZoneRedundant, CustomDnsSuffixConfigurationData customDnsSuffixConfiguration, AseV3NetworkingConfigurationData networkingConfiguration, UpgradeAvailability? upgradeAvailability, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ProvisioningState = provisioningState; Status = status; @@ -103,8 +107,12 @@ internal AppServiceEnvironmentData(ResourceIdentifier id, string name, ResourceT ClusterSettings = clusterSettings; UserWhitelistedIPRanges = userWhitelistedIPRanges; HasLinuxWorkers = hasLinuxWorkers; + UpgradePreference = upgradePreference; DedicatedHostCount = dedicatedHostCount; IsZoneRedundant = isZoneRedundant; + CustomDnsSuffixConfiguration = customDnsSuffixConfiguration; + NetworkingConfiguration = networkingConfiguration; + UpgradeAvailability = upgradeAvailability; Kind = kind; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -159,13 +167,25 @@ internal AppServiceEnvironmentData() /// Flag that displays whether an ASE has linux workers or not. [WirePath("properties.hasLinuxWorkers")] public bool? HasLinuxWorkers { get; } + /// Upgrade Preference. + [WirePath("properties.upgradePreference")] + public UpgradePreference? UpgradePreference { get; set; } /// Dedicated Host Count. [WirePath("properties.dedicatedHostCount")] public int? DedicatedHostCount { get; set; } /// Whether or not this App Service Environment is zone-redundant. [WirePath("properties.zoneRedundant")] public bool? IsZoneRedundant { get; set; } - /// Kind of resource. + /// Full view of the custom domain suffix configuration for ASEv3. + [WirePath("properties.customDnsSuffixConfiguration")] + public CustomDnsSuffixConfigurationData CustomDnsSuffixConfiguration { get; set; } + /// Full view of networking configuration for an ASE. + [WirePath("properties.networkingConfiguration")] + public AseV3NetworkingConfigurationData NetworkingConfiguration { get; set; } + /// Whether an upgrade is available for this App Service Environment. + [WirePath("properties.upgradeAvailability")] + public UpgradeAvailability? UpgradeAvailability { get; } + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. [WirePath("kind")] public string Kind { get; set; } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentResource.cs index 8fe4c55b7a80f..3484ea9af8d92 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceEnvironmentResource.cs @@ -119,7 +119,7 @@ public virtual HostingEnvironmentDetectorCollection GetHostingEnvironmentDetecto /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -153,7 +153,7 @@ public virtual async Task> GetHosti /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -174,6 +174,13 @@ public virtual Response GetHostingEnvironmen return GetHostingEnvironmentDetectors().Get(detectorName, startTime, endTime, timeGrain, cancellationToken); } + /// Gets an object representing a CustomDnsSuffixConfigurationResource along with the instance operations that can be performed on it in the AppServiceEnvironment. + /// Returns a object. + public virtual CustomDnsSuffixConfigurationResource GetCustomDnsSuffixConfiguration() + { + return new CustomDnsSuffixConfigurationResource(Client, Id.AppendChildResource("configurations", "customdnssuffix")); + } + /// Gets an object representing a AseV3NetworkingConfigurationResource along with the instance operations that can be performed on it in the AppServiceEnvironment. /// Returns a object. public virtual AseV3NetworkingConfigurationResource GetAseV3NetworkingConfiguration() @@ -208,7 +215,7 @@ public virtual HostingEnvironmentWorkerPoolCollection GetHostingEnvironmentWorke /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -239,7 +246,7 @@ public virtual async Task> GetHos /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -277,7 +284,7 @@ public virtual HostingEnvironmentPrivateEndpointConnectionCollection GetHostingE /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -308,7 +315,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -346,7 +353,7 @@ public virtual HostingEnvironmentRecommendationCollection GetHostingEnvironmentR /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -379,7 +386,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -412,7 +419,7 @@ public virtual Response GetHostingEnvi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -452,7 +459,7 @@ public virtual async Task> GetAsync(Canc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -492,7 +499,7 @@ public virtual Response Get(CancellationToken can /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -535,7 +542,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, bool? f /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -578,7 +585,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, bool? forceDelete = null /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -620,7 +627,7 @@ public virtual async Task> UpdateAsync(A /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -662,7 +669,7 @@ public virtual Response Update(AppServiceEnvironm /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -688,7 +695,7 @@ public virtual AsyncPageable GetCapacitiesAsync(CancellationToken /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -714,7 +721,7 @@ public virtual Pageable GetCapacities(CancellationToken cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -748,7 +755,7 @@ public virtual async Task> GetVipIn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -782,7 +789,7 @@ public virtual Response GetVipInfo(Cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -811,7 +818,7 @@ public virtual AsyncPageable GetDiagnosticsAsync( /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -840,7 +847,7 @@ public virtual Pageable GetDiagnostics(Cancellati /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -879,7 +886,7 @@ public virtual async Task> GetDiagnostic /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -918,7 +925,7 @@ public virtual Response GetDiagnosticsItem(string /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -948,7 +955,7 @@ public virtual AsyncPageable GetInboundNetworkDepend /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -965,6 +972,166 @@ public virtual Pageable GetInboundNetworkDependencie return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => InboundEnvironmentEndpoint.DeserializeInboundEnvironmentEndpoint(e), _appServiceEnvironmentClientDiagnostics, Pipeline, "AppServiceEnvironmentResource.GetInboundNetworkDependenciesEndpoints", "value", "nextLink", cancellationToken); } + /// + /// Send a test notification that an upgrade is available for this App Service Environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/testUpgradeAvailableNotification + /// + /// + /// Operation Id + /// AppServiceEnvironments_TestUpgradeAvailableNotification + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task TestUpgradeAvailableNotificationAsync(CancellationToken cancellationToken = default) + { + using var scope = _appServiceEnvironmentClientDiagnostics.CreateScope("AppServiceEnvironmentResource.TestUpgradeAvailableNotification"); + scope.Start(); + try + { + var response = await _appServiceEnvironmentRestClient.TestUpgradeAvailableNotificationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Send a test notification that an upgrade is available for this App Service Environment. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/testUpgradeAvailableNotification + /// + /// + /// Operation Id + /// AppServiceEnvironments_TestUpgradeAvailableNotification + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response TestUpgradeAvailableNotification(CancellationToken cancellationToken = default) + { + using var scope = _appServiceEnvironmentClientDiagnostics.CreateScope("AppServiceEnvironmentResource.TestUpgradeAvailableNotification"); + scope.Start(); + try + { + var response = _appServiceEnvironmentRestClient.TestUpgradeAvailableNotification(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Initiate an upgrade of an App Service Environment if one is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/upgrade + /// + /// + /// Operation Id + /// AppServiceEnvironments_Upgrade + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task UpgradeAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _appServiceEnvironmentClientDiagnostics.CreateScope("AppServiceEnvironmentResource.Upgrade"); + scope.Start(); + try + { + var response = await _appServiceEnvironmentRestClient.UpgradeAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AppServiceArmOperation(_appServiceEnvironmentClientDiagnostics, Pipeline, _appServiceEnvironmentRestClient.CreateUpgradeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Initiate an upgrade of an App Service Environment if one is available. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/upgrade + /// + /// + /// Operation Id + /// AppServiceEnvironments_Upgrade + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Upgrade(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _appServiceEnvironmentClientDiagnostics.CreateScope("AppServiceEnvironmentResource.Upgrade"); + scope.Start(); + try + { + var response = _appServiceEnvironmentRestClient.Upgrade(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new AppServiceArmOperation(_appServiceEnvironmentClientDiagnostics, Pipeline, _appServiceEnvironmentRestClient.CreateUpgradeRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Description for List all currently running operations on the App Service Environment. /// @@ -978,7 +1145,7 @@ public virtual Pageable GetInboundNetworkDependencie /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1007,7 +1174,7 @@ public virtual AsyncPageable GetOperationsAsync(Cancellatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1036,7 +1203,7 @@ public virtual Pageable GetOperations(CancellationToken can /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1066,7 +1233,7 @@ public virtual AsyncPageable GetOutboundNetworkDepe /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1096,7 +1263,7 @@ public virtual Pageable GetOutboundNetworkDependenc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1125,7 +1292,7 @@ public virtual AsyncPageable GetPrivateLinkRe /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1154,7 +1321,7 @@ public virtual Pageable GetPrivateLinkResourc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1192,7 +1359,7 @@ public virtual async Task RebootAsync(CancellationToken cancellationTo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1230,7 +1397,7 @@ public virtual Response Reboot(CancellationToken cancellationToken = default) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1260,7 +1427,7 @@ public virtual AsyncPageable GetAppServicePlansAsync(Can /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1290,7 +1457,7 @@ public virtual Pageable GetAppServicePlans(CancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1321,7 +1488,7 @@ public virtual AsyncPageable GetUsagesAsync(string filter = null, /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1352,7 +1519,7 @@ public virtual Pageable GetUsages(string filter = null, Cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1380,7 +1547,7 @@ public virtual AsyncPageable GetHistoryForHostingEnvir /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1408,7 +1575,7 @@ public virtual Pageable GetHistoryForHostingEnvironmen /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1440,7 +1607,7 @@ public virtual AsyncPageable GetRecommendedRulesForHos /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1472,7 +1639,7 @@ public virtual Pageable GetRecommendedRulesForHostingE /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1510,7 +1677,7 @@ public virtual async Task DisableAllForHostingEnvironmentRecommendatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1548,7 +1715,7 @@ public virtual Response DisableAllForHostingEnvironmentRecommendation(string env /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1586,7 +1753,7 @@ public virtual async Task ResetAllFiltersForHostingEnvironmentRecommen /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanCollection.cs index cc94166be4a02..7a8f5eb346479 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrUpdateAs /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wai /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync(string name /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string name, CancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationToken cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> GetIfExistsA /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanData.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanData.Serialization.cs index 76806472f82df..abc9a3b34e4f8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanData.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanData.Serialization.cs @@ -113,6 +113,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("maximumNumberOfWorkers"u8); writer.WriteNumberValue(MaximumNumberOfWorkers.Value); } + if (options.Format != "W" && Optional.IsDefined(NumberOfWorkers)) + { + writer.WritePropertyName("numberOfWorkers"u8); + writer.WriteNumberValue(NumberOfWorkers.Value); + } if (options.Format != "W" && Optional.IsDefined(GeoRegion)) { writer.WritePropertyName("geoRegion"u8); @@ -272,6 +277,7 @@ internal static AppServicePlanData DeserializeAppServicePlanData(JsonElement ele string subscription = default; HostingEnvironmentProfile hostingEnvironmentProfile = default; int? maximumNumberOfWorkers = default; + int? numberOfWorkers = default; string geoRegion = default; bool? perSiteScaling = default; bool? elasticScaleEnabled = default; @@ -406,6 +412,15 @@ internal static AppServicePlanData DeserializeAppServicePlanData(JsonElement ele maximumNumberOfWorkers = property0.Value.GetInt32(); continue; } + if (property0.NameEquals("numberOfWorkers"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + numberOfWorkers = property0.Value.GetInt32(); + continue; + } if (property0.NameEquals("geoRegion"u8)) { geoRegion = property0.Value.GetString(); @@ -577,6 +592,7 @@ internal static AppServicePlanData DeserializeAppServicePlanData(JsonElement ele subscription, hostingEnvironmentProfile, maximumNumberOfWorkers, + numberOfWorkers, geoRegion, perSiteScaling, elasticScaleEnabled, @@ -857,6 +873,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NumberOfWorkers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" numberOfWorkers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NumberOfWorkers)) + { + builder.Append(" numberOfWorkers: "); + builder.AppendLine($"{NumberOfWorkers.Value}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GeoRegion), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanData.cs index 0df390b456421..c8d276f0e2017 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanData.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanData.cs @@ -72,6 +72,7 @@ public AppServicePlanData(AzureLocation location) : base(location) /// App Service plan subscription. /// Specification for the App Service Environment to use for the App Service plan. /// Maximum number of instances that can be assigned to this App Service plan. + /// The number of instances that are assigned to this App Service plan. /// Geographical location for the App Service plan. /// /// If <code>true</code>, apps assigned to this App Service plan can be scaled independently. @@ -95,9 +96,9 @@ public AppServicePlanData(AzureLocation location) : base(location) /// If <code>true</code>, this App Service Plan will perform availability zone balancing. /// If <code>false</code>, this App Service Plan will not perform availability zone balancing. /// - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// Keeps track of any properties unknown to the library. - internal AppServicePlanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AppServiceSkuDescription sku, ExtendedLocation extendedLocation, string workerTierName, AppServicePlanStatus? status, string subscription, HostingEnvironmentProfile hostingEnvironmentProfile, int? maximumNumberOfWorkers, string geoRegion, bool? isPerSiteScaling, bool? isElasticScaleEnabled, int? maximumElasticWorkerCount, int? numberOfSites, bool? isSpot, DateTimeOffset? spotExpireOn, DateTimeOffset? freeOfferExpireOn, string resourceGroup, bool? isReserved, bool? isXenon, bool? isHyperV, int? targetWorkerCount, int? targetWorkerSizeId, ProvisioningState? provisioningState, KubeEnvironmentProfile kubeEnvironmentProfile, bool? isZoneRedundant, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal AppServicePlanData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AppServiceSkuDescription sku, ExtendedLocation extendedLocation, string workerTierName, AppServicePlanStatus? status, string subscription, HostingEnvironmentProfile hostingEnvironmentProfile, int? maximumNumberOfWorkers, int? numberOfWorkers, string geoRegion, bool? isPerSiteScaling, bool? isElasticScaleEnabled, int? maximumElasticWorkerCount, int? numberOfSites, bool? isSpot, DateTimeOffset? spotExpireOn, DateTimeOffset? freeOfferExpireOn, string resourceGroup, bool? isReserved, bool? isXenon, bool? isHyperV, int? targetWorkerCount, int? targetWorkerSizeId, ProvisioningState? provisioningState, KubeEnvironmentProfile kubeEnvironmentProfile, bool? isZoneRedundant, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { Sku = sku; ExtendedLocation = extendedLocation; @@ -106,6 +107,7 @@ internal AppServicePlanData(ResourceIdentifier id, string name, ResourceType res Subscription = subscription; HostingEnvironmentProfile = hostingEnvironmentProfile; MaximumNumberOfWorkers = maximumNumberOfWorkers; + NumberOfWorkers = numberOfWorkers; GeoRegion = geoRegion; IsPerSiteScaling = isPerSiteScaling; IsElasticScaleEnabled = isElasticScaleEnabled; @@ -153,6 +155,9 @@ internal AppServicePlanData() /// Maximum number of instances that can be assigned to this App Service plan. [WirePath("properties.maximumNumberOfWorkers")] public int? MaximumNumberOfWorkers { get; } + /// The number of instances that are assigned to this App Service plan. + [WirePath("properties.numberOfWorkers")] + public int? NumberOfWorkers { get; } /// Geographical location for the App Service plan. [WirePath("properties.geoRegion")] public string GeoRegion { get; } @@ -210,7 +215,7 @@ internal AppServicePlanData() /// [WirePath("properties.zoneRedundant")] public bool? IsZoneRedundant { get; set; } - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. [WirePath("kind")] public string Kind { get; set; } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayCollection.cs index 830e99597febb..8601bd37e0b7c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayCollection.cs @@ -61,7 +61,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -108,7 +108,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -155,7 +155,7 @@ public virtual Response Ge /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -200,7 +200,7 @@ public virtual async Task> ExistsAsync(string namespaceName, stri /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -245,7 +245,7 @@ public virtual Response Exists(string namespaceName, string relayName, Can /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -292,7 +292,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs index d8d211613afbc..bd4d796e9843f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanHybridConnectionNamespaceRelayResource.cs @@ -104,7 +104,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -144,7 +144,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -184,7 +184,7 @@ public virtual Response Ge /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -228,7 +228,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -272,7 +272,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -310,7 +310,7 @@ public virtual async Task> GetHybridConnectionKeys /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -348,7 +348,7 @@ public virtual Response GetHybridConnectionKeys(Cancellatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -378,7 +378,7 @@ public virtual AsyncPageable GetWebAppsByHybridConnectionAsync(Cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs index 30b75cb4ce6c1..0d9a120c40518 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanResource.cs @@ -110,7 +110,7 @@ public virtual AppServicePlanHybridConnectionNamespaceRelayCollection GetAppServ /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -188,7 +188,7 @@ public virtual AppServicePlanVirtualNetworkConnectionCollection GetAppServicePla /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -219,7 +219,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -250,7 +250,7 @@ public virtual Response GetAppSe /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -290,7 +290,7 @@ public virtual async Task> GetAsync(Cancellatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -330,7 +330,7 @@ public virtual Response Get(CancellationToken cancellati /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -374,7 +374,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -418,7 +418,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -460,7 +460,7 @@ public virtual async Task> UpdateAsync(AppServi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -502,7 +502,7 @@ public virtual Response Update(AppServicePlanPatch patch /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -531,7 +531,7 @@ public virtual AsyncPageable GetCapabilitiesAsync(Cance /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -560,7 +560,7 @@ public virtual Pageable GetCapabilities(CancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -590,7 +590,7 @@ public virtual AsyncPageable GetHybridConnectionRelaysAsyn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -620,7 +620,7 @@ public virtual Pageable GetHybridConnectionRelays(Cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -659,7 +659,7 @@ public virtual async Task RestartWebAppsAsync(bool? softRestart = null /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -698,7 +698,7 @@ public virtual Response RestartWebApps(bool? softRestart = null, CancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -731,7 +731,7 @@ public virtual AsyncPageable GetWebAppsAsync(string skipToken = nul /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -764,7 +764,7 @@ public virtual Pageable GetWebApps(string skipToken = null, string /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -802,7 +802,7 @@ public virtual async Task> GetServerFarmSkusAsync(Cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -840,7 +840,7 @@ public virtual Response GetServerFarmSkus(CancellationToken cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -871,7 +871,7 @@ public virtual AsyncPageable GetUsagesAsync(string filter = null, /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -902,7 +902,7 @@ public virtual Pageable GetUsages(string filter = null, Cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -941,7 +941,7 @@ public virtual async Task RebootWorkerAsync(string workerName, Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionCollection.cs index a7d865f88448a..c463b2b0fbd7b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -109,7 +109,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -154,7 +154,7 @@ public virtual Response Get(stri /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -183,7 +183,7 @@ public virtual AsyncPageable Get /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -212,7 +212,7 @@ public virtual Pageable GetAll(C /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -255,7 +255,7 @@ public virtual async Task> ExistsAsync(string vnetName, Cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -298,7 +298,7 @@ public virtual Response Exists(string vnetName, CancellationToken cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -343,7 +343,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayCollection.cs index fbe4f13d37bd0..e380dc999c24a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayCollection.cs @@ -61,7 +61,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -112,7 +112,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response G /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -296,7 +296,7 @@ public virtual async Task> ExistsAsync(string gatewayName, Cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -339,7 +339,7 @@ public virtual Response Exists(string gatewayName, CancellationToken cance /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -384,7 +384,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayResource.cs index c133f49d82759..f8478e19ff97a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionGatewayResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response G /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -230,7 +230,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs index f9f6ab2791811..8f1452cf4cd17 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServicePlanVirtualNetworkConnectionResource.cs @@ -110,7 +110,7 @@ public virtual AppServicePlanVirtualNetworkConnectionGatewayCollection GetAppSer /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -172,7 +172,7 @@ public virtual Response G /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(Canc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -281,7 +281,7 @@ public virtual AsyncPageable GetRoutesForVnetAsyn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -310,7 +310,7 @@ public virtual Pageable GetRoutesForVnet(Cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -351,7 +351,7 @@ public virtual async Task> CreateOrUpdat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -392,7 +392,7 @@ public virtual Response CreateOrUpdateVnetRoute(s /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -431,7 +431,7 @@ public virtual async Task DeleteVnetRouteAsync(string routeName, Cance /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -470,7 +470,7 @@ public virtual Response DeleteVnetRoute(string routeName, CancellationToken canc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -511,7 +511,7 @@ public virtual async Task> UpdateVnetRou /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlCollection.cs index d28eb31fe3d54..6a7784a39b305 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -116,7 +116,7 @@ public virtual async Task> CreateO /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -167,7 +167,7 @@ public virtual ArmOperation CreateOrUpdate(Wait /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -212,7 +212,7 @@ public virtual async Task> GetAsync(st /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -257,7 +257,7 @@ public virtual Response Get(string sourceContro /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -287,7 +287,7 @@ public virtual AsyncPageable GetAllAsync(Cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -317,7 +317,7 @@ public virtual Pageable GetAll(CancellationToke /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -360,7 +360,7 @@ public virtual async Task> ExistsAsync(string sourceControlType, /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -403,7 +403,7 @@ public virtual Response Exists(string sourceControlType, CancellationToken /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -448,7 +448,7 @@ public virtual async Task> Get /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlResource.cs index fe8c2b25d8ea5..2c57a3cc4fc29 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AppServiceSourceControlResource.cs @@ -99,7 +99,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -139,7 +139,7 @@ public virtual async Task> GetAsync(Ca /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -179,7 +179,7 @@ public virtual Response Get(CancellationToken c /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -227,7 +227,7 @@ public virtual async Task> UpdateA /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ArmAppServiceModelFactory.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ArmAppServiceModelFactory.cs index aac85ad334168..43fef6a1c50ad 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ArmAppServiceModelFactory.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ArmAppServiceModelFactory.cs @@ -45,7 +45,7 @@ public static partial class ArmAppServiceModelFactory /// Reasons why App Service Certificate is not renewable at the current moment. /// Time stamp when the certificate would be auto renewed next. /// Contact info. - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// A new instance for mocking. public static AppServiceCertificateOrderData AppServiceCertificateOrderData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, IDictionary certificates = null, string distinguishedName = null, string domainVerificationToken = null, int? validityInYears = null, int? keySize = null, CertificateProductType? productType = null, bool? isAutoRenew = null, ProvisioningState? provisioningState = null, CertificateOrderStatus? status = null, AppServiceCertificateDetails signedCertificate = null, string csr = null, AppServiceCertificateDetails intermediate = null, AppServiceCertificateDetails root = null, string serialNumber = null, DateTimeOffset? lastCertificateIssuedOn = null, DateTimeOffset? expireOn = null, bool? isPrivateKeyExternal = null, IEnumerable appServiceCertificateNotRenewableReasons = null, DateTimeOffset? nextAutoRenewTimeStamp = null, CertificateOrderContact contact = null, string kind = null) { @@ -202,7 +202,7 @@ public static AppServiceCertificateOrderPatch AppServiceCertificateOrderPatch(Re /// Key Vault resource Id. /// Key Vault secret name. /// Status of the Key Vault secret. - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// A new instance for mocking. public static AppServiceCertificateData AppServiceCertificateData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ResourceIdentifier keyVaultId = null, string keyVaultSecretName = null, KeyVaultSecretStatus? provisioningState = null, string kind = null) { @@ -305,47 +305,21 @@ public static SiteSeal SiteSeal(string html = null) } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. /// Action type. /// Time at which the certificate action was performed. - /// Kind of resource. /// A new instance for mocking. - public static CertificateOrderAction CertificateOrderAction(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CertificateOrderActionType? actionType = null, DateTimeOffset? createdOn = null, string kind = null) + public static CertificateOrderAction CertificateOrderAction(CertificateOrderActionType? actionType = null, DateTimeOffset? createdOn = null) { - return new CertificateOrderAction( - id, - name, - resourceType, - systemData, - actionType, - createdOn, - kind, - serializedAdditionalRawData: null); + return new CertificateOrderAction(actionType, createdOn, serializedAdditionalRawData: null); } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. /// Email id. /// Time stamp. - /// Kind of resource. /// A new instance for mocking. - public static AppServiceCertificateEmail AppServiceCertificateEmail(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string emailId = null, DateTimeOffset? timeStamp = null, string kind = null) + public static AppServiceCertificateEmail AppServiceCertificateEmail(string emailId = null, DateTimeOffset? timeStamp = null) { - return new AppServiceCertificateEmail( - id, - name, - resourceType, - systemData, - emailId, - timeStamp, - kind, - serializedAdditionalRawData: null); + return new AppServiceCertificateEmail(emailId, timeStamp, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -596,7 +570,7 @@ public static DomainAvailabilityCheckResult DomainAvailabilityCheckResult(string /// Azure DNS Zone to use. /// Target DNS type (would be used for migration). /// - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// A new instance for mocking. public static AppServiceDomainData AppServiceDomainData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, RegistrationContactInfo contactAdmin = null, RegistrationContactInfo contactBilling = null, RegistrationContactInfo contactRegistrant = null, RegistrationContactInfo contactTech = null, AppServiceDomainStatus? registrationStatus = null, ProvisioningState? provisioningState = null, IEnumerable nameServers = null, bool? isDomainPrivacyEnabled = null, DateTimeOffset? createdOn = null, DateTimeOffset? expireOn = null, DateTimeOffset? lastRenewedOn = null, bool? isAutoRenew = null, bool? isDnsRecordManagementReady = null, IEnumerable managedHostNames = null, DomainPurchaseConsent consent = null, IEnumerable domainNotRenewableReasons = null, AppServiceDnsType? dnsType = null, string dnsZoneId = null, AppServiceDnsType? targetDnsType = null, string authCode = null, string kind = null) { @@ -808,11 +782,15 @@ public static TldLegalAgreement TldLegalAgreement(string agreementKey = null, st /// Custom settings for changing the behavior of the App Service Environment. /// User added ip ranges to whitelist on ASE db. /// Flag that displays whether an ASE has linux workers or not. + /// Upgrade Preference. /// Dedicated Host Count. /// Whether or not this App Service Environment is zone-redundant. - /// Kind of resource. + /// Full view of the custom domain suffix configuration for ASEv3. + /// Full view of networking configuration for an ASE. + /// Whether an upgrade is available for this App Service Environment. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// A new instance for mocking. - public static AppServiceEnvironmentData AppServiceEnvironmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ProvisioningState? provisioningState = null, HostingEnvironmentStatus? status = null, AppServiceVirtualNetworkProfile virtualNetwork = null, LoadBalancingMode? internalLoadBalancingMode = null, string multiSize = null, int? multiRoleCount = null, int? ipSslAddressCount = null, string dnsSuffix = null, int? maximumNumberOfMachines = null, int? frontEndScaleFactor = null, bool? isSuspended = null, IEnumerable clusterSettings = null, IEnumerable userWhitelistedIPRanges = null, bool? hasLinuxWorkers = null, int? dedicatedHostCount = null, bool? isZoneRedundant = null, string kind = null) + public static AppServiceEnvironmentData AppServiceEnvironmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ProvisioningState? provisioningState = null, HostingEnvironmentStatus? status = null, AppServiceVirtualNetworkProfile virtualNetwork = null, LoadBalancingMode? internalLoadBalancingMode = null, string multiSize = null, int? multiRoleCount = null, int? ipSslAddressCount = null, string dnsSuffix = null, int? maximumNumberOfMachines = null, int? frontEndScaleFactor = null, bool? isSuspended = null, IEnumerable clusterSettings = null, IEnumerable userWhitelistedIPRanges = null, bool? hasLinuxWorkers = null, UpgradePreference? upgradePreference = null, int? dedicatedHostCount = null, bool? isZoneRedundant = null, CustomDnsSuffixConfigurationData customDnsSuffixConfiguration = null, AseV3NetworkingConfigurationData networkingConfiguration = null, UpgradeAvailability? upgradeAvailability = null, string kind = null) { tags ??= new Dictionary(); clusterSettings ??= new List(); @@ -839,8 +817,12 @@ public static AppServiceEnvironmentData AppServiceEnvironmentData(ResourceIdenti clusterSettings?.ToList(), userWhitelistedIPRanges?.ToList(), hasLinuxWorkers, + upgradePreference, dedicatedHostCount, isZoneRedundant, + customDnsSuffixConfiguration, + networkingConfiguration, + upgradeAvailability, kind, serializedAdditionalRawData: null); } @@ -863,10 +845,14 @@ public static AppServiceEnvironmentData AppServiceEnvironmentData(ResourceIdenti /// Custom settings for changing the behavior of the App Service Environment. /// User added ip ranges to whitelist on ASE db. /// Flag that displays whether an ASE has linux workers or not. + /// Upgrade Preference. /// Dedicated Host Count. /// Whether or not this App Service Environment is zone-redundant. + /// Full view of the custom domain suffix configuration for ASEv3. + /// Full view of networking configuration for an ASE. + /// Whether an upgrade is available for this App Service Environment. /// A new instance for mocking. - public static AppServiceEnvironmentProperties AppServiceEnvironmentProperties(ProvisioningState? provisioningState = null, HostingEnvironmentStatus? status = null, AppServiceVirtualNetworkProfile virtualNetwork = null, LoadBalancingMode? internalLoadBalancingMode = null, string multiSize = null, int? multiRoleCount = null, int? ipSslAddressCount = null, string dnsSuffix = null, int? maximumNumberOfMachines = null, int? frontEndScaleFactor = null, bool? isSuspended = null, IEnumerable clusterSettings = null, IEnumerable userWhitelistedIPRanges = null, bool? hasLinuxWorkers = null, int? dedicatedHostCount = null, bool? isZoneRedundant = null) + public static AppServiceEnvironmentProperties AppServiceEnvironmentProperties(ProvisioningState? provisioningState = null, HostingEnvironmentStatus? status = null, AppServiceVirtualNetworkProfile virtualNetwork = null, LoadBalancingMode? internalLoadBalancingMode = null, string multiSize = null, int? multiRoleCount = null, int? ipSslAddressCount = null, string dnsSuffix = null, int? maximumNumberOfMachines = null, int? frontEndScaleFactor = null, bool? isSuspended = null, IEnumerable clusterSettings = null, IEnumerable userWhitelistedIPRanges = null, bool? hasLinuxWorkers = null, UpgradePreference? upgradePreference = null, int? dedicatedHostCount = null, bool? isZoneRedundant = null, CustomDnsSuffixConfigurationData customDnsSuffixConfiguration = null, AseV3NetworkingConfigurationData networkingConfiguration = null, UpgradeAvailability? upgradeAvailability = null) { clusterSettings ??= new List(); userWhitelistedIPRanges ??= new List(); @@ -886,8 +872,12 @@ public static AppServiceEnvironmentProperties AppServiceEnvironmentProperties(Pr clusterSettings?.ToList(), userWhitelistedIPRanges?.ToList(), hasLinuxWorkers, + upgradePreference, dedicatedHostCount, isZoneRedundant, + customDnsSuffixConfiguration, + networkingConfiguration, + upgradeAvailability, serializedAdditionalRawData: null); } @@ -902,6 +892,73 @@ public static AppServiceVirtualNetworkProfile AppServiceVirtualNetworkProfile(Re return new AppServiceVirtualNetworkProfile(id, name, resourceType, subnet, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// + /// The default custom domain suffix to use for all sites deployed on the ASE. + /// The URL referencing the Azure Key Vault certificate secret that should be used as the default SSL/TLS certificate for sites with the custom domain suffix. + /// The user-assigned identity to use for resolving the key vault certificate reference. If not specified, the system-assigned ASE identity will be used if available. + /// Kind of resource. + /// A new instance for mocking. + public static CustomDnsSuffixConfigurationData CustomDnsSuffixConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, CustomDnsSuffixProvisioningState? provisioningState = null, string provisioningDetails = null, string dnsSuffix = null, Uri certificateUri = null, string keyVaultReferenceIdentity = null, string kind = null) + { + return new CustomDnsSuffixConfigurationData( + id, + name, + resourceType, + systemData, + provisioningState, + provisioningDetails, + dnsSuffix, + certificateUri, + keyVaultReferenceIdentity, + kind, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// + /// + /// + /// Property to enable and disable new private endpoint connection creation on ASE. + /// Property to enable and disable FTP on ASEV3. + /// Property to enable and disable Remote Debug on ASEV3. + /// Customer provided Inbound IP Address. Only able to be set on Ase create. + /// Kind of resource. + /// A new instance for mocking. + public static AseV3NetworkingConfigurationData AseV3NetworkingConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable windowsOutboundIPAddresses = null, IEnumerable linuxOutboundIPAddresses = null, IEnumerable externalInboundIPAddresses = null, IEnumerable internalInboundIPAddresses = null, bool? allowNewPrivateEndpointConnections = null, bool? ftpEnabled = null, bool? remoteDebugEnabled = null, string inboundIPAddressOverride = null, string kind = null) + { + windowsOutboundIPAddresses ??= new List(); + linuxOutboundIPAddresses ??= new List(); + externalInboundIPAddresses ??= new List(); + internalInboundIPAddresses ??= new List(); + + return new AseV3NetworkingConfigurationData( + id, + name, + resourceType, + systemData, + windowsOutboundIPAddresses?.ToList(), + linuxOutboundIPAddresses?.ToList(), + externalInboundIPAddresses?.ToList(), + internalInboundIPAddresses?.ToList(), + allowNewPrivateEndpointConnections, + ftpEnabled, + remoteDebugEnabled, + inboundIPAddressOverride, + kind, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -924,11 +981,15 @@ public static AppServiceVirtualNetworkProfile AppServiceVirtualNetworkProfile(Re /// Custom settings for changing the behavior of the App Service Environment. /// User added ip ranges to whitelist on ASE db. /// Flag that displays whether an ASE has linux workers or not. + /// Upgrade Preference. /// Dedicated Host Count. /// Whether or not this App Service Environment is zone-redundant. + /// Full view of the custom domain suffix configuration for ASEv3. + /// Full view of networking configuration for an ASE. + /// Whether an upgrade is available for this App Service Environment. /// Kind of resource. /// A new instance for mocking. - public static AppServiceEnvironmentPatch AppServiceEnvironmentPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProvisioningState? provisioningState = null, HostingEnvironmentStatus? status = null, AppServiceVirtualNetworkProfile virtualNetwork = null, LoadBalancingMode? internalLoadBalancingMode = null, string multiSize = null, int? multiRoleCount = null, int? ipSslAddressCount = null, string dnsSuffix = null, int? maximumNumberOfMachines = null, int? frontEndScaleFactor = null, bool? isSuspended = null, IEnumerable clusterSettings = null, IEnumerable userWhitelistedIPRanges = null, bool? hasLinuxWorkers = null, int? dedicatedHostCount = null, bool? isZoneRedundant = null, string kind = null) + public static AppServiceEnvironmentPatch AppServiceEnvironmentPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProvisioningState? provisioningState = null, HostingEnvironmentStatus? status = null, AppServiceVirtualNetworkProfile virtualNetwork = null, LoadBalancingMode? internalLoadBalancingMode = null, string multiSize = null, int? multiRoleCount = null, int? ipSslAddressCount = null, string dnsSuffix = null, int? maximumNumberOfMachines = null, int? frontEndScaleFactor = null, bool? isSuspended = null, IEnumerable clusterSettings = null, IEnumerable userWhitelistedIPRanges = null, bool? hasLinuxWorkers = null, UpgradePreference? upgradePreference = null, int? dedicatedHostCount = null, bool? isZoneRedundant = null, CustomDnsSuffixConfigurationData customDnsSuffixConfiguration = null, AseV3NetworkingConfigurationData networkingConfiguration = null, UpgradeAvailability? upgradeAvailability = null, string kind = null) { clusterSettings ??= new List(); userWhitelistedIPRanges ??= new List(); @@ -952,8 +1013,12 @@ public static AppServiceEnvironmentPatch AppServiceEnvironmentPatch(ResourceIden clusterSettings?.ToList(), userWhitelistedIPRanges?.ToList(), hasLinuxWorkers, + upgradePreference, dedicatedHostCount, isZoneRedundant, + customDnsSuffixConfiguration, + networkingConfiguration, + upgradeAvailability, kind, serializedAdditionalRawData: null); } @@ -1007,9 +1072,9 @@ public static StampCapacity StampCapacity(string name = null, long? availableCap /// Additional virtual IPs. /// Kind of resource. /// A new instance for mocking. - public static AppServiceEnvironmentAddressResult AppServiceEnvironmentAddressResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IPAddress serviceIPAddress = null, IPAddress internalIPAddress = null, IEnumerable outboundIPAddresses = null, IEnumerable virtualIPMappings = null, string kind = null) + public static AppServiceEnvironmentAddressResult AppServiceEnvironmentAddressResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, System.Net.IPAddress serviceIPAddress = null, System.Net.IPAddress internalIPAddress = null, IEnumerable outboundIPAddresses = null, IEnumerable virtualIPMappings = null, string kind = null) { - outboundIPAddresses ??= new List(); + outboundIPAddresses ??= new List(); virtualIPMappings ??= new List(); return new AppServiceEnvironmentAddressResult( @@ -1025,39 +1090,6 @@ public static AppServiceEnvironmentAddressResult AppServiceEnvironmentAddressRes serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// - /// - /// - /// - /// Property to enable and disable new private endpoint connection creation on ASE. - /// Kind of resource. - /// A new instance for mocking. - public static AseV3NetworkingConfigurationData AseV3NetworkingConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IEnumerable windowsOutboundIPAddresses = null, IEnumerable linuxOutboundIPAddresses = null, IEnumerable externalInboundIPAddresses = null, IEnumerable internalInboundIPAddresses = null, bool? allowNewPrivateEndpointConnections = null, string kind = null) - { - windowsOutboundIPAddresses ??= new List(); - linuxOutboundIPAddresses ??= new List(); - externalInboundIPAddresses ??= new List(); - internalInboundIPAddresses ??= new List(); - - return new AseV3NetworkingConfigurationData( - id, - name, - resourceType, - systemData, - windowsOutboundIPAddresses?.ToList(), - linuxOutboundIPAddresses?.ToList(), - externalInboundIPAddresses?.ToList(), - internalInboundIPAddresses?.ToList(), - allowNewPrivateEndpointConnections, - kind, - serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// Name/identifier of the diagnostics. /// Diagnostics output. @@ -1206,9 +1238,9 @@ public static AppServiceUsage AppServiceUsage(ResourceIdentifier id = null, stri /// Time when operation will expire. /// Applicable only for stamp operation ids. /// A new instance for mocking. - public static AppServiceOperation AppServiceOperation(string id = null, string name = null, AppServiceOperationStatus? status = null, IEnumerable errors = null, DateTimeOffset? createdOn = null, DateTimeOffset? modifiedOn = null, DateTimeOffset? expireOn = null, Guid? geoMasterOperationId = null) + public static AppServiceOperation AppServiceOperation(string id = null, string name = null, AppServiceOperationStatus? status = null, IEnumerable errors = null, DateTimeOffset? createdOn = null, DateTimeOffset? modifiedOn = null, DateTimeOffset? expireOn = null, Guid? geoMasterOperationId = null) { - errors ??= new List(); + errors ??= new List(); return new AppServiceOperation( id, @@ -1250,7 +1282,7 @@ public static AppServiceEndpointDependency AppServiceEndpointDependency(string d /// The time in milliseconds it takes for a TCP connection to be created from the App Service Environment to this IpAddress at this Port. /// Whether it is possible to create a TCP connection from the App Service Environment to this IpAddress at this Port. /// A new instance for mocking. - public static AppServiceEndpointDetail AppServiceEndpointDetail(IPAddress ipAddress = null, int? port = null, double? latency = null, bool? isAccessible = null) + public static AppServiceEndpointDetail AppServiceEndpointDetail(System.Net.IPAddress ipAddress = null, int? port = null, double? latency = null, bool? isAccessible = null) { return new AppServiceEndpointDetail(ipAddress, port, latency, isAccessible, serializedAdditionalRawData: null); } @@ -1266,9 +1298,9 @@ public static AppServiceEndpointDetail AppServiceEndpointDetail(IPAddress ipAddr /// Private IPAddresses mapped to the remote private endpoint. /// Kind of resource. /// A new instance for mocking. - public static RemotePrivateEndpointConnectionARMResourceData RemotePrivateEndpointConnectionARMResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string provisioningState = null, ResourceIdentifier privateEndpointId = null, PrivateLinkConnectionState privateLinkServiceConnectionState = null, IEnumerable ipAddresses = null, string kind = null) + public static RemotePrivateEndpointConnectionARMResourceData RemotePrivateEndpointConnectionARMResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string provisioningState = null, ResourceIdentifier privateEndpointId = null, PrivateLinkConnectionState privateLinkServiceConnectionState = null, IEnumerable ipAddresses = null, string kind = null) { - ipAddresses ??= new List(); + ipAddresses ??= new List(); return new RemotePrivateEndpointConnectionARMResourceData( id, @@ -1283,26 +1315,6 @@ public static RemotePrivateEndpointConnectionARMResourceData RemotePrivateEndpoi serializedAdditionalRawData: null); } - /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. - /// The state of a private link connection. - /// Kind of resource. - /// A new instance for mocking. - public static PrivateLinkConnectionApprovalRequestInfo PrivateLinkConnectionApprovalRequestInfo(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, PrivateLinkConnectionState privateLinkServiceConnectionState = null, string kind = null) - { - return new PrivateLinkConnectionApprovalRequestInfo( - id, - name, - resourceType, - systemData, - privateLinkServiceConnectionState, - kind, - serializedAdditionalRawData: null); - } - /// Initializes a new instance of . /// The id. /// The name. @@ -1348,6 +1360,7 @@ public static AppServicePrivateLinkResourceProperties AppServicePrivateLinkResou /// App Service plan subscription. /// Specification for the App Service Environment to use for the App Service plan. /// Maximum number of instances that can be assigned to this App Service plan. + /// The number of instances that are assigned to this App Service plan. /// Geographical location for the App Service plan. /// /// If <code>true</code>, apps assigned to this App Service plan can be scaled independently. @@ -1371,9 +1384,9 @@ public static AppServicePrivateLinkResourceProperties AppServicePrivateLinkResou /// If <code>true</code>, this App Service Plan will perform availability zone balancing. /// If <code>false</code>, this App Service Plan will not perform availability zone balancing. /// - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// A new instance for mocking. - public static AppServicePlanData AppServicePlanData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AppServiceSkuDescription sku = null, ExtendedLocation extendedLocation = null, string workerTierName = null, AppServicePlanStatus? status = null, string subscription = null, HostingEnvironmentProfile hostingEnvironmentProfile = null, int? maximumNumberOfWorkers = null, string geoRegion = null, bool? isPerSiteScaling = null, bool? isElasticScaleEnabled = null, int? maximumElasticWorkerCount = null, int? numberOfSites = null, bool? isSpot = null, DateTimeOffset? spotExpireOn = null, DateTimeOffset? freeOfferExpireOn = null, string resourceGroup = null, bool? isReserved = null, bool? isXenon = null, bool? isHyperV = null, int? targetWorkerCount = null, int? targetWorkerSizeId = null, ProvisioningState? provisioningState = null, KubeEnvironmentProfile kubeEnvironmentProfile = null, bool? isZoneRedundant = null, string kind = null) + public static AppServicePlanData AppServicePlanData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AppServiceSkuDescription sku = null, ExtendedLocation extendedLocation = null, string workerTierName = null, AppServicePlanStatus? status = null, string subscription = null, HostingEnvironmentProfile hostingEnvironmentProfile = null, int? maximumNumberOfWorkers = null, int? numberOfWorkers = null, string geoRegion = null, bool? isPerSiteScaling = null, bool? isElasticScaleEnabled = null, int? maximumElasticWorkerCount = null, int? numberOfSites = null, bool? isSpot = null, DateTimeOffset? spotExpireOn = null, DateTimeOffset? freeOfferExpireOn = null, string resourceGroup = null, bool? isReserved = null, bool? isXenon = null, bool? isHyperV = null, int? targetWorkerCount = null, int? targetWorkerSizeId = null, ProvisioningState? provisioningState = null, KubeEnvironmentProfile kubeEnvironmentProfile = null, bool? isZoneRedundant = null, string kind = null) { tags ??= new Dictionary(); @@ -1391,6 +1404,7 @@ public static AppServicePlanData AppServicePlanData(ResourceIdentifier id = null subscription, hostingEnvironmentProfile, maximumNumberOfWorkers, + numberOfWorkers, geoRegion, isPerSiteScaling, isElasticScaleEnabled, @@ -1457,7 +1471,16 @@ public static KubeEnvironmentProfile KubeEnvironmentProfile(ResourceIdentifier i /// Obsolete: Hyper-V sandbox. /// Hyper-V sandbox. /// Last time the app was modified, in UTC. Read-only. + /// Property to configure various DNS related settings for a site. + /// Virtual Network Route All enabled. This causes all outbound traffic to have Virtual Network Security Groups and User Defined Routes applied. + /// To enable pulling image over Virtual Network. + /// To enable accessing content over virtual network. + /// To enable Backup and Restore operations over virtual network. /// Configuration of the app. + /// Configuration specific of the Azure Function app. + /// Dapr configuration of the app. + /// Workload profile name for function app to execute on. + /// Function app resource requirements. /// Azure Traffic Manager hostnames associated with the app. Read-only. /// <code>true</code> to stop SCM (KUDU) site when the app is stopped; otherwise, <code>false</code>. The default is <code>false</code>. /// Specifies which deployment slot this app will swap into. Read-only. @@ -1496,15 +1519,19 @@ public static KubeEnvironmentProfile KubeEnvironmentProfile(ResourceIdentifier i /// /// Site redundancy mode. /// Specifies an operation id if this site has a pending operation. + /// Property to allow or block all public traffic. Allowed Values: 'Enabled', 'Disabled' or an empty string. /// Checks if Customer provided storage account is required. /// Identity to use for Key Vault Reference authentication. + /// Specifies the DNL scope of the default hostname. /// /// Azure Resource Manager ID of the Virtual network and subnet to be joined by Regional VNET Integration. /// This must be of the form /subscriptions/{subscriptionName}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{vnetName}/subnets/{subnetName} /// - /// Kind of resource. + /// Azure Resource Manager ID of the customer's selected Managed Environment on which to host this app. This must be of the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}. + /// Current SKU of application based on associated App Service Plan. Some valid SKU values are Free, Shared, Basic, Dynamic, FlexConsumption, Standard, Premium, PremiumV2, PremiumV3, Isolated, IsolatedV2. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// A new instance for mocking. - public static WebSiteData WebSiteData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, ExtendedLocation extendedLocation = null, string state = null, IEnumerable hostNames = null, string repositorySiteName = null, AppServiceUsageState? usageState = null, bool? isEnabled = null, IEnumerable enabledHostNames = null, WebSiteAvailabilityState? availabilityState = null, IEnumerable hostNameSslStates = null, ResourceIdentifier appServicePlanId = null, bool? isReserved = null, bool? isXenon = null, bool? isHyperV = null, DateTimeOffset? lastModifiedTimeUtc = null, SiteConfigProperties siteConfig = null, IEnumerable trafficManagerHostNames = null, bool? isScmSiteAlsoStopped = null, string targetSwapSlot = null, HostingEnvironmentProfile hostingEnvironmentProfile = null, bool? isClientAffinityEnabled = null, bool? isClientCertEnabled = null, ClientCertMode? clientCertMode = null, string clientCertExclusionPaths = null, bool? isHostNameDisabled = null, string customDomainVerificationId = null, string outboundIPAddresses = null, string possibleOutboundIPAddresses = null, int? containerSize = null, int? dailyMemoryTimeQuota = null, DateTimeOffset? suspendOn = null, int? maxNumberOfWorkers = null, CloningInfo cloningInfo = null, string resourceGroup = null, bool? isDefaultContainer = null, string defaultHostName = null, SlotSwapStatus slotSwapStatus = null, bool? isHttpsOnly = null, RedundancyMode? redundancyMode = null, Guid? inProgressOperationId = null, bool? isStorageAccountRequired = null, string keyVaultReferenceIdentity = null, ResourceIdentifier virtualNetworkSubnetId = null, string kind = null) + public static WebSiteData WebSiteData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, ExtendedLocation extendedLocation = null, string state = null, IEnumerable hostNames = null, string repositorySiteName = null, AppServiceUsageState? usageState = null, bool? isEnabled = null, IEnumerable enabledHostNames = null, WebSiteAvailabilityState? availabilityState = null, IEnumerable hostNameSslStates = null, ResourceIdentifier appServicePlanId = null, bool? isReserved = null, bool? isXenon = null, bool? isHyperV = null, DateTimeOffset? lastModifiedTimeUtc = null, SiteDnsConfig dnsConfiguration = null, bool? vnetRouteAllEnabled = null, bool? vnetImagePullEnabled = null, bool? vnetContentShareEnabled = null, bool? vnetBackupRestoreEnabled = null, SiteConfigProperties siteConfig = null, FunctionAppConfig functionAppConfig = null, DaprConfig daprConfig = null, string workloadProfileName = null, ResourceConfig resourceConfig = null, IEnumerable trafficManagerHostNames = null, bool? isScmSiteAlsoStopped = null, string targetSwapSlot = null, HostingEnvironmentProfile hostingEnvironmentProfile = null, bool? isClientAffinityEnabled = null, bool? isClientCertEnabled = null, ClientCertMode? clientCertMode = null, string clientCertExclusionPaths = null, bool? isHostNameDisabled = null, string customDomainVerificationId = null, string outboundIPAddresses = null, string possibleOutboundIPAddresses = null, int? containerSize = null, int? dailyMemoryTimeQuota = null, DateTimeOffset? suspendOn = null, int? maxNumberOfWorkers = null, CloningInfo cloningInfo = null, string resourceGroup = null, bool? isDefaultContainer = null, string defaultHostName = null, SlotSwapStatus slotSwapStatus = null, bool? isHttpsOnly = null, RedundancyMode? redundancyMode = null, Guid? inProgressOperationId = null, string publicNetworkAccess = null, bool? isStorageAccountRequired = null, string keyVaultReferenceIdentity = null, AutoGeneratedDomainNameLabelScope? autoGeneratedDomainNameLabelScope = null, ResourceIdentifier virtualNetworkSubnetId = null, string managedEnvironmentId = null, string sku = null, string kind = null) { tags ??= new Dictionary(); hostNames ??= new List(); @@ -1534,7 +1561,16 @@ public static WebSiteData WebSiteData(ResourceIdentifier id = null, string name isXenon, isHyperV, lastModifiedTimeUtc, + dnsConfiguration, + vnetRouteAllEnabled, + vnetImagePullEnabled, + vnetContentShareEnabled, + vnetBackupRestoreEnabled, siteConfig, + functionAppConfig, + daprConfig, + workloadProfileName, + resourceConfig, trafficManagerHostNames?.ToList(), isScmSiteAlsoStopped, targetSwapSlot, @@ -1559,13 +1595,39 @@ public static WebSiteData WebSiteData(ResourceIdentifier id = null, string name isHttpsOnly, redundancyMode, inProgressOperationId, + publicNetworkAccess, isStorageAccountRequired, keyVaultReferenceIdentity, + autoGeneratedDomainNameLabelScope, virtualNetworkSubnetId, + managedEnvironmentId, + sku, kind, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// List of custom DNS servers to be used by an app for lookups. Maximum 5 dns servers can be set. + /// Alternate DNS server to be used by apps. This property replicates the WEBSITE_DNS_ALT_SERVER app setting. + /// Timeout for a single dns lookup in seconds. Allowed range: 1-30. Default is 3. + /// Total number of retries for dns lookup. Allowed range: 1-5. Default is 3. + /// Custom time for DNS to be cached in seconds. Allowed range: 0-60. Default is 30 seconds. 0 means caching disabled. + /// Indicates that sites using Virtual network custom DNS servers are still sorting the list of DNS servers. Read-Only. + /// A new instance for mocking. + public static SiteDnsConfig SiteDnsConfig(IEnumerable dnsServers = null, string dnsAltServer = null, int? dnsRetryAttemptTimeout = null, int? dnsRetryAttemptCount = null, int? dnsMaxCacheTimeout = null, bool? dnsLegacySortOrder = null) + { + dnsServers ??= new List(); + + return new SiteDnsConfig( + dnsServers?.ToList(), + dnsAltServer, + dnsRetryAttemptTimeout, + dnsRetryAttemptCount, + dnsMaxCacheTimeout, + dnsLegacySortOrder, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// Number of workers. /// Default documents. @@ -1587,6 +1649,7 @@ public static WebSiteData WebSiteData(ResourceIdentifier id = null, string name /// <code>true</code> if detailed error logging is enabled; otherwise, <code>false</code>. /// Publishing user name. /// Application settings. + /// Application metadata. This property cannot be retrieved, since it may contain secrets. /// Connection strings. /// Site MachineKey. /// Handler mappings. @@ -1620,10 +1683,13 @@ public static WebSiteData WebSiteData(ResourceIdentifier id = null, string name /// Explicit Managed Service Identity Id. /// Identity to use for Key Vault Reference authentication. /// IP security restrictions for main. + /// Default action for main access restriction if no rules are matched. /// IP security restrictions for scm. + /// Default action for scm access restriction if no rules are matched. /// IP security restrictions for scm to use main. /// Http20Enabled: configures a web site to allow clients to connect over http2.0. /// MinTlsVersion: configures the minimum version of TLS required for SSL requests. + /// The minimum strength TLS cipher suite allowed for an application. /// ScmMinTlsVersion: configures the minimum version of TLS required for SSL requests for SCM site. /// State of FTP / FTPS service. /// @@ -1634,6 +1700,10 @@ public static WebSiteData WebSiteData(ResourceIdentifier id = null, string name /// Maximum number of workers that a site can scale out to. /// This setting only applies to the Consumption and Elastic Premium Plans /// + /// + /// Maximum number of workers that a site can scale out to. + /// This setting only applies to apps in plans where ElasticScaleEnabled is <code>true</code> + /// /// Health check path. /// /// Gets or sets a value indicating whether functions runtime scale monitoring is enabled. When enabled, @@ -1648,10 +1718,11 @@ public static WebSiteData WebSiteData(ResourceIdentifier id = null, string name /// List of Azure Storage Accounts. /// Property to allow or block all public traffic. /// A new instance for mocking. - public static SiteConfigProperties SiteConfigProperties(int? numberOfWorkers = null, IEnumerable defaultDocuments = null, string netFrameworkVersion = null, string phpVersion = null, string pythonVersion = null, string nodeVersion = null, string powerShellVersion = null, string linuxFxVersion = null, string windowsFxVersion = null, bool? isRequestTracingEnabled = null, DateTimeOffset? requestTracingExpirationOn = null, bool? isRemoteDebuggingEnabled = null, string remoteDebuggingVersion = null, bool? isHttpLoggingEnabled = null, bool? useManagedIdentityCreds = null, string acrUserManagedIdentityId = null, int? logsDirectorySizeLimit = null, bool? isDetailedErrorLoggingEnabled = null, string publishingUsername = null, IEnumerable appSettings = null, IEnumerable connectionStrings = null, SiteMachineKey machineKey = null, IEnumerable handlerMappings = null, string documentRoot = null, ScmType? scmType = null, bool? use32BitWorkerProcess = null, bool? isWebSocketsEnabled = null, bool? isAlwaysOn = null, string javaVersion = null, string javaContainer = null, string javaContainerVersion = null, string appCommandLine = null, ManagedPipelineMode? managedPipelineMode = null, IEnumerable virtualApplications = null, SiteLoadBalancing? loadBalancing = null, IEnumerable experimentsRampUpRules = null, SiteLimits limits = null, bool? isAutoHealEnabled = null, AutoHealRules autoHealRules = null, string tracingOptions = null, string vnetName = null, bool? isVnetRouteAllEnabled = null, int? vnetPrivatePortsCount = null, AppServiceCorsSettings cors = null, WebAppPushSettings push = null, Uri apiDefinitionUri = null, string apiManagementConfigId = null, string autoSwapSlotName = null, bool? isLocalMySqlEnabled = null, int? managedServiceIdentityId = null, int? xManagedServiceIdentityId = null, string keyVaultReferenceIdentity = null, IEnumerable ipSecurityRestrictions = null, IEnumerable scmIPSecurityRestrictions = null, bool? allowIPSecurityRestrictionsForScmToUseMain = null, bool? isHttp20Enabled = null, AppServiceSupportedTlsVersion? minTlsVersion = null, AppServiceSupportedTlsVersion? scmMinTlsVersion = null, AppServiceFtpsState? ftpsState = null, int? preWarmedInstanceCount = null, int? functionAppScaleLimit = null, string healthCheckPath = null, bool? isFunctionsRuntimeScaleMonitoringEnabled = null, string websiteTimeZone = null, int? minimumElasticInstanceCount = null, IDictionary azureStorageAccounts = null, string publicNetworkAccess = null) + public static SiteConfigProperties SiteConfigProperties(int? numberOfWorkers = null, IEnumerable defaultDocuments = null, string netFrameworkVersion = null, string phpVersion = null, string pythonVersion = null, string nodeVersion = null, string powerShellVersion = null, string linuxFxVersion = null, string windowsFxVersion = null, bool? isRequestTracingEnabled = null, DateTimeOffset? requestTracingExpirationOn = null, bool? isRemoteDebuggingEnabled = null, string remoteDebuggingVersion = null, bool? isHttpLoggingEnabled = null, bool? useManagedIdentityCreds = null, string acrUserManagedIdentityId = null, int? logsDirectorySizeLimit = null, bool? isDetailedErrorLoggingEnabled = null, string publishingUsername = null, IEnumerable appSettings = null, IEnumerable metadata = null, IEnumerable connectionStrings = null, SiteMachineKey machineKey = null, IEnumerable handlerMappings = null, string documentRoot = null, ScmType? scmType = null, bool? use32BitWorkerProcess = null, bool? isWebSocketsEnabled = null, bool? isAlwaysOn = null, string javaVersion = null, string javaContainer = null, string javaContainerVersion = null, string appCommandLine = null, ManagedPipelineMode? managedPipelineMode = null, IEnumerable virtualApplications = null, SiteLoadBalancing? loadBalancing = null, IEnumerable experimentsRampUpRules = null, SiteLimits limits = null, bool? isAutoHealEnabled = null, AutoHealRules autoHealRules = null, string tracingOptions = null, string vnetName = null, bool? isVnetRouteAllEnabled = null, int? vnetPrivatePortsCount = null, AppServiceCorsSettings cors = null, WebAppPushSettings push = null, Uri apiDefinitionUri = null, string apiManagementConfigId = null, string autoSwapSlotName = null, bool? isLocalMySqlEnabled = null, int? managedServiceIdentityId = null, int? xManagedServiceIdentityId = null, string keyVaultReferenceIdentity = null, IEnumerable ipSecurityRestrictions = null, DefaultAction? ipSecurityRestrictionsDefaultAction = null, IEnumerable scmIPSecurityRestrictions = null, DefaultAction? scmIPSecurityRestrictionsDefaultAction = null, bool? allowIPSecurityRestrictionsForScmToUseMain = null, bool? isHttp20Enabled = null, AppServiceSupportedTlsVersion? minTlsVersion = null, TlsCipherSuite? minTlsCipherSuite = null, AppServiceSupportedTlsVersion? scmMinTlsVersion = null, AppServiceFtpsState? ftpsState = null, int? preWarmedInstanceCount = null, int? functionAppScaleLimit = null, int? elasticWebAppScaleLimit = null, string healthCheckPath = null, bool? isFunctionsRuntimeScaleMonitoringEnabled = null, string websiteTimeZone = null, int? minimumElasticInstanceCount = null, IDictionary azureStorageAccounts = null, string publicNetworkAccess = null) { defaultDocuments ??= new List(); appSettings ??= new List(); + metadata ??= new List(); connectionStrings ??= new List(); handlerMappings ??= new List(); virtualApplications ??= new List(); @@ -1681,6 +1752,7 @@ public static SiteConfigProperties SiteConfigProperties(int? numberOfWorkers = n isDetailedErrorLoggingEnabled, publishingUsername, appSettings?.ToList(), + metadata?.ToList(), connectionStrings?.ToList(), machineKey, handlerMappings?.ToList(), @@ -1714,14 +1786,18 @@ public static SiteConfigProperties SiteConfigProperties(int? numberOfWorkers = n xManagedServiceIdentityId, keyVaultReferenceIdentity, ipSecurityRestrictions?.ToList(), + ipSecurityRestrictionsDefaultAction, scmIPSecurityRestrictions?.ToList(), + scmIPSecurityRestrictionsDefaultAction, allowIPSecurityRestrictionsForScmToUseMain, isHttp20Enabled, minTlsVersion, + minTlsCipherSuite, scmMinTlsVersion, ftpsState, preWarmedInstanceCount, functionAppScaleLimit, + elasticWebAppScaleLimit, healthCheckPath, isFunctionsRuntimeScaleMonitoringEnabled, websiteTimeZone, @@ -1780,8 +1856,9 @@ public static WebAppPushSettings WebAppPushSettings(ResourceIdentifier id = null /// Access key for the storage account. /// Path to mount the storage within the site's runtime environment. /// State of the storage account. + /// Mounting protocol to use for the storage account. /// A new instance for mocking. - public static AppServiceStorageAccessInfo AppServiceStorageAccessInfo(AppServiceStorageType? storageType = null, string accountName = null, string shareName = null, string accessKey = null, string mountPath = null, AppServiceStorageAccountState? state = null) + public static AppServiceStorageAccessInfo AppServiceStorageAccessInfo(AppServiceStorageType? storageType = null, string accountName = null, string shareName = null, string accessKey = null, string mountPath = null, AppServiceStorageAccountState? state = null, AzureStorageProtocol? protocol = null) { return new AppServiceStorageAccessInfo( storageType, @@ -1790,6 +1867,7 @@ public static AppServiceStorageAccessInfo AppServiceStorageAccessInfo(AppService accessKey, mountPath, state, + protocol, serializedAdditionalRawData: null); } @@ -1840,6 +1918,7 @@ public static LocalizableString LocalizableString(string value = null, string lo /// App Service plan subscription. /// Specification for the App Service Environment to use for the App Service plan. /// Maximum number of instances that can be assigned to this App Service plan. + /// The number of instances that are assigned to this App Service plan. /// Geographical location for the App Service plan. /// /// If <code>true</code>, apps assigned to this App Service plan can be scaled independently. @@ -1865,7 +1944,7 @@ public static LocalizableString LocalizableString(string value = null, string lo /// /// Kind of resource. /// A new instance for mocking. - public static AppServicePlanPatch AppServicePlanPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string workerTierName = null, AppServicePlanStatus? status = null, string subscription = null, HostingEnvironmentProfile hostingEnvironmentProfile = null, int? maximumNumberOfWorkers = null, string geoRegion = null, bool? isPerSiteScaling = null, bool? isElasticScaleEnabled = null, int? maximumElasticWorkerCount = null, int? numberOfSites = null, bool? isSpot = null, DateTimeOffset? spotExpirationOn = null, DateTimeOffset? freeOfferExpirationOn = null, string resourceGroup = null, bool? isReserved = null, bool? isXenon = null, bool? isHyperV = null, int? targetWorkerCount = null, int? targetWorkerSizeId = null, ProvisioningState? provisioningState = null, KubeEnvironmentProfile kubeEnvironmentProfile = null, bool? isZoneRedundant = null, string kind = null) + public static AppServicePlanPatch AppServicePlanPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string workerTierName = null, AppServicePlanStatus? status = null, string subscription = null, HostingEnvironmentProfile hostingEnvironmentProfile = null, int? maximumNumberOfWorkers = null, int? numberOfWorkers = null, string geoRegion = null, bool? isPerSiteScaling = null, bool? isElasticScaleEnabled = null, int? maximumElasticWorkerCount = null, int? numberOfSites = null, bool? isSpot = null, DateTimeOffset? spotExpirationOn = null, DateTimeOffset? freeOfferExpirationOn = null, string resourceGroup = null, bool? isReserved = null, bool? isXenon = null, bool? isHyperV = null, int? targetWorkerCount = null, int? targetWorkerSizeId = null, ProvisioningState? provisioningState = null, KubeEnvironmentProfile kubeEnvironmentProfile = null, bool? isZoneRedundant = null, string kind = null) { return new AppServicePlanPatch( id, @@ -1877,6 +1956,7 @@ public static AppServicePlanPatch AppServicePlanPatch(ResourceIdentifier id = nu subscription, hostingEnvironmentProfile, maximumNumberOfWorkers, + numberOfWorkers, geoRegion, isPerSiteScaling, isElasticScaleEnabled, @@ -2124,7 +2204,7 @@ public static AppServiceVirtualNetworkGatewayData AppServiceVirtualNetworkGatewa /// Resource ID of the associated App Service plan, formatted as: "/subscriptions/{subscriptionID}/resourceGroups/{groupName}/providers/Microsoft.Web/serverfarms/{appServicePlanName}". /// CNAME of the certificate to be issued via free certificate. /// Method of domain validation for free cert. - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// A new instance for mocking. public static AppCertificateData AppCertificateData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string password = null, string friendlyName = null, string subjectName = null, IEnumerable hostNames = null, byte[] pfxBlob = null, string siteName = null, string selfLink = null, string issuer = null, DateTimeOffset? issueOn = null, DateTimeOffset? expireOn = null, string thumbprintString = null, bool? isValid = null, byte[] cerBlob = null, string publicKeyHash = null, HostingEnvironmentProfile hostingEnvironmentProfile = null, ResourceIdentifier keyVaultId = null, string keyVaultSecretName = null, KeyVaultSecretStatus? keyVaultSecretStatus = null, ResourceIdentifier serverFarmId = null, string canonicalName = null, string domainValidationMethod = null, string kind = null) { @@ -2225,6 +2305,122 @@ public static AppCertificatePatch AppCertificatePatch(ResourceIdentifier id = nu serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Provisioning state of the Container App. + /// Resource ID of the Container App's KubeEnvironment. + /// Name of the latest revision of the Container App. + /// Fully Qualified Domain Name of the latest revision of the Container App. + /// Non versioned Container App configuration properties. + /// Container App versioned application definition. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. + /// A new instance for mocking. + public static ContainerAppData ContainerAppData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ContainerAppProvisioningState? provisioningState = null, string kubeEnvironmentId = null, string latestRevisionName = null, string latestRevisionFqdn = null, Configuration configuration = null, Template template = null, string kind = null) + { + tags ??= new Dictionary(); + + return new ContainerAppData( + id, + name, + resourceType, + systemData, + tags, + location, + provisioningState, + kubeEnvironmentId, + latestRevisionName, + latestRevisionFqdn, + configuration, + template, + kind, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Hostname. + /// Bool indicating if app exposes an external http endpoint. + /// Target Port in containers for traffic from ingress. + /// Ingress transport protocol. + /// + /// Bool indicating if HTTP connections to is allowed. If set to false HTTP connections are automatically redirected to HTTPS connections. + /// A new instance for mocking. + public static Ingress Ingress(string fqdn = null, bool? external = null, int? targetPort = null, IngressTransportMethod? transport = null, IEnumerable traffic = null, bool? allowInsecure = null) + { + traffic ??= new List(); + + return new Ingress( + fqdn, + external, + targetPort, + transport, + traffic?.ToList(), + allowInsecure, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Secret Name. + /// Secret Value. + /// A new instance for mocking. + public static ContainerAppSecret ContainerAppSecret(string name = null, string value = null) + { + return new ContainerAppSecret(name, value, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// + /// Timestamp describing when the revision was created + /// by controller + /// + /// Fully qualified domain name of the revision. + /// + /// Container App Revision Template with all possible settings and the + /// defaults if user did not provide them. The defaults are populated + /// as they were at the creation time + /// + /// Boolean describing if the Revision is Active. + /// Number of pods currently running for this revision. + /// Traffic weight assigned to this revision. + /// Optional Field - Platform Error Message. + /// Current health State of the revision. + /// Current provisioning State of the revision. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. + /// A new instance for mocking. + public static RevisionData RevisionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DateTimeOffset? createdOn = null, string fqdn = null, Template template = null, bool? active = null, int? replicas = null, int? trafficWeight = null, string provisioningError = null, RevisionHealthState? healthState = null, RevisionProvisioningState? provisioningState = null, string kind = null) + { + tags ??= new Dictionary(); + + return new RevisionData( + id, + name, + resourceType, + systemData, + tags, + location, + createdOn, + fqdn, + template, + active, + replicas, + trafficWeight, + provisioningError, + healthState, + provisioningState, + kind, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -2439,6 +2635,7 @@ public static AppSnapshot AppSnapshot(ResourceIdentifier id = null, string name /// Only visible within Vnet/Subnet. /// Default Domain Name for the cluster. /// Static IP of the KubeEnvironment. + /// Type of Kubernetes Environment. Only supported for Container App Environments with value as Managed. /// /// Cluster configuration which determines the ARC cluster /// components types. Eg: Choosing between BuildService kind, @@ -2449,10 +2646,11 @@ public static AppSnapshot AppSnapshot(ResourceIdentifier id = null, string name /// app logs to a destination. Currently only "log-analytics" is /// supported /// + /// Cluster configuration for Container Apps Environments to configure Dapr Instrumentation Key and VNET Configuration. /// - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// A new instance for mocking. - public static KubeEnvironmentData KubeEnvironmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ExtendedLocation extendedLocation = null, KubeEnvironmentProvisioningState? provisioningState = null, string deploymentErrors = null, bool? isInternalLoadBalancerEnabled = null, string defaultDomain = null, string staticIP = null, ArcConfiguration arcConfiguration = null, AppLogsConfiguration appLogsConfiguration = null, ResourceIdentifier aksResourceId = null, string kind = null) + public static KubeEnvironmentData KubeEnvironmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ExtendedLocation extendedLocation = null, KubeEnvironmentProvisioningState? provisioningState = null, string deploymentErrors = null, bool? isInternalLoadBalancerEnabled = null, string defaultDomain = null, string staticIP = null, string environmentType = null, ArcConfiguration arcConfiguration = null, AppLogsConfiguration appLogsConfiguration = null, ContainerAppsConfiguration containerAppsConfiguration = null, ResourceIdentifier aksResourceId = null, string kind = null) { tags ??= new Dictionary(); @@ -2469,8 +2667,10 @@ public static KubeEnvironmentData KubeEnvironmentData(ResourceIdentifier id = nu isInternalLoadBalancerEnabled, defaultDomain, staticIP, + environmentType, arcConfiguration, appLogsConfiguration, + containerAppsConfiguration, aksResourceId, kind, serializedAdditionalRawData: null); @@ -2496,10 +2696,11 @@ public static KubeEnvironmentData KubeEnvironmentData(ResourceIdentifier id = nu /// app logs to a destination. Currently only "log-analytics" is /// supported /// + /// Cluster configuration for Container Apps Environments to configure Dapr Instrumentation Key and VNET Configuration. /// /// Kind of resource. /// A new instance for mocking. - public static KubeEnvironmentPatch KubeEnvironmentPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, KubeEnvironmentProvisioningState? provisioningState = null, string deploymentErrors = null, bool? isInternalLoadBalancerEnabled = null, string defaultDomain = null, string staticIP = null, ArcConfiguration arcConfiguration = null, AppLogsConfiguration appLogsConfiguration = null, ResourceIdentifier aksResourceId = null, string kind = null) + public static KubeEnvironmentPatch KubeEnvironmentPatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, KubeEnvironmentProvisioningState? provisioningState = null, string deploymentErrors = null, bool? isInternalLoadBalancerEnabled = null, string defaultDomain = null, string staticIP = null, ArcConfiguration arcConfiguration = null, AppLogsConfiguration appLogsConfiguration = null, ContainerAppsConfiguration containerAppsConfiguration = null, ResourceIdentifier aksResourceId = null, string kind = null) { return new KubeEnvironmentPatch( id, @@ -2513,6 +2714,7 @@ public static KubeEnvironmentPatch KubeEnvironmentPatch(ResourceIdentifier id = staticIP, arcConfiguration, appLogsConfiguration, + containerAppsConfiguration, aksResourceId, kind, serializedAdditionalRawData: null); @@ -3046,10 +3248,11 @@ public static AppServiceBillingMeter AppServiceBillingMeter(ResourceIdentifier i /// Resource name to verify. /// Resource type used for verification. /// Is fully qualified domain name. + /// Azure Resource Manager ID of the customer's selected Container Apps Environment on which to host the Function app. This must be of the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}. /// A new instance for mocking. - public static ResourceNameAvailabilityContent ResourceNameAvailabilityContent(string name = null, CheckNameResourceType resourceType = default, bool? isFqdn = null) + public static ResourceNameAvailabilityContent ResourceNameAvailabilityContent(string name = null, CheckNameResourceType resourceType = default, bool? isFqdn = null, string environmentId = null) { - return new ResourceNameAvailabilityContent(name, resourceType, isFqdn, serializedAdditionalRawData: null); + return new ResourceNameAvailabilityContent(name, resourceType, isFqdn, environmentId, serializedAdditionalRawData: null); } /// Initializes a new instance of . @@ -3062,6 +3265,52 @@ public static ResourceNameAvailability ResourceNameAvailability(bool? isNameAvai return new ResourceNameAvailability(isNameAvailable, reason, message, serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// + /// + /// Kind of resource. + /// A new instance for mocking. + public static CustomHostnameSites CustomHostnameSites(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string customHostname = null, string region = null, IEnumerable siteResourceIds = null, string kind = null) + { + siteResourceIds ??= new List(); + + return new CustomHostnameSites( + id, + name, + resourceType, + systemData, + customHostname, + region, + siteResourceIds?.ToList(), + kind, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// String representation of the identity. + /// Kind of resource. + /// A new instance for mocking. + public static AppServiceIdentifierData AppServiceIdentifierData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string value = null, string kind = null) + { + return new AppServiceIdentifierData( + id, + name, + resourceType, + systemData, + value, + kind, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// Available regions. /// Available App Service Environments with full descriptions of the environments. @@ -3109,22 +3358,35 @@ public static HostingEnvironmentDeploymentInfo HostingEnvironmentDeploymentInfo( return new HostingEnvironmentDeploymentInfo(name, location, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// String representation of the identity. + /// Display name for region. + /// Is region standard. + /// Dedicated host enabled. + /// Zone redundant deployment enabled. + /// Available Skus in region. + /// Available OSs in region. /// Kind of resource. - /// A new instance for mocking. - public static AppServiceIdentifierData AppServiceIdentifierData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string value = null, string kind = null) + /// A new instance for mocking. + public static AseRegion AseRegion(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, bool? standard = null, bool? dedicatedHost = null, bool? zoneRedundant = null, IEnumerable availableSku = null, IEnumerable availableOS = null, string kind = null) { - return new AppServiceIdentifierData( + availableSku ??= new List(); + availableOS ??= new List(); + + return new AseRegion( id, name, resourceType, systemData, - value, + displayName, + standard, + dedicatedHost, + zoneRedundant, + availableSku?.ToList(), + availableOS?.ToList(), kind, serializedAdditionalRawData: null); } @@ -3408,15 +3670,21 @@ public static StaticSitesWorkflowPreview StaticSitesWorkflowPreview(ResourceIden /// The content distribution endpoint for the static site. /// Identity to use for Key Vault Reference authentication. /// User provided function apps registered with the static site. + /// Backends linked to the static side. /// The provider that submitted the last deployment to the primary environment of the static site. - /// Kind of resource. + /// State indicating the status of the enterprise grade CDN serving traffic to the static web app. + /// State indicating whether public traffic are allowed or not for a static web app. Allowed Values: 'Enabled', 'Disabled' or an empty string. + /// Database connections for the static site. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// A new instance for mocking. - public static StaticSiteData StaticSiteData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AppServiceSkuDescription sku = null, ManagedServiceIdentity identity = null, string defaultHostname = null, Uri repositoryUri = null, string branch = null, IEnumerable customDomains = null, string repositoryToken = null, StaticSiteBuildProperties buildProperties = null, IEnumerable privateEndpointConnections = null, StagingEnvironmentPolicy? stagingEnvironmentPolicy = null, bool? allowConfigFileUpdates = null, StaticSiteTemplate templateProperties = null, string contentDistributionEndpoint = null, string keyVaultReferenceIdentity = null, IEnumerable userProvidedFunctionApps = null, string provider = null, string kind = null) + public static StaticSiteData StaticSiteData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AppServiceSkuDescription sku = null, ManagedServiceIdentity identity = null, string defaultHostname = null, Uri repositoryUri = null, string branch = null, IEnumerable customDomains = null, string repositoryToken = null, StaticSiteBuildProperties buildProperties = null, IEnumerable privateEndpointConnections = null, StagingEnvironmentPolicy? stagingEnvironmentPolicy = null, bool? allowConfigFileUpdates = null, StaticSiteTemplate templateProperties = null, string contentDistributionEndpoint = null, string keyVaultReferenceIdentity = null, IEnumerable userProvidedFunctionApps = null, IEnumerable linkedBackends = null, string provider = null, EnterpriseGradeCdnStatus? enterpriseGradeCdnStatus = null, string publicNetworkAccess = null, IEnumerable databaseConnections = null, string kind = null) { tags ??= new Dictionary(); customDomains ??= new List(); privateEndpointConnections ??= new List(); userProvidedFunctionApps ??= new List(); + linkedBackends ??= new List(); + databaseConnections ??= new List(); return new StaticSiteData( id, @@ -3440,7 +3708,11 @@ public static StaticSiteData StaticSiteData(ResourceIdentifier id = null, string contentDistributionEndpoint, keyVaultReferenceIdentity, userProvidedFunctionApps?.ToList(), + linkedBackends?.ToList(), provider, + enterpriseGradeCdnStatus, + publicNetworkAccess, + databaseConnections?.ToList(), kind, serializedAdditionalRawData: null); } @@ -3460,7 +3732,7 @@ public static StaticSiteData StaticSiteData(ResourceIdentifier id = null, string /// MSI resource. /// Logical Availability Zones the service is hosted in. /// A new instance for mocking. - public static ResponseMessageEnvelopeRemotePrivateEndpointConnection ResponseMessageEnvelopeRemotePrivateEndpointConnection(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, IReadOnlyDictionary tags = null, AppServiceArmPlan plan = null, RemotePrivateEndpointConnection properties = null, AppServiceSkuDescription sku = null, string status = null, ResponseError error = null, ManagedServiceIdentity identity = null, IEnumerable zones = null) + public static ResponseMessageEnvelopeRemotePrivateEndpointConnection ResponseMessageEnvelopeRemotePrivateEndpointConnection(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, IReadOnlyDictionary tags = null, AppServiceArmPlan plan = null, RemotePrivateEndpointConnection properties = null, AppServiceSkuDescription sku = null, string status = null, ErrorEntity error = null, ManagedServiceIdentity identity = null, IEnumerable zones = null) { tags ??= new Dictionary(); zones ??= new List(); @@ -3511,9 +3783,9 @@ public static AppServiceArmPlan AppServiceArmPlan(string name = null, string pub /// Private IPAddresses mapped to the remote private endpoint. /// Kind of resource. /// A new instance for mocking. - public static RemotePrivateEndpointConnection RemotePrivateEndpointConnection(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string provisioningState = null, ResourceIdentifier privateEndpointId = null, PrivateLinkConnectionState privateLinkServiceConnectionState = null, IEnumerable ipAddresses = null, string kind = null) + public static RemotePrivateEndpointConnection RemotePrivateEndpointConnection(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string provisioningState = null, ResourceIdentifier privateEndpointId = null, PrivateLinkConnectionState privateLinkServiceConnectionState = null, IEnumerable ipAddresses = null, string kind = null) { - ipAddresses ??= new List(); + ipAddresses ??= new List(); return new RemotePrivateEndpointConnection( id, @@ -3552,6 +3824,47 @@ public static StaticSiteUserProvidedFunctionAppData StaticSiteUserProvidedFuncti serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The resource id of the backend linked to the static site. + /// The region of the backend linked to the static site. + /// The date and time on which the backend was linked to the static site. + /// The provisioning state of the linking process. + /// A new instance for mocking. + public static StaticSiteLinkedBackend StaticSiteLinkedBackend(string backendResourceId = null, string region = null, DateTimeOffset? createdOn = null, string provisioningState = null) + { + return new StaticSiteLinkedBackend(backendResourceId, region, createdOn, provisioningState, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The resource id of the database. + /// If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. + /// The region of the database resource. + /// A list of configuration files associated with this database connection. + /// If present, the name of this database connection resource. + /// A new instance for mocking. + public static DatabaseConnectionOverview DatabaseConnectionOverview(string resourceId = null, string connectionIdentity = null, string region = null, IEnumerable configurationFiles = null, string name = null) + { + configurationFiles ??= new List(); + + return new DatabaseConnectionOverview( + resourceId, + connectionIdentity, + region, + configurationFiles?.ToList(), + name, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the configuration file. + /// The Base64 encoding of the file contents. + /// The type of configuration file. + /// A new instance for mocking. + public static StaticSiteDatabaseConnectionConfigurationFileOverview StaticSiteDatabaseConnectionConfigurationFileOverview(string fileName = null, string contents = null, string staticSiteDatabaseConnectionConfigurationFileOverviewType = null) + { + return new StaticSiteDatabaseConnectionConfigurationFileOverview(fileName, contents, staticSiteDatabaseConnectionConfigurationFileOverviewType, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -3570,14 +3883,20 @@ public static StaticSiteUserProvidedFunctionAppData StaticSiteUserProvidedFuncti /// The content distribution endpoint for the static site. /// Identity to use for Key Vault Reference authentication. /// User provided function apps registered with the static site. + /// Backends linked to the static side. /// The provider that submitted the last deployment to the primary environment of the static site. + /// State indicating the status of the enterprise grade CDN serving traffic to the static web app. + /// State indicating whether public traffic are allowed or not for a static web app. Allowed Values: 'Enabled', 'Disabled' or an empty string. + /// Database connections for the static site. /// Kind of resource. /// A new instance for mocking. - public static StaticSitePatch StaticSitePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string defaultHostname = null, Uri repositoryUri = null, string branch = null, IEnumerable customDomains = null, string repositoryToken = null, StaticSiteBuildProperties buildProperties = null, IEnumerable privateEndpointConnections = null, StagingEnvironmentPolicy? stagingEnvironmentPolicy = null, bool? allowConfigFileUpdates = null, StaticSiteTemplate templateProperties = null, string contentDistributionEndpoint = null, string keyVaultReferenceIdentity = null, IEnumerable userProvidedFunctionApps = null, string provider = null, string kind = null) + public static StaticSitePatch StaticSitePatch(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string defaultHostname = null, Uri repositoryUri = null, string branch = null, IEnumerable customDomains = null, string repositoryToken = null, StaticSiteBuildProperties buildProperties = null, IEnumerable privateEndpointConnections = null, StagingEnvironmentPolicy? stagingEnvironmentPolicy = null, bool? allowConfigFileUpdates = null, StaticSiteTemplate templateProperties = null, string contentDistributionEndpoint = null, string keyVaultReferenceIdentity = null, IEnumerable userProvidedFunctionApps = null, IEnumerable linkedBackends = null, string provider = null, EnterpriseGradeCdnStatus? enterpriseGradeCdnStatus = null, string publicNetworkAccess = null, IEnumerable databaseConnections = null, string kind = null) { customDomains ??= new List(); privateEndpointConnections ??= new List(); userProvidedFunctionApps ??= new List(); + linkedBackends ??= new List(); + databaseConnections ??= new List(); return new StaticSitePatch( id, @@ -3597,7 +3916,11 @@ public static StaticSitePatch StaticSitePatch(ResourceIdentifier id = null, stri contentDistributionEndpoint, keyVaultReferenceIdentity, userProvidedFunctionApps?.ToList(), + linkedBackends?.ToList(), provider, + enterpriseGradeCdnStatus, + publicNetworkAccess, + databaseConnections?.ToList(), kind, serializedAdditionalRawData: null); } @@ -3641,11 +3964,15 @@ public static StaticSiteUser StaticSiteUser(ResourceIdentifier id = null, string /// When this build was updated. /// The status of the static site build. /// User provided function apps registered with the static site build. + /// Backends linked to the static side build. + /// Database connections for the static site build. /// Kind of resource. /// A new instance for mocking. - public static StaticSiteBuildData StaticSiteBuildData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string buildId = null, string sourceBranch = null, string pullRequestTitle = null, string hostname = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastUpdatedOn = null, StaticSiteBuildStatus? status = null, IEnumerable userProvidedFunctionApps = null, string kind = null) + public static StaticSiteBuildData StaticSiteBuildData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string buildId = null, string sourceBranch = null, string pullRequestTitle = null, string hostname = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastUpdatedOn = null, StaticSiteBuildStatus? status = null, IEnumerable userProvidedFunctionApps = null, IEnumerable linkedBackends = null, IEnumerable databaseConnections = null, string kind = null) { userProvidedFunctionApps ??= new List(); + linkedBackends ??= new List(); + databaseConnections ??= new List(); return new StaticSiteBuildData( id, @@ -3660,6 +3987,8 @@ public static StaticSiteBuildData StaticSiteBuildData(ResourceIdentifier id = nu lastUpdatedOn, status, userProvidedFunctionApps?.ToList(), + linkedBackends?.ToList(), + databaseConnections?.ToList(), kind, serializedAdditionalRawData: null); } @@ -3686,29 +4015,59 @@ public static AppServiceConfigurationDictionary AppServiceConfigurationDictionar serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The name for the function. - /// The trigger type of the function. + /// The resource id of the database. + /// If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. + /// The connection string to use to connect to the database. + /// The region of the database resource. + /// A list of configuration files associated with this database connection. /// Kind of resource. - /// A new instance for mocking. - public static StaticSiteFunctionOverview StaticSiteFunctionOverview(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string functionName = null, FunctionTriggerType? triggerType = null, string kind = null) + /// A new instance for mocking. + public static DatabaseConnectionData DatabaseConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string resourceId = null, string connectionIdentity = null, string connectionString = null, string region = null, IEnumerable configurationFiles = null, string kind = null) { - return new StaticSiteFunctionOverview( + configurationFiles ??= new List(); + + return new DatabaseConnectionData( id, name, resourceType, systemData, - functionName, - triggerType, + resourceId, + connectionIdentity, + connectionString, + region, + configurationFiles?.ToList(), kind, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The name for the function. + /// The trigger type of the function. + /// Kind of resource. + /// A new instance for mocking. + public static StaticSiteFunctionOverview StaticSiteFunctionOverview(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string functionName = null, FunctionTriggerType? triggerType = null, string kind = null) + { + return new StaticSiteFunctionOverview( + id, + name, + resourceType, + systemData, + functionName, + triggerType, + kind, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -3736,6 +4095,36 @@ public static StaticSiteZipDeployment StaticSiteZipDeployment(ResourceIdentifier serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The password for basic auth. + /// Url to the secret in Key Vault. + /// State indicating if basic auth is enabled and for what environments it is active. + /// The list of enabled environments for Basic Auth if ApplicableEnvironmentsMode is set to SpecifiedEnvironments. + /// State indicating if basic auth has a secret and what type it is. + /// Kind of resource. + /// A new instance for mocking. + public static StaticSiteBasicAuthPropertiesARMResourceData StaticSiteBasicAuthPropertiesARMResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string password = null, Uri secretUri = null, string applicableEnvironmentsMode = null, IEnumerable environments = null, string secretState = null, string kind = null) + { + environments ??= new List(); + + return new StaticSiteBasicAuthPropertiesARMResourceData( + id, + name, + resourceType, + systemData, + password, + secretUri, + applicableEnvironmentsMode, + environments?.ToList(), + secretState, + kind, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -3878,6 +4267,32 @@ public static StaticSiteResetContent StaticSiteResetContent(ResourceIdentifier i serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource id of the backend linked to the static site. + /// The region of the backend linked to the static site. + /// The date and time on which the backend was linked to the static site. + /// The provisioning state of the linking process. + /// Kind of resource. + /// A new instance for mocking. + public static StaticSiteLinkedBackendARMResourceData StaticSiteLinkedBackendARMResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string backendResourceId = null, string region = null, DateTimeOffset? createdOn = null, string provisioningState = null, string kind = null) + { + return new StaticSiteLinkedBackendARMResourceData( + id, + name, + resourceType, + systemData, + backendResourceId, + region, + createdOn, + provisioningState, + kind, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -3900,6 +4315,7 @@ public static StaticSiteResetContent StaticSiteResetContent(ResourceIdentifier i /// Obsolete: Hyper-V sandbox. /// Hyper-V sandbox. /// Last time the app was modified, in UTC. Read-only. + /// Property to configure various DNS related settings for a site. /// Configuration of the app. /// Azure Traffic Manager hostnames associated with the app. Read-only. /// <code>true</code> to stop SCM (KUDU) site when the app is stopped; otherwise, <code>false</code>. The default is <code>false</code>. @@ -3947,7 +4363,7 @@ public static StaticSiteResetContent StaticSiteResetContent(ResourceIdentifier i /// /// Kind of resource. /// A new instance for mocking. - public static SitePatchInfo SitePatchInfo(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ManagedServiceIdentity identity = null, string state = null, IEnumerable hostNames = null, string repositorySiteName = null, AppServiceUsageState? usageState = null, bool? isEnabled = null, IEnumerable enabledHostNames = null, WebSiteAvailabilityState? availabilityState = null, IEnumerable hostNameSslStates = null, ResourceIdentifier serverFarmId = null, bool? isReserved = null, bool? isXenon = null, bool? isHyperV = null, DateTimeOffset? lastModifiedOn = null, SiteConfigProperties siteConfig = null, IEnumerable trafficManagerHostNames = null, bool? isScmSiteAlsoStopped = null, string targetSwapSlot = null, HostingEnvironmentProfile hostingEnvironmentProfile = null, bool? isClientAffinityEnabled = null, bool? isClientCertEnabled = null, ClientCertMode? clientCertMode = null, string clientCertExclusionPaths = null, bool? isHostNameDisabled = null, string customDomainVerificationId = null, string outboundIPAddresses = null, string possibleOutboundIPAddresses = null, int? containerSize = null, int? dailyMemoryTimeQuota = null, DateTimeOffset? suspendOn = null, int? maxNumberOfWorkers = null, CloningInfo cloningInfo = null, string resourceGroup = null, bool? isDefaultContainer = null, string defaultHostName = null, SlotSwapStatus slotSwapStatus = null, bool? isHttpsOnly = null, RedundancyMode? redundancyMode = null, Guid? inProgressOperationId = null, bool? isStorageAccountRequired = null, string keyVaultReferenceIdentity = null, ResourceIdentifier virtualNetworkSubnetId = null, string kind = null) + public static SitePatchInfo SitePatchInfo(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ManagedServiceIdentity identity = null, string state = null, IEnumerable hostNames = null, string repositorySiteName = null, AppServiceUsageState? usageState = null, bool? isEnabled = null, IEnumerable enabledHostNames = null, WebSiteAvailabilityState? availabilityState = null, IEnumerable hostNameSslStates = null, ResourceIdentifier serverFarmId = null, bool? isReserved = null, bool? isXenon = null, bool? isHyperV = null, DateTimeOffset? lastModifiedOn = null, SiteDnsConfig dnsConfiguration = null, SiteConfigProperties siteConfig = null, IEnumerable trafficManagerHostNames = null, bool? isScmSiteAlsoStopped = null, string targetSwapSlot = null, HostingEnvironmentProfile hostingEnvironmentProfile = null, bool? isClientAffinityEnabled = null, bool? isClientCertEnabled = null, ClientCertMode? clientCertMode = null, string clientCertExclusionPaths = null, bool? isHostNameDisabled = null, string customDomainVerificationId = null, string outboundIPAddresses = null, string possibleOutboundIPAddresses = null, int? containerSize = null, int? dailyMemoryTimeQuota = null, DateTimeOffset? suspendOn = null, int? maxNumberOfWorkers = null, CloningInfo cloningInfo = null, string resourceGroup = null, bool? isDefaultContainer = null, string defaultHostName = null, SlotSwapStatus slotSwapStatus = null, bool? isHttpsOnly = null, RedundancyMode? redundancyMode = null, Guid? inProgressOperationId = null, bool? isStorageAccountRequired = null, string keyVaultReferenceIdentity = null, ResourceIdentifier virtualNetworkSubnetId = null, string kind = null) { hostNames ??= new List(); enabledHostNames ??= new List(); @@ -3973,6 +4389,7 @@ public static SitePatchInfo SitePatchInfo(ResourceIdentifier id = null, string n isXenon, isHyperV, lastModifiedOn, + dnsConfiguration, siteConfig, trafficManagerHostNames?.ToList(), isScmSiteAlsoStopped, @@ -4023,7 +4440,7 @@ public static SitePatchInfo SitePatchInfo(ResourceIdentifier id = null, string n /// Alternate TXT records controller can see for this hostname. /// Kind of resource. /// A new instance for mocking. - public static CustomHostnameAnalysisResult CustomHostnameAnalysisResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? isHostnameAlreadyVerified = null, DnsVerificationTestResult? customDomainVerificationTest = null, ResponseError customDomainVerificationFailureInfo = null, bool? hasConflictOnScaleUnit = null, bool? hasConflictAcrossSubscription = null, string conflictingAppResourceId = null, IEnumerable cNameRecords = null, IEnumerable txtRecords = null, IEnumerable aRecords = null, IEnumerable alternateCNameRecords = null, IEnumerable alternateTxtRecords = null, string kind = null) + public static CustomHostnameAnalysisResult CustomHostnameAnalysisResult(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, bool? isHostnameAlreadyVerified = null, DnsVerificationTestResult? customDomainVerificationTest = null, ErrorEntity customDomainVerificationFailureInfo = null, bool? hasConflictOnScaleUnit = null, bool? hasConflictAcrossSubscription = null, string conflictingAppResourceId = null, IEnumerable cNameRecords = null, IEnumerable txtRecords = null, IEnumerable aRecords = null, IEnumerable alternateCNameRecords = null, IEnumerable alternateTxtRecords = null, string kind = null) { cNameRecords ??= new List(); txtRecords ??= new List(); @@ -4239,6 +4656,7 @@ public static CsmPublishingCredentialsPoliciesEntityData CsmPublishingCredential /// <code>true</code> if detailed error logging is enabled; otherwise, <code>false</code>. /// Publishing user name. /// Application settings. + /// Application metadata. This property cannot be retrieved, since it may contain secrets. /// Connection strings. /// Site MachineKey. /// Handler mappings. @@ -4272,10 +4690,13 @@ public static CsmPublishingCredentialsPoliciesEntityData CsmPublishingCredential /// Explicit Managed Service Identity Id. /// Identity to use for Key Vault Reference authentication. /// IP security restrictions for main. + /// Default action for main access restriction if no rules are matched. /// IP security restrictions for scm. + /// Default action for scm access restriction if no rules are matched. /// IP security restrictions for scm to use main. /// Http20Enabled: configures a web site to allow clients to connect over http2.0. /// MinTlsVersion: configures the minimum version of TLS required for SSL requests. + /// The minimum strength TLS cipher suite allowed for an application. /// ScmMinTlsVersion: configures the minimum version of TLS required for SSL requests for SCM site. /// State of FTP / FTPS service. /// @@ -4286,6 +4707,10 @@ public static CsmPublishingCredentialsPoliciesEntityData CsmPublishingCredential /// Maximum number of workers that a site can scale out to. /// This setting only applies to the Consumption and Elastic Premium Plans /// + /// + /// Maximum number of workers that a site can scale out to. + /// This setting only applies to apps in plans where ElasticScaleEnabled is <code>true</code> + /// /// Health check path. /// /// Gets or sets a value indicating whether functions runtime scale monitoring is enabled. When enabled, @@ -4301,10 +4726,11 @@ public static CsmPublishingCredentialsPoliciesEntityData CsmPublishingCredential /// Property to allow or block all public traffic. /// Kind of resource. /// A new instance for mocking. - public static SiteConfigData SiteConfigData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, int? numberOfWorkers = null, IEnumerable defaultDocuments = null, string netFrameworkVersion = null, string phpVersion = null, string pythonVersion = null, string nodeVersion = null, string powerShellVersion = null, string linuxFxVersion = null, string windowsFxVersion = null, bool? isRequestTracingEnabled = null, DateTimeOffset? requestTracingExpirationOn = null, bool? isRemoteDebuggingEnabled = null, string remoteDebuggingVersion = null, bool? isHttpLoggingEnabled = null, bool? useManagedIdentityCreds = null, string acrUserManagedIdentityId = null, int? logsDirectorySizeLimit = null, bool? isDetailedErrorLoggingEnabled = null, string publishingUsername = null, IEnumerable appSettings = null, IEnumerable connectionStrings = null, SiteMachineKey machineKey = null, IEnumerable handlerMappings = null, string documentRoot = null, ScmType? scmType = null, bool? use32BitWorkerProcess = null, bool? isWebSocketsEnabled = null, bool? isAlwaysOn = null, string javaVersion = null, string javaContainer = null, string javaContainerVersion = null, string appCommandLine = null, ManagedPipelineMode? managedPipelineMode = null, IEnumerable virtualApplications = null, SiteLoadBalancing? loadBalancing = null, IEnumerable experimentsRampUpRules = null, SiteLimits limits = null, bool? isAutoHealEnabled = null, AutoHealRules autoHealRules = null, string tracingOptions = null, string vnetName = null, bool? isVnetRouteAllEnabled = null, int? vnetPrivatePortsCount = null, AppServiceCorsSettings cors = null, WebAppPushSettings push = null, Uri apiDefinitionUri = null, string apiManagementConfigId = null, string autoSwapSlotName = null, bool? isLocalMySqlEnabled = null, int? managedServiceIdentityId = null, int? xManagedServiceIdentityId = null, string keyVaultReferenceIdentity = null, IEnumerable ipSecurityRestrictions = null, IEnumerable scmIPSecurityRestrictions = null, bool? allowIPSecurityRestrictionsForScmToUseMain = null, bool? isHttp20Enabled = null, AppServiceSupportedTlsVersion? minTlsVersion = null, AppServiceSupportedTlsVersion? scmMinTlsVersion = null, AppServiceFtpsState? ftpsState = null, int? preWarmedInstanceCount = null, int? functionAppScaleLimit = null, string healthCheckPath = null, bool? isFunctionsRuntimeScaleMonitoringEnabled = null, string websiteTimeZone = null, int? minimumElasticInstanceCount = null, IDictionary azureStorageAccounts = null, string publicNetworkAccess = null, string kind = null) + public static SiteConfigData SiteConfigData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, int? numberOfWorkers = null, IEnumerable defaultDocuments = null, string netFrameworkVersion = null, string phpVersion = null, string pythonVersion = null, string nodeVersion = null, string powerShellVersion = null, string linuxFxVersion = null, string windowsFxVersion = null, bool? isRequestTracingEnabled = null, DateTimeOffset? requestTracingExpirationOn = null, bool? isRemoteDebuggingEnabled = null, string remoteDebuggingVersion = null, bool? isHttpLoggingEnabled = null, bool? useManagedIdentityCreds = null, string acrUserManagedIdentityId = null, int? logsDirectorySizeLimit = null, bool? isDetailedErrorLoggingEnabled = null, string publishingUsername = null, IEnumerable appSettings = null, IEnumerable metadata = null, IEnumerable connectionStrings = null, SiteMachineKey machineKey = null, IEnumerable handlerMappings = null, string documentRoot = null, ScmType? scmType = null, bool? use32BitWorkerProcess = null, bool? isWebSocketsEnabled = null, bool? isAlwaysOn = null, string javaVersion = null, string javaContainer = null, string javaContainerVersion = null, string appCommandLine = null, ManagedPipelineMode? managedPipelineMode = null, IEnumerable virtualApplications = null, SiteLoadBalancing? loadBalancing = null, IEnumerable experimentsRampUpRules = null, SiteLimits limits = null, bool? isAutoHealEnabled = null, AutoHealRules autoHealRules = null, string tracingOptions = null, string vnetName = null, bool? isVnetRouteAllEnabled = null, int? vnetPrivatePortsCount = null, AppServiceCorsSettings cors = null, WebAppPushSettings push = null, Uri apiDefinitionUri = null, string apiManagementConfigId = null, string autoSwapSlotName = null, bool? isLocalMySqlEnabled = null, int? managedServiceIdentityId = null, int? xManagedServiceIdentityId = null, string keyVaultReferenceIdentity = null, IEnumerable ipSecurityRestrictions = null, DefaultAction? ipSecurityRestrictionsDefaultAction = null, IEnumerable scmIPSecurityRestrictions = null, DefaultAction? scmIPSecurityRestrictionsDefaultAction = null, bool? allowIPSecurityRestrictionsForScmToUseMain = null, bool? isHttp20Enabled = null, AppServiceSupportedTlsVersion? minTlsVersion = null, TlsCipherSuite? minTlsCipherSuite = null, AppServiceSupportedTlsVersion? scmMinTlsVersion = null, AppServiceFtpsState? ftpsState = null, int? preWarmedInstanceCount = null, int? functionAppScaleLimit = null, int? elasticWebAppScaleLimit = null, string healthCheckPath = null, bool? isFunctionsRuntimeScaleMonitoringEnabled = null, string websiteTimeZone = null, int? minimumElasticInstanceCount = null, IDictionary azureStorageAccounts = null, string publicNetworkAccess = null, string kind = null) { defaultDocuments ??= new List(); appSettings ??= new List(); + metadata ??= new List(); connectionStrings ??= new List(); handlerMappings ??= new List(); virtualApplications ??= new List(); @@ -4338,6 +4764,7 @@ public static SiteConfigData SiteConfigData(ResourceIdentifier id = null, string isDetailedErrorLoggingEnabled, publishingUsername, appSettings?.ToList(), + metadata?.ToList(), connectionStrings?.ToList(), machineKey, handlerMappings?.ToList(), @@ -4371,14 +4798,18 @@ public static SiteConfigData SiteConfigData(ResourceIdentifier id = null, string xManagedServiceIdentityId, keyVaultReferenceIdentity, ipSecurityRestrictions?.ToList(), + ipSecurityRestrictionsDefaultAction, scmIPSecurityRestrictions?.ToList(), + scmIPSecurityRestrictionsDefaultAction, allowIPSecurityRestrictionsForScmToUseMain, isHttp20Enabled, minTlsVersion, + minTlsCipherSuite, scmMinTlsVersion, ftpsState, preWarmedInstanceCount, functionAppScaleLimit, + elasticWebAppScaleLimit, healthCheckPath, isFunctionsRuntimeScaleMonitoringEnabled, websiteTimeZone, @@ -4443,7 +4874,7 @@ public static SiteConfigData SiteConfigData(ResourceIdentifier id = null, string /// /// Gets a value indicating whether the issuer should be a valid HTTPS url and be validated as such. /// - /// Allowed audience values to consider when validating JWTs issued by + /// Allowed audience values to consider when validating JSON Web Tokens issued by /// Azure Active Directory. Note that the <code>ClientID</code> value is always considered an /// allowed audience, regardless of this setting. /// @@ -4607,7 +5038,7 @@ public static SiteAuthSettings SiteAuthSettings(ResourceIdentifier id = null, st serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. @@ -4618,10 +5049,10 @@ public static SiteAuthSettings SiteAuthSettings(ResourceIdentifier id = null, st /// The configuration settings of the login flow of users using App Service Authentication/Authorization. /// The configuration settings of the HTTP requests for authentication and authorization requests made against App Service Authentication/Authorization. /// Kind of resource. - /// A new instance for mocking. - public static SiteAuthSettingsV2 SiteAuthSettingsV2(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AuthPlatform platform = null, GlobalValidation globalValidation = null, AppServiceIdentityProviders identityProviders = null, WebAppLoginInfo login = null, AppServiceHttpSettings httpSettings = null, string kind = null) + /// A new instance for mocking. + public static SiteAuthSettingsV2Data SiteAuthSettingsV2Data(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AuthPlatform platform = null, GlobalValidation globalValidation = null, AppServiceIdentityProviders identityProviders = null, WebAppLoginInfo login = null, AppServiceHttpSettings httpSettings = null, string kind = null) { - return new SiteAuthSettingsV2( + return new SiteAuthSettingsV2Data( id, name, resourceType, @@ -4831,6 +5262,41 @@ public static ContinuousWebJobData ContinuousWebJobData(ResourceIdentifier id = serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Deployment operation id. + /// Deployment build status. + /// Number of site instances currently being provisioned. + /// Number of site instances provisioned successfully. + /// Number of site instances failed to provision. + /// List of URLs pointing to logs for instances which failed to provision. + /// List of errors. + /// Kind of resource. + /// A new instance for mocking. + public static CsmDeploymentStatusData CsmDeploymentStatusData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string deploymentId = null, DeploymentBuildStatus? status = null, int? numberOfInstancesInProgress = null, int? numberOfInstancesSuccessful = null, int? numberOfInstancesFailed = null, IEnumerable failedInstancesLogs = null, IEnumerable errors = null, string kind = null) + { + failedInstancesLogs ??= new List(); + errors ??= new List(); + + return new CsmDeploymentStatusData( + id, + name, + resourceType, + systemData, + deploymentId, + status, + numberOfInstancesInProgress, + numberOfInstancesSuccessful, + numberOfInstancesFailed, + failedInstancesLogs?.ToList(), + errors?.ToList(), + kind, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -5114,9 +5580,10 @@ public static RelayServiceConnectionEntityData RelayServiceConnectionEntityData( /// Link to the console to web app instance. /// Link to the console to web app instance. /// Dictionary of <ContainerInfo>. + /// The physical zone that the instance is in. /// Kind of resource. /// A new instance for mocking. - public static WebSiteInstanceStatusData WebSiteInstanceStatusData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SiteRuntimeState? state = null, Uri statusUri = null, Uri detectorUri = null, Uri consoleUri = null, string healthCheckUrlString = null, IDictionary containers = null, string kind = null) + public static WebSiteInstanceStatusData WebSiteInstanceStatusData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, SiteRuntimeState? state = null, Uri statusUri = null, Uri detectorUri = null, Uri consoleUri = null, string healthCheckUrlString = null, IDictionary containers = null, string physicalZone = null, string kind = null) { containers ??= new Dictionary(); @@ -5131,6 +5598,7 @@ public static WebSiteInstanceStatusData WebSiteInstanceStatusData(ResourceIdenti consoleUri, healthCheckUrlString, containers, + physicalZone, kind, serializedAdditionalRawData: null); } @@ -5571,7 +6039,7 @@ public static SitePhpErrorLogFlag SitePhpErrorLogFlag(ResourceIdentifier id = nu /// Premier add on Vendor. /// Premier add on Marketplace publisher. /// Premier add on Marketplace offer. - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// A new instance for mocking. public static PremierAddOnData PremierAddOnData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string sku = null, string product = null, string vendor = null, string marketplacePublisher = null, string marketplaceOffer = null, string kind = null) { @@ -5737,6 +6205,51 @@ public static SnapshotRestoreRequest SnapshotRestoreRequest(ResourceIdentifier i serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Image Name. + /// Target Port. + /// <code>true</code> if the container is the main site container; <code>false</code> otherwise. + /// StartUp Command. + /// Auth Type. + /// User Name. + /// Password Secret. + /// UserManagedIdentity ClientId. + /// Created Time. + /// Last Modified Time. + /// List of volume mounts. + /// List of environment variables. + /// Kind of resource. + /// A new instance for mocking. + public static SiteContainerData SiteContainerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string image = null, string targetPort = null, bool? isMain = null, string startUpCommand = null, AuthType? authType = null, string userName = null, string passwordSecret = null, string userManagedIdentityClientId = null, DateTimeOffset? createdOn = null, DateTimeOffset? lastModifiedOn = null, IEnumerable volumeMounts = null, IEnumerable environmentVariables = null, string kind = null) + { + volumeMounts ??= new List(); + environmentVariables ??= new List(); + + return new SiteContainerData( + id, + name, + resourceType, + systemData, + image, + targetPort, + isMain, + startUpCommand, + authType, + userName, + passwordSecret, + userManagedIdentityClientId, + createdOn, + lastModifiedOn, + volumeMounts?.ToList(), + environmentVariables?.ToList(), + kind, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -5875,10 +6388,12 @@ public static SiteSourceControlData SiteSourceControlData(ResourceIdentifier id /// Job type. /// Error information. /// Using SDK?. + /// Property to allow or block all public traffic. Allowed Values: 'Enabled', 'Disabled' or an empty string. + /// Checks if Customer provided storage account is required. /// Job settings. /// Kind of resource. /// A new instance for mocking. - public static TriggeredWebJobData TriggeredWebJobData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, TriggeredJobRun latestRun = null, Uri historyUri = null, Uri schedulerLogsUri = null, string runCommand = null, Uri uri = null, Uri extraInfoUri = null, WebJobType? webJobType = null, string error = null, bool? isUsingSdk = null, IDictionary settings = null, string kind = null) + public static TriggeredWebJobData TriggeredWebJobData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, TriggeredJobRun latestRun = null, Uri historyUri = null, Uri schedulerLogsUri = null, string runCommand = null, Uri uri = null, Uri extraInfoUri = null, WebJobType? webJobType = null, string error = null, bool? isUsingSdk = null, string publicNetworkAccess = null, bool? storageAccountRequired = null, IDictionary settings = null, string kind = null) { settings ??= new Dictionary(); @@ -5896,6 +6411,8 @@ public static TriggeredWebJobData TriggeredWebJobData(ResourceIdentifier id = nu webJobType, error, isUsingSdk, + publicNetworkAccess, + storageAccountRequired, settings, kind, serializedAdditionalRawData: null); @@ -5956,5 +6473,637 @@ public static WebJobData WebJobData(ResourceIdentifier id = null, string name = kind, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource kind. + /// The resource location. + /// Additional workflow properties. + /// A new instance for mocking. + public static WorkflowEnvelopeData WorkflowEnvelopeData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string kind = null, AzureLocation? location = null, WorkflowEnvelopeProperties properties = null) + { + return new WorkflowEnvelopeData( + id, + name, + resourceType, + systemData, + kind, + location, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Gets or sets the files. + /// Gets or sets the state of the workflow. + /// Gets or sets workflow health. + /// A new instance for mocking. + public static WorkflowEnvelopeProperties WorkflowEnvelopeProperties(IReadOnlyDictionary files = null, WorkflowState? flowState = null, WorkflowHealth health = null) + { + files ??= new Dictionary(); + + return new WorkflowEnvelopeProperties(files, flowState, health, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Gets or sets the workflow health state. + /// Gets or sets the workflow error. + /// A new instance for mocking. + public static WorkflowHealth WorkflowHealth(WorkflowHealthState state = default, ErrorEntity error = null) + { + return new WorkflowHealth(state, error, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Gets the wait end time. + /// Gets the start time. + /// Gets the end time. + /// Gets the status. + /// Gets the code. + /// Gets the error. + /// Gets the correlation id. + /// The run correlation. + /// Gets the reference to workflow version. + /// Gets the fired trigger. + /// Gets the outputs. + /// Gets the response of the flow run. + /// A new instance for mocking. + public static WorkflowRunData WorkflowRunData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? waitEndOn = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, WorkflowStatus? status = null, string code = null, BinaryData error = null, string correlationId = null, string correlationClientTrackingId = null, ResourceReference workflow = null, WorkflowRunTrigger trigger = null, IReadOnlyDictionary outputs = null, WorkflowRunTrigger response = null) + { + outputs ??= new Dictionary(); + + return new WorkflowRunData( + id, + name, + resourceType, + systemData, + waitEndOn, + startOn, + endOn, + status, + code, + error, + correlationId, + correlationClientTrackingId != null ? new Correlation(correlationClientTrackingId, serializedAdditionalRawData: null) : null, + workflow, + trigger, + outputs, + response, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The resource id. + /// Gets the resource name. + /// Gets the resource type. + /// A new instance for mocking. + public static ResourceReference ResourceReference(string id = null, string name = null, string resourceType = null) + { + return new ResourceReference(id, name, resourceType, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Gets the name. + /// Gets the inputs. + /// Gets the link to inputs. + /// Gets the outputs. + /// Gets the link to outputs. + /// Gets the scheduled time. + /// Gets the start time. + /// Gets the end time. + /// Gets the tracking id. + /// The run correlation. + /// Gets the code. + /// Gets the status. + /// Gets the error. + /// Gets the tracked properties. + /// A new instance for mocking. + public static WorkflowRunTrigger WorkflowRunTrigger(string name = null, BinaryData inputs = null, ContentLink inputsLink = null, BinaryData outputs = null, ContentLink outputsLink = null, DateTimeOffset? scheduledOn = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, string trackingId = null, string correlationClientTrackingId = null, string code = null, WorkflowStatus? status = null, BinaryData error = null, BinaryData trackedProperties = null) + { + return new WorkflowRunTrigger( + name, + inputs, + inputsLink, + outputs, + outputsLink, + scheduledOn, + startOn, + endOn, + trackingId, + correlationClientTrackingId != null ? new Correlation(correlationClientTrackingId, serializedAdditionalRawData: null) : null, + code, + status, + error, + trackedProperties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The content link URI. + /// The content version. + /// The content size. + /// The content hash. + /// The metadata. + /// A new instance for mocking. + public static ContentLink ContentLink(Uri uri = null, string contentVersion = null, long? contentSize = null, ContentHash contentHash = null, BinaryData metadata = null) + { + return new ContentLink( + uri, + contentVersion, + contentSize, + contentHash, + metadata, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The algorithm of the content hash. + /// The value of the content hash. + /// A new instance for mocking. + public static ContentHash ContentHash(string algorithm = null, string value = null) + { + return new ContentHash(algorithm, value, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The type. + /// The value. + /// The metadata. + /// The description. + /// Gets the error. + /// A new instance for mocking. + public static WorkflowOutputParameter WorkflowOutputParameter(ParameterType? parameterType = null, BinaryData value = null, BinaryData metadata = null, string description = null, BinaryData error = null) + { + return new WorkflowOutputParameter( + parameterType, + value, + metadata, + description, + serializedAdditionalRawData: null, + error); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Gets the start time. + /// Gets the end time. + /// Gets the status. + /// Gets the code. + /// Gets the error. + /// Gets the tracking id. + /// The correlation properties. + /// Gets the link to inputs. + /// Gets the link to outputs. + /// Gets the tracked properties. + /// Gets the retry histories. + /// A new instance for mocking. + public static WorkflowRunActionData WorkflowRunActionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, WorkflowStatus? status = null, string code = null, BinaryData error = null, string trackingId = null, RunActionCorrelation correlation = null, ContentLink inputsLink = null, ContentLink outputsLink = null, BinaryData trackedProperties = null, IEnumerable retryHistory = null) + { + retryHistory ??= new List(); + + return new WorkflowRunActionData( + id, + name, + resourceType, + systemData, + startOn, + endOn, + status, + code, + error, + trackingId, + correlation, + inputsLink, + outputsLink, + trackedProperties, + retryHistory?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The text. + /// Anything. + /// The sub expressions. + /// The azure resource error info. + /// The path. + /// A new instance for mocking. + public static ExpressionRoot ExpressionRoot(string text = null, BinaryData value = null, IEnumerable subexpressions = null, AzureResourceErrorInfo error = null, string path = null) + { + subexpressions ??= new List(); + + return new ExpressionRoot( + text, + value, + subexpressions?.ToList(), + error, + serializedAdditionalRawData: null, + path); + } + + /// Initializes a new instance of . + /// The text. + /// Anything. + /// The sub expressions. + /// The azure resource error info. + /// A new instance for mocking. + public static Expression Expression(string text = null, BinaryData value = null, IEnumerable subexpressions = null, AzureResourceErrorInfo error = null) + { + subexpressions ??= new List(); + + return new Expression(text, value, subexpressions?.ToList(), error, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The error code. + /// The error message. + /// The error details. + /// A new instance for mocking. + public static AzureResourceErrorInfo AzureResourceErrorInfo(string code = null, string message = null, IEnumerable details = null) + { + details ??= new List(); + + return new AzureResourceErrorInfo(code, serializedAdditionalRawData: null, message, details?.ToList()); + } + + /// Initializes a new instance of . + /// The error code. + /// A new instance for mocking. + public static ErrorInfo ErrorInfo(string code = null) + { + return new ErrorInfo(code, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The start time of the workflow scope repetition. + /// The end time of the workflow scope repetition. + /// The correlation properties. + /// The status of the workflow scope repetition. + /// The workflow scope repetition code. + /// Anything. + /// Gets the tracking id. + /// Gets the inputs. + /// Gets the link to inputs. + /// Gets the outputs. + /// Gets the link to outputs. + /// Gets the tracked properties. + /// Gets the retry histories. + /// + /// The repetition indexes. + /// A new instance for mocking. + public static WorkflowRunActionRepetitionDefinitionData WorkflowRunActionRepetitionDefinitionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, RunActionCorrelation correlation = null, WorkflowStatus? status = null, string code = null, BinaryData error = null, string trackingId = null, BinaryData inputs = null, ContentLink inputsLink = null, BinaryData outputs = null, ContentLink outputsLink = null, BinaryData trackedProperties = null, IEnumerable retryHistory = null, int? iterationCount = null, IEnumerable repetitionIndexes = null) + { + tags ??= new Dictionary(); + retryHistory ??= new List(); + repetitionIndexes ??= new List(); + + return new WorkflowRunActionRepetitionDefinitionData( + id, + name, + resourceType, + systemData, + tags, + location, + startOn, + endOn, + correlation, + status, + code, + error, + trackingId, + inputs, + inputsLink, + outputs, + outputsLink, + trackedProperties, + retryHistory?.ToList(), + iterationCount, + repetitionIndexes?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The request history properties. + /// A new instance for mocking. + public static RequestHistoryData RequestHistoryData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, RequestHistoryProperties properties = null) + { + tags ??= new Dictionary(); + + return new RequestHistoryData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Gets the provisioning state. + /// Gets the created time. + /// Gets the changed time. + /// Gets the state. + /// Gets the status. + /// Gets the last execution time. + /// Gets the next execution time. + /// Gets the workflow trigger recurrence. + /// Gets the reference to workflow. + /// A new instance for mocking. + public static WorkflowTriggerData WorkflowTriggerData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkflowTriggerProvisioningState? provisioningState = null, DateTimeOffset? createdOn = null, DateTimeOffset? changedOn = null, WorkflowState? state = null, WorkflowStatus? status = null, DateTimeOffset? lastExecutionOn = null, DateTimeOffset? nextExecutionOn = null, WorkflowTriggerRecurrence recurrence = null, ResourceReference workflow = null) + { + return new WorkflowTriggerData( + id, + name, + resourceType, + systemData, + provisioningState, + createdOn, + changedOn, + state, + status, + lastExecutionOn, + nextExecutionOn, + recurrence, + workflow, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The frequency. + /// The interval. + /// The start time. + /// The end time. + /// The time zone. + /// The recurrence schedule. + /// A new instance for mocking. + public static WorkflowTriggerRecurrence WorkflowTriggerRecurrence(RecurrenceFrequency? frequency = null, int? interval = null, string startTime = null, string endTime = null, string timeZone = null, RecurrenceSchedule schedule = null) + { + return new WorkflowTriggerRecurrence( + frequency, + interval, + startTime, + endTime, + timeZone, + schedule, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The minutes. + /// The hours. + /// The days of the week. + /// The month days. + /// The monthly occurrences. + /// A new instance for mocking. + public static RecurrenceSchedule RecurrenceSchedule(IEnumerable minutes = null, IEnumerable hours = null, IEnumerable weekDays = null, IEnumerable monthDays = null, IEnumerable monthlyOccurrences = null) + { + minutes ??= new List(); + hours ??= new List(); + weekDays ??= new List(); + monthDays ??= new List(); + monthlyOccurrences ??= new List(); + + return new RecurrenceSchedule( + minutes?.ToList(), + hours?.ToList(), + weekDays?.ToList(), + monthDays?.ToList(), + monthlyOccurrences?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The day of the week. + /// The occurrence. + /// A new instance for mocking. + public static RecurrenceScheduleOccurrence RecurrenceScheduleOccurrence(DayOfWeek? day = null, int? occurrence = null) + { + return new RecurrenceScheduleOccurrence(day, occurrence, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Gets the start time. + /// Gets the end time. + /// The scheduled time. + /// Gets the status. + /// Gets the code. + /// Gets the error. + /// Gets the tracking id. + /// The run correlation. + /// Gets the link to input parameters. + /// Gets the link to output parameters. + /// The value indicating whether trigger was fired. + /// Gets the reference to workflow run. + /// A new instance for mocking. + public static WorkflowTriggerHistoryData WorkflowTriggerHistoryData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null, DateTimeOffset? scheduledOn = null, WorkflowStatus? status = null, string code = null, BinaryData error = null, string trackingId = null, string correlationClientTrackingId = null, ContentLink inputsLink = null, ContentLink outputsLink = null, bool? fired = null, ResourceReference run = null) + { + return new WorkflowTriggerHistoryData( + id, + name, + resourceType, + systemData, + startOn, + endOn, + scheduledOn, + status, + code, + error, + trackingId, + correlationClientTrackingId != null ? new Correlation(correlationClientTrackingId, serializedAdditionalRawData: null) : null, + inputsLink, + outputsLink, + fired, + run, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Gets the workflow trigger callback URL. + /// Gets the workflow trigger callback URL HTTP method. + /// Gets the workflow trigger callback URL base path. + /// Gets the workflow trigger callback URL relative path. + /// Gets the workflow trigger callback URL relative path parameters. + /// Gets the workflow trigger callback URL query parameters. + /// A new instance for mocking. + public static WorkflowTriggerCallbackUri WorkflowTriggerCallbackUri(string value = null, string method = null, string basePath = null, string relativePath = null, IEnumerable relativePathParameters = null, WorkflowTriggerListCallbackUrlQueries queries = null) + { + relativePathParameters ??= new List(); + + return new WorkflowTriggerCallbackUri( + value, + method, + basePath, + relativePath, + relativePathParameters?.ToList(), + queries, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The api version. + /// The SAS permissions. + /// The SAS version. + /// The SAS signature. + /// The SAS timestamp. + /// A new instance for mocking. + public static WorkflowTriggerListCallbackUrlQueries WorkflowTriggerListCallbackUrlQueries(string apiVersion = null, string sp = null, string sv = null, string sig = null, string se = null) + { + return new WorkflowTriggerListCallbackUrlQueries( + apiVersion, + sp, + sv, + sig, + se, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The JSON title. + /// The JSON content. + /// A new instance for mocking. + public static JsonSchema JsonSchema(string title = null, string content = null) + { + return new JsonSchema(title, content, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Managed service identity. + /// Gets the provisioning state. + /// Gets the created time. + /// Gets the changed time. + /// The state. + /// Gets the version. + /// Gets the access endpoint. + /// The endpoints configuration. + /// The access control configuration. + /// The sku. + /// The integration account. + /// The integration service environment. + /// The definition. + /// The parameters. + /// The workflow kind. + /// A new instance for mocking. + public static Workflow Workflow(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ManagedServiceIdentity identity = null, WorkflowProvisioningState? provisioningState = null, DateTimeOffset? createdOn = null, DateTimeOffset? changedOn = null, WorkflowState? state = null, string version = null, string accessEndpoint = null, FlowEndpointsConfiguration endpointsConfiguration = null, FlowAccessControlConfiguration accessControl = null, WorkflowSku sku = null, ResourceReference integrationAccount = null, ResourceReference integrationServiceEnvironment = null, BinaryData definition = null, IDictionary parameters = null, AppServiceKind? kind = null) + { + tags ??= new Dictionary(); + parameters ??= new Dictionary(); + + return new Workflow( + id, + name, + resourceType, + systemData, + tags, + location, + identity, + provisioningState, + createdOn, + changedOn, + state, + version, + accessEndpoint, + endpointsConfiguration, + accessControl, + sku, + integrationAccount, + integrationServiceEnvironment, + definition, + parameters, + kind, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name. + /// The reference to plan. + /// A new instance for mocking. + public static WorkflowSku WorkflowSku(WorkflowSkuName name = default, ResourceReference plan = null) + { + return new WorkflowSku(name, plan, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The provisioning state. + /// Gets the created time. + /// Gets the changed time. + /// The state. + /// Gets the version. + /// Gets the access endpoint. + /// The endpoints configuration. + /// The access control configuration. + /// The sku. + /// The integration account. + /// The definition. + /// The parameters. + /// A new instance for mocking. + public static WorkflowVersionData WorkflowVersionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, WorkflowProvisioningState? provisioningState = null, DateTimeOffset? createdOn = null, DateTimeOffset? changedOn = null, WorkflowState? state = null, string version = null, string accessEndpoint = null, FlowEndpointsConfiguration endpointsConfiguration = null, FlowAccessControlConfiguration accessControl = null, WorkflowSku sku = null, ResourceReference integrationAccount = null, BinaryData definition = null, IDictionary parameters = null) + { + tags ??= new Dictionary(); + parameters ??= new Dictionary(); + + return new WorkflowVersionData( + id, + name, + resourceType, + systemData, + tags, + location, + provisioningState, + createdOn, + changedOn, + state, + version, + accessEndpoint, + endpointsConfiguration, + accessControl, + sku, + integrationAccount, + definition, + parameters, + serializedAdditionalRawData: null); + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationData.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationData.Serialization.cs index d60707e10d2af..7faf68721a196 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationData.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationData.Serialization.cs @@ -122,6 +122,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, M writer.WritePropertyName("allowNewPrivateEndpointConnections"u8); writer.WriteBooleanValue(AllowNewPrivateEndpointConnections.Value); } + if (Optional.IsDefined(FtpEnabled)) + { + writer.WritePropertyName("ftpEnabled"u8); + writer.WriteBooleanValue(FtpEnabled.Value); + } + if (Optional.IsDefined(RemoteDebugEnabled)) + { + writer.WritePropertyName("remoteDebugEnabled"u8); + writer.WriteBooleanValue(RemoteDebugEnabled.Value); + } + if (Optional.IsDefined(InboundIPAddressOverride)) + { + writer.WritePropertyName("inboundIpAddressOverride"u8); + writer.WriteStringValue(InboundIPAddressOverride); + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -171,6 +186,9 @@ internal static AseV3NetworkingConfigurationData DeserializeAseV3NetworkingConfi IReadOnlyList externalInboundIPAddresses = default; IReadOnlyList internalInboundIPAddresses = default; bool? allowNewPrivateEndpointConnections = default; + bool? ftpEnabled = default; + bool? remoteDebugEnabled = default; + string inboundIPAddressOverride = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -306,6 +324,29 @@ internal static AseV3NetworkingConfigurationData DeserializeAseV3NetworkingConfi allowNewPrivateEndpointConnections = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("ftpEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ftpEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("remoteDebugEnabled"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + remoteDebugEnabled = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("inboundIpAddressOverride"u8)) + { + inboundIPAddressOverride = property0.Value.GetString(); + continue; + } } continue; } @@ -325,6 +366,9 @@ internal static AseV3NetworkingConfigurationData DeserializeAseV3NetworkingConfi externalInboundIPAddresses ?? new ChangeTrackingList(), internalInboundIPAddresses ?? new ChangeTrackingList(), allowNewPrivateEndpointConnections, + ftpEnabled, + remoteDebugEnabled, + inboundIPAddressOverride, kind, serializedAdditionalRawData); } @@ -546,6 +590,61 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FtpEnabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ftpEnabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FtpEnabled)) + { + builder.Append(" ftpEnabled: "); + var boolValue = FtpEnabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RemoteDebugEnabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" remoteDebugEnabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RemoteDebugEnabled)) + { + builder.Append(" remoteDebugEnabled: "); + var boolValue = RemoteDebugEnabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InboundIPAddressOverride), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" inboundIpAddressOverride: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(InboundIPAddressOverride)) + { + builder.Append(" inboundIpAddressOverride: "); + if (InboundIPAddressOverride.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{InboundIPAddressOverride}'''"); + } + else + { + builder.AppendLine($"'{InboundIPAddressOverride}'"); + } + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationData.cs index 71c38103010a6..56fd4c99719d4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationData.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationData.cs @@ -70,15 +70,21 @@ public AseV3NetworkingConfigurationData() /// /// /// Property to enable and disable new private endpoint connection creation on ASE. + /// Property to enable and disable FTP on ASEV3. + /// Property to enable and disable Remote Debug on ASEV3. + /// Customer provided Inbound IP Address. Only able to be set on Ase create. /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal AseV3NetworkingConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList windowsOutboundIPAddresses, IReadOnlyList linuxOutboundIPAddresses, IReadOnlyList externalInboundIPAddresses, IReadOnlyList internalInboundIPAddresses, bool? allowNewPrivateEndpointConnections, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal AseV3NetworkingConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IReadOnlyList windowsOutboundIPAddresses, IReadOnlyList linuxOutboundIPAddresses, IReadOnlyList externalInboundIPAddresses, IReadOnlyList internalInboundIPAddresses, bool? allowNewPrivateEndpointConnections, bool? ftpEnabled, bool? remoteDebugEnabled, string inboundIPAddressOverride, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { WindowsOutboundIPAddresses = windowsOutboundIPAddresses; LinuxOutboundIPAddresses = linuxOutboundIPAddresses; ExternalInboundIPAddresses = externalInboundIPAddresses; InternalInboundIPAddresses = internalInboundIPAddresses; AllowNewPrivateEndpointConnections = allowNewPrivateEndpointConnections; + FtpEnabled = ftpEnabled; + RemoteDebugEnabled = remoteDebugEnabled; + InboundIPAddressOverride = inboundIPAddressOverride; Kind = kind; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -98,6 +104,15 @@ internal AseV3NetworkingConfigurationData(ResourceIdentifier id, string name, Re /// Property to enable and disable new private endpoint connection creation on ASE. [WirePath("properties.allowNewPrivateEndpointConnections")] public bool? AllowNewPrivateEndpointConnections { get; set; } + /// Property to enable and disable FTP on ASEV3. + [WirePath("properties.ftpEnabled")] + public bool? FtpEnabled { get; set; } + /// Property to enable and disable Remote Debug on ASEV3. + [WirePath("properties.remoteDebugEnabled")] + public bool? RemoteDebugEnabled { get; set; } + /// Customer provided Inbound IP Address. Only able to be set on Ase create. + [WirePath("properties.inboundIpAddressOverride")] + public string InboundIPAddressOverride { get; set; } /// Kind of resource. [WirePath("kind")] public string Kind { get; set; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationResource.cs index 15212fb9c18f7..af69b3f4a4ff9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AseV3NetworkingConfigurationResource.cs @@ -100,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -140,7 +140,7 @@ public virtual async Task> GetAsy /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -180,7 +180,7 @@ public virtual Response Get(CancellationTo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -228,7 +228,7 @@ public virtual async Task> Cr /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteConfigResource.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteConfigResource.Serialization.cs new file mode 100644 index 0000000000000..ef9d27702fedb --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteConfigResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.AppService +{ + public partial class AuthsettingsV2SiteConfigResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SiteAuthSettingsV2Data IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SiteAuthSettingsV2Data IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteConfigResource.cs new file mode 100644 index 0000000000000..0d0dfe57cdd72 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteConfigResource.cs @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.AppService +{ + /// + /// A Class representing an AuthsettingsV2SiteConfig along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAuthsettingsV2SiteConfigResource method. + /// Otherwise you can get one from its parent resource using the GetAuthsettingsV2SiteConfig method. + /// + public partial class AuthsettingsV2SiteConfigResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettingsV2"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _authsettingsV2SiteConfigWebAppsClientDiagnostics; + private readonly WebAppsRestOperations _authsettingsV2SiteConfigWebAppsRestClient; + private readonly SiteAuthSettingsV2Data _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/config"; + + /// Initializes a new instance of the class for mocking. + protected AuthsettingsV2SiteConfigResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AuthsettingsV2SiteConfigResource(ArmClient client, SiteAuthSettingsV2Data data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal AuthsettingsV2SiteConfigResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authsettingsV2SiteConfigWebAppsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.AppService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string authsettingsV2SiteConfigWebAppsApiVersion); + _authsettingsV2SiteConfigWebAppsRestClient = new WebAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authsettingsV2SiteConfigWebAppsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SiteAuthSettingsV2Data Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Description for Gets site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettingsV2 + /// + /// + /// Operation Id + /// WebApps_GetAuthSettingsV2WithoutSecrets + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _authsettingsV2SiteConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteConfigResource.Get"); + scope.Start(); + try + { + var response = await _authsettingsV2SiteConfigWebAppsRestClient.GetAuthSettingsV2WithoutSecretsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthsettingsV2SiteConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Gets site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettingsV2 + /// + /// + /// Operation Id + /// WebApps_GetAuthSettingsV2WithoutSecrets + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _authsettingsV2SiteConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteConfigResource.Get"); + scope.Start(); + try + { + var response = _authsettingsV2SiteConfigWebAppsRestClient.GetAuthSettingsV2WithoutSecrets(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthsettingsV2SiteConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Updates site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettingsV2 + /// + /// + /// Operation Id + /// WebApps_UpdateAuthSettingsV2 + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Auth settings associated with web app. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, SiteAuthSettingsV2Data data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authsettingsV2SiteConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteConfigResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _authsettingsV2SiteConfigWebAppsRestClient.UpdateAuthSettingsV2Async(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _authsettingsV2SiteConfigWebAppsRestClient.CreateUpdateAuthSettingsV2RequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new AppServiceArmOperation(Response.FromValue(new AuthsettingsV2SiteConfigResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Updates site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettingsV2 + /// + /// + /// Operation Id + /// WebApps_UpdateAuthSettingsV2 + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Auth settings associated with web app. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, SiteAuthSettingsV2Data data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authsettingsV2SiteConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteConfigResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = _authsettingsV2SiteConfigWebAppsRestClient.UpdateAuthSettingsV2(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken); + var uri = _authsettingsV2SiteConfigWebAppsRestClient.CreateUpdateAuthSettingsV2RequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new AppServiceArmOperation(Response.FromValue(new AuthsettingsV2SiteConfigResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Gets site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettingsV2/list + /// + /// + /// Operation Id + /// WebApps_GetAuthSettingsV2 + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAuthSettingsV2Async(CancellationToken cancellationToken = default) + { + using var scope = _authsettingsV2SiteConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteConfigResource.GetAuthSettingsV2"); + scope.Start(); + try + { + var response = await _authsettingsV2SiteConfigWebAppsRestClient.GetAuthSettingsV2Async(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AuthsettingsV2SiteConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Gets site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/config/authsettingsV2/list + /// + /// + /// Operation Id + /// WebApps_GetAuthSettingsV2 + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetAuthSettingsV2(CancellationToken cancellationToken = default) + { + using var scope = _authsettingsV2SiteConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteConfigResource.GetAuthSettingsV2"); + scope.Start(); + try + { + var response = _authsettingsV2SiteConfigWebAppsRestClient.GetAuthSettingsV2(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + return Response.FromValue(new AuthsettingsV2SiteConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteSlotConfigResource.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteSlotConfigResource.Serialization.cs new file mode 100644 index 0000000000000..ff8ffb4e9835f --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteSlotConfigResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.AppService +{ + public partial class AuthsettingsV2SiteSlotConfigResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SiteAuthSettingsV2Data IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SiteAuthSettingsV2Data IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteSlotConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteSlotConfigResource.cs new file mode 100644 index 0000000000000..7f11dbca13edd --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/AuthsettingsV2SiteSlotConfigResource.cs @@ -0,0 +1,343 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.AppService +{ + /// + /// A Class representing an AuthsettingsV2SiteSlotConfig along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAuthsettingsV2SiteSlotConfigResource method. + /// Otherwise you can get one from its parent resource using the GetAuthsettingsV2SiteSlotConfig method. + /// + public partial class AuthsettingsV2SiteSlotConfigResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + /// The slot. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name, string slot) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettingsV2"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _authsettingsV2SiteSlotConfigWebAppsClientDiagnostics; + private readonly WebAppsRestOperations _authsettingsV2SiteSlotConfigWebAppsRestClient; + private readonly SiteAuthSettingsV2Data _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/sites/slots/config"; + + /// Initializes a new instance of the class for mocking. + protected AuthsettingsV2SiteSlotConfigResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AuthsettingsV2SiteSlotConfigResource(ArmClient client, SiteAuthSettingsV2Data data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal AuthsettingsV2SiteSlotConfigResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _authsettingsV2SiteSlotConfigWebAppsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.AppService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string authsettingsV2SiteSlotConfigWebAppsApiVersion); + _authsettingsV2SiteSlotConfigWebAppsRestClient = new WebAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, authsettingsV2SiteSlotConfigWebAppsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual SiteAuthSettingsV2Data Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettingsV2 + /// + /// + /// Operation Id + /// WebApps_GetAuthSettingsV2WithoutSecretsSlot + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _authsettingsV2SiteSlotConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteSlotConfigResource.Get"); + scope.Start(); + try + { + var response = await _authsettingsV2SiteSlotConfigWebAppsRestClient.GetAuthSettingsV2WithoutSecretsSlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthsettingsV2SiteSlotConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettingsV2 + /// + /// + /// Operation Id + /// WebApps_GetAuthSettingsV2WithoutSecretsSlot + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _authsettingsV2SiteSlotConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteSlotConfigResource.Get"); + scope.Start(); + try + { + var response = _authsettingsV2SiteSlotConfigWebAppsRestClient.GetAuthSettingsV2WithoutSecretsSlot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AuthsettingsV2SiteSlotConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Updates site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettingsV2 + /// + /// + /// Operation Id + /// WebApps_UpdateAuthSettingsV2Slot + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Auth settings associated with web app. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, SiteAuthSettingsV2Data data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authsettingsV2SiteSlotConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteSlotConfigResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _authsettingsV2SiteSlotConfigWebAppsRestClient.UpdateAuthSettingsV2SlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _authsettingsV2SiteSlotConfigWebAppsRestClient.CreateUpdateAuthSettingsV2SlotRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new AppServiceArmOperation(Response.FromValue(new AuthsettingsV2SiteSlotConfigResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Updates site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettingsV2 + /// + /// + /// Operation Id + /// WebApps_UpdateAuthSettingsV2Slot + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Auth settings associated with web app. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, SiteAuthSettingsV2Data data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _authsettingsV2SiteSlotConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteSlotConfigResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = _authsettingsV2SiteSlotConfigWebAppsRestClient.UpdateAuthSettingsV2Slot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data, cancellationToken); + var uri = _authsettingsV2SiteSlotConfigWebAppsRestClient.CreateUpdateAuthSettingsV2SlotRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new AppServiceArmOperation(Response.FromValue(new AuthsettingsV2SiteSlotConfigResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Gets site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettingsV2/list + /// + /// + /// Operation Id + /// WebApps_GetAuthSettingsV2Slot + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAuthSettingsV2SlotAsync(CancellationToken cancellationToken = default) + { + using var scope = _authsettingsV2SiteSlotConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteSlotConfigResource.GetAuthSettingsV2Slot"); + scope.Start(); + try + { + var response = await _authsettingsV2SiteSlotConfigWebAppsRestClient.GetAuthSettingsV2SlotAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AuthsettingsV2SiteSlotConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Gets site's Authentication / Authorization settings for apps via the V2 format + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/sites/{name}/slots/{slot}/config/authsettingsV2/list + /// + /// + /// Operation Id + /// WebApps_GetAuthSettingsV2Slot + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetAuthSettingsV2Slot(CancellationToken cancellationToken = default) + { + using var scope = _authsettingsV2SiteSlotConfigWebAppsClientDiagnostics.CreateScope("AuthsettingsV2SiteSlotConfigResource.GetAuthSettingsV2Slot"); + scope.Start(); + try + { + var response = _authsettingsV2SiteSlotConfigWebAppsRestClient.GetAuthSettingsV2Slot(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.Name, Id.Parent.Name, cancellationToken); + return Response.FromValue(new AuthsettingsV2SiteSlotConfigResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorCollection.cs index 72d574ee225fa..028304d2763f2 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -112,7 +112,7 @@ public virtual async Task> GetAsync(s /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -160,7 +160,7 @@ public virtual Response Get(string detectorNam /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -190,7 +190,7 @@ public virtual AsyncPageable GetAllAsync(Cance /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -220,7 +220,7 @@ public virtual Pageable GetAll(CancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -266,7 +266,7 @@ public virtual async Task> ExistsAsync(string detectorName, DateT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Response Exists(string detectorName, DateTimeOffset? startT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -360,7 +360,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorResource.cs index d67f546765d73..f05b372f8d1f3 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CertificateOrderDetectorResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -144,7 +144,7 @@ public virtual async Task> GetAsync(D /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppCollection.cs new file mode 100644 index 0000000000000..0d304e6a1c2ff --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AppService +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetContainerApps method from an instance of . + /// + public partial class ContainerAppCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _containerAppClientDiagnostics; + private readonly ContainerAppsRestOperations _containerAppRestClient; + + /// Initializes a new instance of the class for mocking. + protected ContainerAppCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ContainerAppCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _containerAppClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.AppService", ContainerAppResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ContainerAppResource.ResourceType, out string containerAppApiVersion); + _containerAppRestClient = new ContainerAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerAppApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Description for Create or update a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the Container App. + /// The to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string name, ContainerAppData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _containerAppRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken).ConfigureAwait(false); + var operation = new AppServiceArmOperation(new ContainerAppOperationSource(Client), _containerAppClientDiagnostics, Pipeline, _containerAppRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Create or update a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the Container App. + /// The to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string name, ContainerAppData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _containerAppRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, name, data, cancellationToken); + var operation = new AppServiceArmOperation(new ContainerAppOperationSource(Client), _containerAppClientDiagnostics, Pipeline, _containerAppRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the properties of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppCollection.Get"); + scope.Start(); + try + { + var response = await _containerAppRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ContainerAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the properties of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppCollection.Get"); + scope.Start(); + try + { + var response = _containerAppRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ContainerAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the Container Apps in a given resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps + /// + /// + /// Operation Id + /// ContainerApps_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), _containerAppClientDiagnostics, Pipeline, "ContainerAppCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get the Container Apps in a given resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps + /// + /// + /// Operation Id + /// ContainerApps_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _containerAppRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _containerAppRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), _containerAppClientDiagnostics, Pipeline, "ContainerAppCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppCollection.Exists"); + scope.Start(); + try + { + var response = await _containerAppRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppCollection.Exists"); + scope.Start(); + try + { + var response = _containerAppRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _containerAppRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppCollection.GetIfExists"); + scope.Start(); + try + { + var response = _containerAppRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, name, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ContainerAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppData.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppData.Serialization.cs new file mode 100644 index 0000000000000..4d86afbf37545 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppData.Serialization.cs @@ -0,0 +1,574 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService +{ + public partial class ContainerAppData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerAppData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(KubeEnvironmentId)) + { + writer.WritePropertyName("kubeEnvironmentId"u8); + writer.WriteStringValue(KubeEnvironmentId); + } + if (options.Format != "W" && Optional.IsDefined(LatestRevisionName)) + { + writer.WritePropertyName("latestRevisionName"u8); + writer.WriteStringValue(LatestRevisionName); + } + if (options.Format != "W" && Optional.IsDefined(LatestRevisionFqdn)) + { + writer.WritePropertyName("latestRevisionFqdn"u8); + writer.WriteStringValue(LatestRevisionFqdn); + } + if (Optional.IsDefined(Configuration)) + { + writer.WritePropertyName("configuration"u8); + writer.WriteObjectValue(Configuration, options); + } + if (Optional.IsDefined(Template)) + { + writer.WritePropertyName("template"u8); + writer.WriteObjectValue(Template, options); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ContainerAppData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerAppData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppData(document.RootElement, options); + } + + internal static ContainerAppData DeserializeContainerAppData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + ContainerAppProvisioningState? provisioningState = default; + string kubeEnvironmentId = default; + string latestRevisionName = default; + string latestRevisionFqdn = default; + Configuration configuration = default; + Template template = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ContainerAppProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("kubeEnvironmentId"u8)) + { + kubeEnvironmentId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("latestRevisionName"u8)) + { + latestRevisionName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("latestRevisionFqdn"u8)) + { + latestRevisionFqdn = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("configuration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configuration = Configuration.DeserializeConfiguration(property0.Value, options); + continue; + } + if (property0.NameEquals("template"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + template = Template.DeserializeTemplate(property0.Value, options); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ContainerAppData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + provisioningState, + kubeEnvironmentId, + latestRevisionName, + latestRevisionFqdn, + configuration, + template, + kind, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.ToString()}'"); + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Tags), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" tags: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Tags)) + { + if (Tags.Any()) + { + builder.Append(" tags: "); + builder.AppendLine("{"); + foreach (var item in Tags) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kind: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Kind)) + { + builder.Append(" kind: "); + if (Kind.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Kind}'''"); + } + else + { + builder.AppendLine($"'{Kind}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KubeEnvironmentId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kubeEnvironmentId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(KubeEnvironmentId)) + { + builder.Append(" kubeEnvironmentId: "); + if (KubeEnvironmentId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{KubeEnvironmentId}'''"); + } + else + { + builder.AppendLine($"'{KubeEnvironmentId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LatestRevisionName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" latestRevisionName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LatestRevisionName)) + { + builder.Append(" latestRevisionName: "); + if (LatestRevisionName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LatestRevisionName}'''"); + } + else + { + builder.AppendLine($"'{LatestRevisionName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LatestRevisionFqdn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" latestRevisionFqdn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LatestRevisionFqdn)) + { + builder.Append(" latestRevisionFqdn: "); + if (LatestRevisionFqdn.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{LatestRevisionFqdn}'''"); + } + else + { + builder.AppendLine($"'{LatestRevisionFqdn}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Configuration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" configuration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Configuration)) + { + builder.Append(" configuration: "); + BicepSerializationHelpers.AppendChildObject(builder, Configuration, options, 4, false, " configuration: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Template), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" template: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Template)) + { + builder.Append(" template: "); + BicepSerializationHelpers.AppendChildObject(builder, Template, options, 4, false, " template: "); + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ContainerAppData)} does not support writing '{options.Format}' format."); + } + } + + ContainerAppData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeContainerAppData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ContainerAppData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppData.cs new file mode 100644 index 0000000000000..1b02f09694882 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppData.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService +{ + /// + /// A class representing the ContainerApp data model. + /// Container App. + /// + public partial class ContainerAppData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public ContainerAppData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Provisioning state of the Container App. + /// Resource ID of the Container App's KubeEnvironment. + /// Name of the latest revision of the Container App. + /// Fully Qualified Domain Name of the latest revision of the Container App. + /// Non versioned Container App configuration properties. + /// Container App versioned application definition. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. + /// Keeps track of any properties unknown to the library. + internal ContainerAppData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ContainerAppProvisioningState? provisioningState, string kubeEnvironmentId, string latestRevisionName, string latestRevisionFqdn, Configuration configuration, Template template, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + ProvisioningState = provisioningState; + KubeEnvironmentId = kubeEnvironmentId; + LatestRevisionName = latestRevisionName; + LatestRevisionFqdn = latestRevisionFqdn; + Configuration = configuration; + Template = template; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppData() + { + } + + /// Provisioning state of the Container App. + [WirePath("properties.provisioningState")] + public ContainerAppProvisioningState? ProvisioningState { get; } + /// Resource ID of the Container App's KubeEnvironment. + [WirePath("properties.kubeEnvironmentId")] + public string KubeEnvironmentId { get; set; } + /// Name of the latest revision of the Container App. + [WirePath("properties.latestRevisionName")] + public string LatestRevisionName { get; } + /// Fully Qualified Domain Name of the latest revision of the Container App. + [WirePath("properties.latestRevisionFqdn")] + public string LatestRevisionFqdn { get; } + /// Non versioned Container App configuration properties. + [WirePath("properties.configuration")] + public Configuration Configuration { get; set; } + /// Container App versioned application definition. + [WirePath("properties.template")] + public Template Template { get; set; } + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. + [WirePath("kind")] + public string Kind { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppResource.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppResource.Serialization.cs new file mode 100644 index 0000000000000..8a5ae27b329d6 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.AppService +{ + public partial class ContainerAppResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ContainerAppData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + ContainerAppData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppResource.cs new file mode 100644 index 0000000000000..af516737346c2 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/ContainerAppResource.cs @@ -0,0 +1,753 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AppService +{ + /// + /// A Class representing a ContainerApp along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetContainerAppResource method. + /// Otherwise you can get one from its parent resource using the GetContainerApp method. + /// + public partial class ContainerAppResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _containerAppClientDiagnostics; + private readonly ContainerAppsRestOperations _containerAppRestClient; + private readonly ContainerAppData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/containerApps"; + + /// Initializes a new instance of the class for mocking. + protected ContainerAppResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ContainerAppResource(ArmClient client, ContainerAppData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ContainerAppResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _containerAppClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.AppService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string containerAppApiVersion); + _containerAppRestClient = new ContainerAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, containerAppApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ContainerAppData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of RevisionResources in the ContainerApp. + /// An object representing collection of RevisionResources and their operations over a RevisionResource. + public virtual RevisionCollection GetRevisions() + { + return GetCachedClient(client => new RevisionCollection(client, Id)); + } + + /// + /// Get a revision of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{containerAppName}/revisions/{name} + /// + /// + /// Operation Id + /// ContainerAppsRevisions_GetRevision + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App Revision. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetRevisionAsync(string name, CancellationToken cancellationToken = default) + { + return await GetRevisions().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a revision of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{containerAppName}/revisions/{name} + /// + /// + /// Operation Id + /// ContainerAppsRevisions_GetRevision + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App Revision. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetRevision(string name, CancellationToken cancellationToken = default) + { + return GetRevisions().Get(name, cancellationToken); + } + + /// + /// Get the properties of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.Get"); + scope.Start(); + try + { + var response = await _containerAppRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ContainerAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the properties of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.Get"); + scope.Start(); + try + { + var response = _containerAppRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ContainerAppResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Delete a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Delete + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.Delete"); + scope.Start(); + try + { + var response = await _containerAppRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AppServiceArmOperation(_containerAppClientDiagnostics, Pipeline, _containerAppRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Delete a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Delete + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.Delete"); + scope.Start(); + try + { + var response = _containerAppRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new AppServiceArmOperation(_containerAppClientDiagnostics, Pipeline, _containerAppRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Create or update a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ContainerAppData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.Update"); + scope.Start(); + try + { + var response = await _containerAppRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new AppServiceArmOperation(new ContainerAppOperationSource(Client), _containerAppClientDiagnostics, Pipeline, _containerAppRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Description for Create or update a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The to use. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ContainerAppData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.Update"); + scope.Start(); + try + { + var response = _containerAppRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); + var operation = new AppServiceArmOperation(new ContainerAppOperationSource(Client), _containerAppClientDiagnostics, Pipeline, _containerAppRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _containerAppRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ContainerAppResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _containerAppRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ContainerAppResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags[key] = value; + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _containerAppRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ContainerAppResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _containerAppRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ContainerAppResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _containerAppRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ContainerAppResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + current.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, current, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _containerAppClientDiagnostics.CreateScope("ContainerAppResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _containerAppRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ContainerAppResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + current.Tags.Remove(key); + var result = Update(WaitUntil.Completed, current, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CsmDeploymentStatusData.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CsmDeploymentStatusData.Serialization.cs new file mode 100644 index 0000000000000..f89c443e9dbef --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CsmDeploymentStatusData.Serialization.cs @@ -0,0 +1,561 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService +{ + public partial class CsmDeploymentStatusData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CsmDeploymentStatusData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(DeploymentId)) + { + writer.WritePropertyName("deploymentId"u8); + writer.WriteStringValue(DeploymentId); + } + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(NumberOfInstancesInProgress)) + { + writer.WritePropertyName("numberOfInstancesInProgress"u8); + writer.WriteNumberValue(NumberOfInstancesInProgress.Value); + } + if (Optional.IsDefined(NumberOfInstancesSuccessful)) + { + writer.WritePropertyName("numberOfInstancesSuccessful"u8); + writer.WriteNumberValue(NumberOfInstancesSuccessful.Value); + } + if (Optional.IsDefined(NumberOfInstancesFailed)) + { + writer.WritePropertyName("numberOfInstancesFailed"u8); + writer.WriteNumberValue(NumberOfInstancesFailed.Value); + } + if (Optional.IsCollectionDefined(FailedInstancesLogs)) + { + writer.WritePropertyName("failedInstancesLogs"u8); + writer.WriteStartArray(); + foreach (var item in FailedInstancesLogs) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CsmDeploymentStatusData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CsmDeploymentStatusData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCsmDeploymentStatusData(document.RootElement, options); + } + + internal static CsmDeploymentStatusData DeserializeCsmDeploymentStatusData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + string deploymentId = default; + DeploymentBuildStatus? status = default; + int? numberOfInstancesInProgress = default; + int? numberOfInstancesSuccessful = default; + int? numberOfInstancesFailed = default; + IList failedInstancesLogs = default; + IList errors = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("deploymentId"u8)) + { + deploymentId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new DeploymentBuildStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("numberOfInstancesInProgress"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + numberOfInstancesInProgress = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("numberOfInstancesSuccessful"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + numberOfInstancesSuccessful = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("numberOfInstancesFailed"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + numberOfInstancesFailed = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("failedInstancesLogs"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + failedInstancesLogs = array; + continue; + } + if (property0.NameEquals("errors"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ErrorEntity.DeserializeErrorEntity(item, options)); + } + errors = array; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CsmDeploymentStatusData( + id, + name, + type, + systemData, + deploymentId, + status, + numberOfInstancesInProgress, + numberOfInstancesSuccessful, + numberOfInstancesFailed, + failedInstancesLogs ?? new ChangeTrackingList(), + errors ?? new ChangeTrackingList(), + kind, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kind: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Kind)) + { + builder.Append(" kind: "); + if (Kind.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Kind}'''"); + } + else + { + builder.AppendLine($"'{Kind}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DeploymentId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" deploymentId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DeploymentId)) + { + builder.Append(" deploymentId: "); + if (DeploymentId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DeploymentId}'''"); + } + else + { + builder.AppendLine($"'{DeploymentId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Status), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" status: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Status)) + { + builder.Append(" status: "); + builder.AppendLine($"'{Status.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NumberOfInstancesInProgress), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" numberOfInstancesInProgress: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NumberOfInstancesInProgress)) + { + builder.Append(" numberOfInstancesInProgress: "); + builder.AppendLine($"{NumberOfInstancesInProgress.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NumberOfInstancesSuccessful), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" numberOfInstancesSuccessful: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NumberOfInstancesSuccessful)) + { + builder.Append(" numberOfInstancesSuccessful: "); + builder.AppendLine($"{NumberOfInstancesSuccessful.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NumberOfInstancesFailed), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" numberOfInstancesFailed: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NumberOfInstancesFailed)) + { + builder.Append(" numberOfInstancesFailed: "); + builder.AppendLine($"{NumberOfInstancesFailed.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FailedInstancesLogs), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" failedInstancesLogs: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(FailedInstancesLogs)) + { + if (FailedInstancesLogs.Any()) + { + builder.Append(" failedInstancesLogs: "); + builder.AppendLine("["); + foreach (var item in FailedInstancesLogs) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Errors), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" errors: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Errors)) + { + if (Errors.Any()) + { + builder.Append(" errors: "); + builder.AppendLine("["); + foreach (var item in Errors) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " errors: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CsmDeploymentStatusData)} does not support writing '{options.Format}' format."); + } + } + + CsmDeploymentStatusData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCsmDeploymentStatusData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CsmDeploymentStatusData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CsmDeploymentStatusData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CsmDeploymentStatusData.cs new file mode 100644 index 0000000000000..7878fc7d8b0fb --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CsmDeploymentStatusData.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService +{ + /// + /// A class representing the CsmDeploymentStatus data model. + /// Deployment status response payload. + /// + public partial class CsmDeploymentStatusData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CsmDeploymentStatusData() + { + FailedInstancesLogs = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Deployment operation id. + /// Deployment build status. + /// Number of site instances currently being provisioned. + /// Number of site instances provisioned successfully. + /// Number of site instances failed to provision. + /// List of URLs pointing to logs for instances which failed to provision. + /// List of errors. + /// Kind of resource. + /// Keeps track of any properties unknown to the library. + internal CsmDeploymentStatusData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string deploymentId, DeploymentBuildStatus? status, int? numberOfInstancesInProgress, int? numberOfInstancesSuccessful, int? numberOfInstancesFailed, IList failedInstancesLogs, IList errors, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + DeploymentId = deploymentId; + Status = status; + NumberOfInstancesInProgress = numberOfInstancesInProgress; + NumberOfInstancesSuccessful = numberOfInstancesSuccessful; + NumberOfInstancesFailed = numberOfInstancesFailed; + FailedInstancesLogs = failedInstancesLogs; + Errors = errors; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Deployment operation id. + [WirePath("properties.deploymentId")] + public string DeploymentId { get; set; } + /// Deployment build status. + [WirePath("properties.status")] + public DeploymentBuildStatus? Status { get; set; } + /// Number of site instances currently being provisioned. + [WirePath("properties.numberOfInstancesInProgress")] + public int? NumberOfInstancesInProgress { get; set; } + /// Number of site instances provisioned successfully. + [WirePath("properties.numberOfInstancesSuccessful")] + public int? NumberOfInstancesSuccessful { get; set; } + /// Number of site instances failed to provision. + [WirePath("properties.numberOfInstancesFailed")] + public int? NumberOfInstancesFailed { get; set; } + /// List of URLs pointing to logs for instances which failed to provision. + [WirePath("properties.failedInstancesLogs")] + public IList FailedInstancesLogs { get; } + /// List of errors. + [WirePath("properties.errors")] + public IList Errors { get; } + /// Kind of resource. + [WirePath("kind")] + public string Kind { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationData.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationData.Serialization.cs new file mode 100644 index 0000000000000..43932ebb4871d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationData.Serialization.cs @@ -0,0 +1,457 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService +{ + public partial class CustomDnsSuffixConfigurationData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomDnsSuffixConfigurationData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToSerialString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningDetails)) + { + writer.WritePropertyName("provisioningDetails"u8); + writer.WriteStringValue(ProvisioningDetails); + } + if (Optional.IsDefined(DnsSuffix)) + { + writer.WritePropertyName("dnsSuffix"u8); + writer.WriteStringValue(DnsSuffix); + } + if (Optional.IsDefined(CertificateUri)) + { + writer.WritePropertyName("certificateUrl"u8); + writer.WriteStringValue(CertificateUri.AbsoluteUri); + } + if (Optional.IsDefined(KeyVaultReferenceIdentity)) + { + writer.WritePropertyName("keyVaultReferenceIdentity"u8); + writer.WriteStringValue(KeyVaultReferenceIdentity); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomDnsSuffixConfigurationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomDnsSuffixConfigurationData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomDnsSuffixConfigurationData(document.RootElement, options); + } + + internal static CustomDnsSuffixConfigurationData DeserializeCustomDnsSuffixConfigurationData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + CustomDnsSuffixProvisioningState? provisioningState = default; + string provisioningDetails = default; + string dnsSuffix = default; + Uri certificateUrl = default; + string keyVaultReferenceIdentity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = property0.Value.GetString().ToCustomDnsSuffixProvisioningState(); + continue; + } + if (property0.NameEquals("provisioningDetails"u8)) + { + provisioningDetails = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("dnsSuffix"u8)) + { + dnsSuffix = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("certificateUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certificateUrl = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("keyVaultReferenceIdentity"u8)) + { + keyVaultReferenceIdentity = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomDnsSuffixConfigurationData( + id, + name, + type, + systemData, + provisioningState, + provisioningDetails, + dnsSuffix, + certificateUrl, + keyVaultReferenceIdentity, + kind, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kind: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Kind)) + { + builder.Append(" kind: "); + if (Kind.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Kind}'''"); + } + else + { + builder.AppendLine($"'{Kind}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToSerialString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningDetails), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningDetails: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningDetails)) + { + builder.Append(" provisioningDetails: "); + if (ProvisioningDetails.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ProvisioningDetails}'''"); + } + else + { + builder.AppendLine($"'{ProvisioningDetails}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsSuffix), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsSuffix: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DnsSuffix)) + { + builder.Append(" dnsSuffix: "); + if (DnsSuffix.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DnsSuffix}'''"); + } + else + { + builder.AppendLine($"'{DnsSuffix}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CertificateUri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" certificateUrl: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CertificateUri)) + { + builder.Append(" certificateUrl: "); + builder.AppendLine($"'{CertificateUri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(KeyVaultReferenceIdentity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" keyVaultReferenceIdentity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(KeyVaultReferenceIdentity)) + { + builder.Append(" keyVaultReferenceIdentity: "); + if (KeyVaultReferenceIdentity.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{KeyVaultReferenceIdentity}'''"); + } + else + { + builder.AppendLine($"'{KeyVaultReferenceIdentity}'"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CustomDnsSuffixConfigurationData)} does not support writing '{options.Format}' format."); + } + } + + CustomDnsSuffixConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomDnsSuffixConfigurationData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomDnsSuffixConfigurationData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationData.cs new file mode 100644 index 0000000000000..2f527bad44ca1 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationData.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService +{ + /// + /// A class representing the CustomDnsSuffixConfiguration data model. + /// Full view of the custom domain suffix configuration for ASEv3. + /// + public partial class CustomDnsSuffixConfigurationData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CustomDnsSuffixConfigurationData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// + /// The default custom domain suffix to use for all sites deployed on the ASE. + /// The URL referencing the Azure Key Vault certificate secret that should be used as the default SSL/TLS certificate for sites with the custom domain suffix. + /// The user-assigned identity to use for resolving the key vault certificate reference. If not specified, the system-assigned ASE identity will be used if available. + /// Kind of resource. + /// Keeps track of any properties unknown to the library. + internal CustomDnsSuffixConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CustomDnsSuffixProvisioningState? provisioningState, string provisioningDetails, string dnsSuffix, Uri certificateUri, string keyVaultReferenceIdentity, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + ProvisioningDetails = provisioningDetails; + DnsSuffix = dnsSuffix; + CertificateUri = certificateUri; + KeyVaultReferenceIdentity = keyVaultReferenceIdentity; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets the provisioning state. + [WirePath("properties.provisioningState")] + public CustomDnsSuffixProvisioningState? ProvisioningState { get; } + /// Gets the provisioning details. + [WirePath("properties.provisioningDetails")] + public string ProvisioningDetails { get; } + /// The default custom domain suffix to use for all sites deployed on the ASE. + [WirePath("properties.dnsSuffix")] + public string DnsSuffix { get; set; } + /// The URL referencing the Azure Key Vault certificate secret that should be used as the default SSL/TLS certificate for sites with the custom domain suffix. + [WirePath("properties.certificateUrl")] + public Uri CertificateUri { get; set; } + /// The user-assigned identity to use for resolving the key vault certificate reference. If not specified, the system-assigned ASE identity will be used if available. + [WirePath("properties.keyVaultReferenceIdentity")] + public string KeyVaultReferenceIdentity { get; set; } + /// Kind of resource. + [WirePath("kind")] + public string Kind { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationResource.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationResource.Serialization.cs new file mode 100644 index 0000000000000..f0daa40f56ea7 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.AppService +{ + public partial class CustomDnsSuffixConfigurationResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + CustomDnsSuffixConfigurationData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + CustomDnsSuffixConfigurationData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationResource.cs new file mode 100644 index 0000000000000..ce3bdef7a2aa2 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/CustomDnsSuffixConfigurationResource.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.AppService +{ + /// + /// A Class representing a CustomDnsSuffixConfiguration along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetCustomDnsSuffixConfigurationResource method. + /// Otherwise you can get one from its parent resource using the GetCustomDnsSuffixConfiguration method. + /// + public partial class CustomDnsSuffixConfigurationResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The name. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string name) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/configurations/customdnssuffix"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _customDnsSuffixConfigurationAppServiceEnvironmentsClientDiagnostics; + private readonly AppServiceEnvironmentsRestOperations _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient; + private readonly CustomDnsSuffixConfigurationData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Web/hostingEnvironments/configurations"; + + /// Initializes a new instance of the class for mocking. + protected CustomDnsSuffixConfigurationResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal CustomDnsSuffixConfigurationResource(ArmClient client, CustomDnsSuffixConfigurationData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal CustomDnsSuffixConfigurationResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _customDnsSuffixConfigurationAppServiceEnvironmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.AppService", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string customDnsSuffixConfigurationAppServiceEnvironmentsApiVersion); + _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient = new AppServiceEnvironmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, customDnsSuffixConfigurationAppServiceEnvironmentsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual CustomDnsSuffixConfigurationData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get Custom Dns Suffix configuration of an App Service Environment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/configurations/customdnssuffix + /// + /// + /// Operation Id + /// AppServiceEnvironments_GetAseCustomDnsSuffixConfiguration + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _customDnsSuffixConfigurationAppServiceEnvironmentsClientDiagnostics.CreateScope("CustomDnsSuffixConfigurationResource.Get"); + scope.Start(); + try + { + var response = await _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient.GetAseCustomDnsSuffixConfigurationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CustomDnsSuffixConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get Custom Dns Suffix configuration of an App Service Environment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/configurations/customdnssuffix + /// + /// + /// Operation Id + /// AppServiceEnvironments_GetAseCustomDnsSuffixConfiguration + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _customDnsSuffixConfigurationAppServiceEnvironmentsClientDiagnostics.CreateScope("CustomDnsSuffixConfigurationResource.Get"); + scope.Start(); + try + { + var response = _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient.GetAseCustomDnsSuffixConfiguration(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new CustomDnsSuffixConfigurationResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete Custom Dns Suffix configuration of an App Service Environment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/configurations/customdnssuffix + /// + /// + /// Operation Id + /// AppServiceEnvironments_DeleteAseCustomDnsSuffixConfiguration + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _customDnsSuffixConfigurationAppServiceEnvironmentsClientDiagnostics.CreateScope("CustomDnsSuffixConfigurationResource.Delete"); + scope.Start(); + try + { + var response = await _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient.DeleteAseCustomDnsSuffixConfigurationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken).ConfigureAwait(false); + var uri = _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient.CreateDeleteAseCustomDnsSuffixConfigurationRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new AppServiceArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete Custom Dns Suffix configuration of an App Service Environment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/configurations/customdnssuffix + /// + /// + /// Operation Id + /// AppServiceEnvironments_DeleteAseCustomDnsSuffixConfiguration + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _customDnsSuffixConfigurationAppServiceEnvironmentsClientDiagnostics.CreateScope("CustomDnsSuffixConfigurationResource.Delete"); + scope.Start(); + try + { + var response = _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient.DeleteAseCustomDnsSuffixConfiguration(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, cancellationToken); + var uri = _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient.CreateDeleteAseCustomDnsSuffixConfigurationRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new AppServiceArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update Custom Dns Suffix configuration of an App Service Environment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/configurations/customdnssuffix + /// + /// + /// Operation Id + /// AppServiceEnvironments_UpdateAseCustomDnsSuffixConfiguration + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, CustomDnsSuffixConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _customDnsSuffixConfigurationAppServiceEnvironmentsClientDiagnostics.CreateScope("CustomDnsSuffixConfigurationResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient.UpdateAseCustomDnsSuffixConfigurationAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient.CreateUpdateAseCustomDnsSuffixConfigurationRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new AppServiceArmOperation(Response.FromValue(new CustomDnsSuffixConfigurationResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update Custom Dns Suffix configuration of an App Service Environment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/hostingEnvironments/{name}/configurations/customdnssuffix + /// + /// + /// Operation Id + /// AppServiceEnvironments_UpdateAseCustomDnsSuffixConfiguration + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The to use. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, CustomDnsSuffixConfigurationData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _customDnsSuffixConfigurationAppServiceEnvironmentsClientDiagnostics.CreateScope("CustomDnsSuffixConfigurationResource.CreateOrUpdate"); + scope.Start(); + try + { + var response = _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient.UpdateAseCustomDnsSuffixConfiguration(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data, cancellationToken); + var uri = _customDnsSuffixConfigurationAppServiceEnvironmentsRestClient.CreateUpdateAseCustomDnsSuffixConfigurationRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new AppServiceArmOperation(Response.FromValue(new CustomDnsSuffixConfigurationResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DatabaseConnectionData.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DatabaseConnectionData.Serialization.cs new file mode 100644 index 0000000000000..4febed5cb2389 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DatabaseConnectionData.Serialization.cs @@ -0,0 +1,480 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService +{ + public partial class DatabaseConnectionData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DatabaseConnectionData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(ConnectionIdentity)) + { + writer.WritePropertyName("connectionIdentity"u8); + writer.WriteStringValue(ConnectionIdentity); + } + if (Optional.IsDefined(ConnectionString)) + { + writer.WritePropertyName("connectionString"u8); + writer.WriteStringValue(ConnectionString); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ConfigurationFiles)) + { + writer.WritePropertyName("configurationFiles"u8); + writer.WriteStartArray(); + foreach (var item in ConfigurationFiles) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DatabaseConnectionData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DatabaseConnectionData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseConnectionData(document.RootElement, options); + } + + internal static DatabaseConnectionData DeserializeDatabaseConnectionData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + string resourceId = default; + string connectionIdentity = default; + string connectionString = default; + string region = default; + IReadOnlyList configurationFiles = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resourceId"u8)) + { + resourceId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("connectionIdentity"u8)) + { + connectionIdentity = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("connectionString"u8)) + { + connectionString = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("region"u8)) + { + region = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("configurationFiles"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(StaticSiteDatabaseConnectionConfigurationFileOverview.DeserializeStaticSiteDatabaseConnectionConfigurationFileOverview(item, options)); + } + configurationFiles = array; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseConnectionData( + id, + name, + type, + systemData, + resourceId, + connectionIdentity, + connectionString, + region, + configurationFiles ?? new ChangeTrackingList(), + kind, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kind: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Kind)) + { + builder.Append(" kind: "); + if (Kind.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Kind}'''"); + } + else + { + builder.AppendLine($"'{Kind}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceId)) + { + builder.Append(" resourceId: "); + if (ResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceId}'''"); + } + else + { + builder.AppendLine($"'{ResourceId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectionIdentity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" connectionIdentity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ConnectionIdentity)) + { + builder.Append(" connectionIdentity: "); + if (ConnectionIdentity.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ConnectionIdentity}'''"); + } + else + { + builder.AppendLine($"'{ConnectionIdentity}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectionString), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" connectionString: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ConnectionString)) + { + builder.Append(" connectionString: "); + if (ConnectionString.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ConnectionString}'''"); + } + else + { + builder.AppendLine($"'{ConnectionString}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Region), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" region: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Region)) + { + builder.Append(" region: "); + if (Region.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Region}'''"); + } + else + { + builder.AppendLine($"'{Region}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConfigurationFiles), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" configurationFiles: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ConfigurationFiles)) + { + if (ConfigurationFiles.Any()) + { + builder.Append(" configurationFiles: "); + builder.AppendLine("["); + foreach (var item in ConfigurationFiles) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " configurationFiles: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DatabaseConnectionData)} does not support writing '{options.Format}' format."); + } + } + + DatabaseConnectionData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDatabaseConnectionData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseConnectionData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DatabaseConnectionData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DatabaseConnectionData.cs new file mode 100644 index 0000000000000..68428352df2cb --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DatabaseConnectionData.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.AppService.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService +{ + /// + /// A class representing the DatabaseConnection data model. + /// Static Site Database Connection resource. + /// + public partial class DatabaseConnectionData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DatabaseConnectionData() + { + ConfigurationFiles = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource id of the database. + /// If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. + /// The connection string to use to connect to the database. + /// The region of the database resource. + /// A list of configuration files associated with this database connection. + /// Kind of resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string resourceId, string connectionIdentity, string connectionString, string region, IReadOnlyList configurationFiles, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + ResourceId = resourceId; + ConnectionIdentity = connectionIdentity; + ConnectionString = connectionString; + Region = region; + ConfigurationFiles = configurationFiles; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource id of the database. + [WirePath("properties.resourceId")] + public string ResourceId { get; set; } + /// If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. + [WirePath("properties.connectionIdentity")] + public string ConnectionIdentity { get; set; } + /// The connection string to use to connect to the database. + [WirePath("properties.connectionString")] + public string ConnectionString { get; set; } + /// The region of the database resource. + [WirePath("properties.region")] + public string Region { get; set; } + /// A list of configuration files associated with this database connection. + [WirePath("properties.configurationFiles")] + public IReadOnlyList ConfigurationFiles { get; } + /// Kind of resource. + [WirePath("kind")] + public string Kind { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteCollection.cs index 43fd23dd40785..25da33bf2f53f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteCollection.cs @@ -70,7 +70,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> GetAsync(string deleted /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -160,7 +160,7 @@ public virtual Response Get(string deletedSiteId, Cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -190,7 +190,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -220,7 +220,7 @@ public virtual Pageable GetAll(CancellationToken cancellati /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -263,7 +263,7 @@ public virtual async Task> ExistsAsync(string deletedSiteId, Canc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -306,7 +306,7 @@ public virtual Response Exists(string deletedSiteId, CancellationToken can /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -351,7 +351,7 @@ public virtual async Task> GetIfExistsAsyn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteResource.cs index 4ba063204d3a3..24bc3bebdec0a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DeletedSiteResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(CancellationTo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -211,7 +211,7 @@ public virtual AsyncPageable GetDeletedWebAppSnapshotsAsync(Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierCollection.cs index 02162eb430401..87befc1b2adbd 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> Creat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpdate(Wa /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string name, Canc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -286,7 +286,7 @@ public virtual AsyncPageable GetAllAsync(Canc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -316,7 +316,7 @@ public virtual Pageable GetAll(CancellationTo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -359,7 +359,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -402,7 +402,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -447,7 +447,7 @@ public virtual async Task> G /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierResource.cs index a41cc1fbdebc8..d7afcc4ee135c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/DomainOwnershipIdentifierResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync( /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(CancellationToken /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -225,7 +225,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -269,7 +269,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -311,7 +311,7 @@ public virtual async Task> UpdateAsy /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/AppServiceExtensions.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/AppServiceExtensions.cs index 6709a0ca395b4..ba0037adbc2da 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/AppServiceExtensions.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/AppServiceExtensions.cs @@ -228,6 +228,25 @@ public static AppServiceEnvironmentResource GetAppServiceEnvironmentResource(thi return GetMockableAppServiceArmClient(client).GetAppServiceEnvironmentResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static CustomDnsSuffixConfigurationResource GetCustomDnsSuffixConfigurationResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetCustomDnsSuffixConfigurationResource(id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -589,6 +608,44 @@ public static AppCertificateResource GetAppCertificateResource(this ArmClient cl return GetMockableAppServiceArmClient(client).GetAppCertificateResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ContainerAppResource GetContainerAppResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetContainerAppResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static RevisionResource GetRevisionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetRevisionResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -893,6 +950,44 @@ public static StaticSiteBuildResource GetStaticSiteBuildResource(this ArmClient return GetMockableAppServiceArmClient(client).GetStaticSiteBuildResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static StaticSiteBuildDatabaseConnectionResource GetStaticSiteBuildDatabaseConnectionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetStaticSiteBuildDatabaseConnectionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static StaticSiteDatabaseConnectionResource GetStaticSiteDatabaseConnectionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetStaticSiteDatabaseConnectionResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -931,6 +1026,25 @@ public static StaticSiteUserProvidedFunctionAppResource GetStaticSiteUserProvide return GetMockableAppServiceArmClient(client).GetStaticSiteUserProvidedFunctionAppResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static StaticSiteBasicAuthPropertiesARMResource GetStaticSiteBasicAuthPropertiesARMResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetStaticSiteBasicAuthPropertiesARMResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -950,6 +1064,44 @@ public static StaticSiteCustomDomainOverviewResource GetStaticSiteCustomDomainOv return GetMockableAppServiceArmClient(client).GetStaticSiteCustomDomainOverviewResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static StaticSiteLinkedBackendResource GetStaticSiteLinkedBackendResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetStaticSiteLinkedBackendResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static StaticSiteBuildLinkedBackendResource GetStaticSiteBuildLinkedBackendResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetStaticSiteBuildLinkedBackendResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -1102,6 +1254,44 @@ public static ScmSiteSlotBasicPublishingCredentialsPolicyResource GetScmSiteSlot return GetMockableAppServiceArmClient(client).GetScmSiteSlotBasicPublishingCredentialsPolicyResource(id); } + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static AuthsettingsV2SiteConfigResource GetAuthsettingsV2SiteConfigResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetAuthsettingsV2SiteConfigResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static AuthsettingsV2SiteSlotConfigResource GetAuthsettingsV2SiteSlotConfigResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetAuthsettingsV2SiteSlotConfigResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -1349,6 +1539,44 @@ public static WebSiteSlotContinuousWebJobResource GetWebSiteSlotContinuousWebJob return GetMockableAppServiceArmClient(client).GetWebSiteSlotContinuousWebJobResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SiteDeploymentStatuResource GetSiteDeploymentStatuResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetSiteDeploymentStatuResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SiteSlotDeploymentStatuResource GetSiteSlotDeploymentStatuResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetSiteSlotDeploymentStatuResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -1957,6 +2185,44 @@ public static WebSiteSlotPublicCertificateResource GetWebSiteSlotPublicCertifica return GetMockableAppServiceArmClient(client).GetWebSiteSlotPublicCertificateResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SiteSitecontainerResource GetSiteSitecontainerResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetSiteSitecontainerResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SiteSlotSitecontainerResource GetSiteSlotSitecontainerResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetSiteSlotSitecontainerResource(id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -2109,6 +2375,196 @@ public static WebSiteWebJobResource GetWebSiteWebJobResource(this ArmClient clie return GetMockableAppServiceArmClient(client).GetWebSiteWebJobResource(id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SiteSlotWorkflowResource GetSiteSlotWorkflowResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetSiteSlotWorkflowResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SiteWorkflowResource GetSiteWorkflowResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetSiteWorkflowResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static WorkflowRunResource GetWorkflowRunResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetWorkflowRunResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static WorkflowRunActionResource GetWorkflowRunActionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetWorkflowRunActionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource GetSiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetSiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static RequestHistoryResource GetRequestHistoryResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetRequestHistoryResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static WorkflowTriggerResource GetWorkflowTriggerResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetWorkflowTriggerResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static WorkflowTriggerHistoryResource GetWorkflowTriggerHistoryResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetWorkflowTriggerHistoryResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static WorkflowVersionResource GetWorkflowVersionResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAppServiceArmClient(client).GetWorkflowVersionResource(id); + } + /// /// Gets a collection of AppServiceCertificateOrderResources in the ResourceGroupResource. /// @@ -2139,7 +2595,7 @@ public static AppServiceCertificateOrderCollection GetAppServiceCertificateOrder /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2177,7 +2633,7 @@ public static async Task> GetAppSer /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2232,7 +2688,7 @@ public static AppServiceDomainCollection GetAppServiceDomains(this ResourceGroup /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2270,7 +2726,7 @@ public static async Task> GetAppServiceDomain /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2325,7 +2781,7 @@ public static AppServiceEnvironmentCollection GetAppServiceEnvironments(this Res /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2363,7 +2819,7 @@ public static async Task> GetAppServiceE /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2418,7 +2874,7 @@ public static AppServicePlanCollection GetAppServicePlans(this ResourceGroupReso /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2456,7 +2912,7 @@ public static async Task> GetAppServicePlanAsyn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2511,7 +2967,7 @@ public static AppCertificateCollection GetAppCertificates(this ResourceGroupReso /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2549,7 +3005,7 @@ public static async Task> GetAppCertificateAsyn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2567,11 +3023,104 @@ public static async Task> GetAppCertificateAsyn /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetAppCertificate(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) + public static Response GetAppCertificate(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppCertificate(name, cancellationToken); + } + + /// + /// Gets a collection of ContainerAppResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of ContainerAppResources and their operations over a ContainerAppResource. + public static ContainerAppCollection GetContainerApps(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetContainerApps(); + } + + /// + /// Get the properties of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the Container App. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetContainerAppAsync(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetContainerAppAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the Container App. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetContainerApp(this ResourceGroupResource resourceGroupResource, string name, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); - return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetAppCertificate(name, cancellationToken); + return GetMockableAppServiceResourceGroupResource(resourceGroupResource).GetContainerApp(name, cancellationToken); } /// @@ -2604,7 +3153,7 @@ public static KubeEnvironmentCollection GetKubeEnvironments(this ResourceGroupRe /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2642,7 +3191,7 @@ public static async Task> GetKubeEnvironmentAs /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2697,7 +3246,7 @@ public static StaticSiteCollection GetStaticSites(this ResourceGroupResource res /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2735,7 +3284,7 @@ public static async Task> GetStaticSiteAsync(this R /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2790,7 +3339,7 @@ public static WebSiteCollection GetWebSites(this ResourceGroupResource resourceG /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2828,7 +3377,7 @@ public static async Task> GetWebSiteAsync(this Resourc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2866,7 +3415,7 @@ public static Response GetWebSite(this ResourceGroupResource re /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -2898,7 +3447,7 @@ public static async Task> ValidateAsync(this /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -2947,7 +3496,7 @@ public static TopLevelDomainCollection GetTopLevelDomains(this SubscriptionResou /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -2985,7 +3534,7 @@ public static async Task> GetTopLevelDomainAsyn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3040,7 +3589,7 @@ public static DeletedSiteCollection GetDeletedSites(this SubscriptionResource su /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3078,7 +3627,7 @@ public static async Task> GetDeletedSiteAsync(this /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3116,7 +3665,7 @@ public static Response GetDeletedSite(this SubscriptionReso /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3152,7 +3701,7 @@ public static AsyncPageable GetAppServiceCer /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3188,7 +3737,7 @@ public static Pageable GetAppServiceCertific /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -3220,7 +3769,7 @@ public static async Task ValidateAppServiceCertificateOrderPurchaseInf /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -3252,7 +3801,7 @@ public static Response ValidateAppServiceCertificateOrderPurchaseInformation(thi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -3284,7 +3833,7 @@ public static async Task> CheckAppServic /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -3316,7 +3865,7 @@ public static Response CheckAppServiceDomainRegis /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3352,7 +3901,7 @@ public static AsyncPageable GetAppServiceDomainsAsync( /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3388,7 +3937,7 @@ public static Pageable GetAppServiceDomains(this Subsc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -3419,7 +3968,7 @@ public static async Task> GetControl /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -3450,7 +3999,7 @@ public static Response GetControlCenterSsoReq /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -3483,7 +4032,7 @@ public static AsyncPageable GetAppServiceDomainR /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -3516,7 +4065,7 @@ public static Pageable GetAppServiceDomainRecomm /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3552,7 +4101,7 @@ public static AsyncPageable GetAppServiceEnvironm /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3588,7 +4137,7 @@ public static Pageable GetAppServiceEnvironments( /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3628,7 +4177,7 @@ public static AsyncPageable GetAppServicePlansAsync(this /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3668,7 +4217,7 @@ public static Pageable GetAppServicePlans(this Subscript /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3705,7 +4254,7 @@ public static AsyncPageable GetAppCertificatesAsync(this /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3729,6 +4278,154 @@ public static Pageable GetAppCertificates(this Subscript return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppCertificates(filter, cancellationToken); } + /// + /// Get the Container Apps in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/containerApps + /// + /// + /// Operation Id + /// ContainerApps_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetContainerAppsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetContainerAppsAsync(cancellationToken); + } + + /// + /// Get the Container Apps in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/containerApps + /// + /// + /// Operation Id + /// ContainerApps_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetContainerApps(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetContainerApps(cancellationToken); + } + + /// + /// List secrets for a container app + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/containerApps/{name}/listSecrets + /// + /// + /// Operation Id + /// ContainerApps_ListSecrets + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetSecretsContainerAppsAsync(this SubscriptionResource subscriptionResource, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetSecretsContainerAppsAsync(name, cancellationToken); + } + + /// + /// List secrets for a container app + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/containerApps/{name}/listSecrets + /// + /// + /// Operation Id + /// ContainerApps_ListSecrets + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetSecretsContainerApps(this SubscriptionResource subscriptionResource, string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetSecretsContainerApps(name, cancellationToken); + } + /// /// Description for Get all deleted apps for a subscription at location /// @@ -3742,7 +4439,7 @@ public static Pageable GetAppCertificates(this Subscript /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3779,7 +4476,7 @@ public static AsyncPageable GetDeletedSitesByLocationAsync( /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3816,7 +4513,7 @@ public static Pageable GetDeletedSitesByLocation(this Subsc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3854,7 +4551,7 @@ public static async Task> GetDeletedWebAppByLocati /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3892,7 +4589,7 @@ public static Response GetDeletedWebAppByLocationDeletedWeb /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3928,7 +4625,7 @@ public static AsyncPageable GetKubeEnvironmentsAsync(th /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -3964,7 +4661,7 @@ public static Pageable GetKubeEnvironments(this Subscri /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -3997,7 +4694,7 @@ public static AsyncPageable GetAvailableStacksOnPremPr /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4030,7 +4727,7 @@ public static Pageable GetAvailableStacksOnPremProvide /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4064,7 +4761,7 @@ public static AsyncPageable GetRecommendationsAsync(th /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4098,7 +4795,7 @@ public static Pageable GetRecommendations(this Subscri /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4129,7 +4826,7 @@ public static async Task ResetAllRecommendationFiltersAsync(this Subsc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4160,7 +4857,7 @@ public static Response ResetAllRecommendationFilters(this SubscriptionResource s /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4193,7 +4890,7 @@ public static async Task DisableAppServiceRecommendationAsync(this Sub /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4226,7 +4923,7 @@ public static Response DisableAppServiceRecommendation(this SubscriptionResource /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4258,7 +4955,7 @@ public static AsyncPageable GetAllResourceHealthMeta /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4290,7 +4987,7 @@ public static Pageable GetAllResourceHealthMetadata( /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4324,7 +5021,7 @@ public static AsyncPageable GetBillingMetersAsync(this S /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4358,7 +5055,7 @@ public static Pageable GetBillingMeters(this Subscriptio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4390,7 +5087,7 @@ public static async Task> CheckAppServiceName /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4409,6 +5106,72 @@ public static Response CheckAppServiceNameAvailability return GetMockableAppServiceSubscriptionResource(subscriptionResource).CheckAppServiceNameAvailability(content, cancellationToken); } + /// + /// Get custom hostnames under this subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/customhostnameSites + /// + /// + /// Operation Id + /// ListCustomHostNameSites + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Specific hostname. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetCustomHostNameSitesAsync(this SubscriptionResource subscriptionResource, string hostname = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetCustomHostNameSitesAsync(hostname, cancellationToken); + } + + /// + /// Get custom hostnames under this subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/customhostnameSites + /// + /// + /// Operation Id + /// ListCustomHostNameSites + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Specific hostname. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetCustomHostNameSites(this SubscriptionResource subscriptionResource, string hostname = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetCustomHostNameSites(hostname, cancellationToken); + } + /// /// Description for Gets list of available geo regions plus ministamps /// @@ -4422,7 +5185,7 @@ public static Response CheckAppServiceNameAvailability /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4453,7 +5216,7 @@ public static async Task> GetAppServiceD /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4471,6 +5234,70 @@ public static Response GetAppServiceDeploymentLoc return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAppServiceDeploymentLocations(cancellationToken); } + /// + /// Description for get a list of available ASE regions and its supported Skus. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/aseRegions + /// + /// + /// Operation Id + /// ListAseRegions + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetAseRegionsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAseRegionsAsync(cancellationToken); + } + + /// + /// Description for get a list of available ASE regions and its supported Skus. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/aseRegions + /// + /// + /// Operation Id + /// ListAseRegions + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetAseRegions(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetAseRegions(cancellationToken); + } + /// /// Description for Get a list of available geographical regions. /// @@ -4484,7 +5311,7 @@ public static Response GetAppServiceDeploymentLoc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4520,7 +5347,7 @@ public static AsyncPageable GetGeoRegionsAsync(this Subscri /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4556,7 +5383,7 @@ public static Pageable GetGeoRegions(this SubscriptionResou /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4588,7 +5415,7 @@ public static AsyncPageable GetPremierAddOnOffersAsync(this S /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4620,7 +5447,7 @@ public static Pageable GetPremierAddOnOffers(this Subscriptio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4651,7 +5478,7 @@ public static async Task> GetSkusAsync(this Subscr /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4682,7 +5509,7 @@ public static Response GetSkus(this SubscriptionResource su /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4714,7 +5541,7 @@ public static async Task> Verif /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4733,6 +5560,72 @@ public static Response VerifyHostingEnvi return GetMockableAppServiceSubscriptionResource(subscriptionResource).VerifyHostingEnvironmentVnet(content, cancellationToken); } + /// + /// List usages in cores for all skus used by a subscription in a given location, for a specific quota type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/usages + /// + /// + /// Operation Id + /// GetUsagesInLocation_List + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetGetUsagesInLocationsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetGetUsagesInLocationsAsync(location, cancellationToken); + } + + /// + /// List usages in cores for all skus used by a subscription in a given location, for a specific quota type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/usages + /// + /// + /// Operation Id + /// GetUsagesInLocation_List + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the Azure region. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetGetUsagesInLocations(this SubscriptionResource subscriptionResource, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAppServiceSubscriptionResource(subscriptionResource).GetGetUsagesInLocations(location, cancellationToken); + } + /// /// Description for Generates a preview workflow file for the static site /// @@ -4746,7 +5639,7 @@ public static Response VerifyHostingEnvi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4779,7 +5672,7 @@ public static async Task> PreviewStaticSite /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -4812,7 +5705,7 @@ public static Response PreviewStaticSiteWorkflow(thi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -4848,7 +5741,7 @@ public static AsyncPageable GetStaticSitesAsync(this Subscri /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -4884,7 +5777,7 @@ public static Pageable GetStaticSites(this SubscriptionResou /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -4920,7 +5813,7 @@ public static AsyncPageable GetWebSitesAsync(this SubscriptionR /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -4990,7 +5883,7 @@ public static AppServiceSourceControlCollection GetAppServiceSourceControls(this /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -5028,7 +5921,7 @@ public static async Task> GetAppServic /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -5066,7 +5959,7 @@ public static Response GetAppServiceSourceContr /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5098,7 +5991,7 @@ public static AsyncPageable GetOperationsCertificateReg /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5130,7 +6023,7 @@ public static Pageable GetOperationsCertificateRegistra /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5162,7 +6055,7 @@ public static AsyncPageable GetOperationsDomainRegistra /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5194,7 +6087,7 @@ public static Pageable GetOperationsDomainRegistrationP /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5227,7 +6120,7 @@ public static AsyncPageable GetAvailableStacksProvider /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5260,7 +6153,7 @@ public static Pageable GetAvailableStacksProviders(thi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5293,7 +6186,7 @@ public static AsyncPageable GetFunctionAppStacksProvidersAsync /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5326,7 +6219,7 @@ public static Pageable GetFunctionAppStacksProviders(this Tena /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5360,7 +6253,7 @@ public static AsyncPageable GetFunctionAppStacksForLocationPro /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5394,7 +6287,7 @@ public static Pageable GetFunctionAppStacksForLocationProvider /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5428,7 +6321,7 @@ public static AsyncPageable GetWebAppStacksByLocationAsync(this Ten /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5462,7 +6355,7 @@ public static Pageable GetWebAppStacksByLocation(this TenantResourc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5494,7 +6387,7 @@ public static AsyncPageable GetOperationsProvidersAsync /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5526,7 +6419,7 @@ public static Pageable GetOperationsProviders(this Tena /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -5559,7 +6452,7 @@ public static AsyncPageable GetWebAppStacksProvidersAsync(this Tena /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceArmClient.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceArmClient.cs index adb98651f1bb5..1f16353afe6ed 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceArmClient.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceArmClient.cs @@ -154,6 +154,18 @@ public virtual AppServiceEnvironmentResource GetAppServiceEnvironmentResource(Re return new AppServiceEnvironmentResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual CustomDnsSuffixConfigurationResource GetCustomDnsSuffixConfigurationResource(ResourceIdentifier id) + { + CustomDnsSuffixConfigurationResource.ValidateResourceId(id); + return new CustomDnsSuffixConfigurationResource(Client, id); + } + /// /// Gets an object representing an along with the instance operations that can be performed on it but with no data. /// You can use to create an from its components. @@ -382,6 +394,30 @@ public virtual AppCertificateResource GetAppCertificateResource(ResourceIdentifi return new AppCertificateResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ContainerAppResource GetContainerAppResource(ResourceIdentifier id) + { + ContainerAppResource.ValidateResourceId(id); + return new ContainerAppResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RevisionResource GetRevisionResource(ResourceIdentifier id) + { + RevisionResource.ValidateResourceId(id); + return new RevisionResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -574,6 +610,30 @@ public virtual StaticSiteBuildResource GetStaticSiteBuildResource(ResourceIdenti return new StaticSiteBuildResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSiteBuildDatabaseConnectionResource GetStaticSiteBuildDatabaseConnectionResource(ResourceIdentifier id) + { + StaticSiteBuildDatabaseConnectionResource.ValidateResourceId(id); + return new StaticSiteBuildDatabaseConnectionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSiteDatabaseConnectionResource GetStaticSiteDatabaseConnectionResource(ResourceIdentifier id) + { + StaticSiteDatabaseConnectionResource.ValidateResourceId(id); + return new StaticSiteDatabaseConnectionResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -598,6 +658,18 @@ public virtual StaticSiteUserProvidedFunctionAppResource GetStaticSiteUserProvid return new StaticSiteUserProvidedFunctionAppResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSiteBasicAuthPropertiesARMResource GetStaticSiteBasicAuthPropertiesARMResource(ResourceIdentifier id) + { + StaticSiteBasicAuthPropertiesARMResource.ValidateResourceId(id); + return new StaticSiteBasicAuthPropertiesARMResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -610,6 +682,30 @@ public virtual StaticSiteCustomDomainOverviewResource GetStaticSiteCustomDomainO return new StaticSiteCustomDomainOverviewResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSiteLinkedBackendResource GetStaticSiteLinkedBackendResource(ResourceIdentifier id) + { + StaticSiteLinkedBackendResource.ValidateResourceId(id); + return new StaticSiteLinkedBackendResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual StaticSiteBuildLinkedBackendResource GetStaticSiteBuildLinkedBackendResource(ResourceIdentifier id) + { + StaticSiteBuildLinkedBackendResource.ValidateResourceId(id); + return new StaticSiteBuildLinkedBackendResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -706,6 +802,30 @@ public virtual ScmSiteSlotBasicPublishingCredentialsPolicyResource GetScmSiteSlo return new ScmSiteSlotBasicPublishingCredentialsPolicyResource(Client, id); } + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual AuthsettingsV2SiteConfigResource GetAuthsettingsV2SiteConfigResource(ResourceIdentifier id) + { + AuthsettingsV2SiteConfigResource.ValidateResourceId(id); + return new AuthsettingsV2SiteConfigResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual AuthsettingsV2SiteSlotConfigResource GetAuthsettingsV2SiteSlotConfigResource(ResourceIdentifier id) + { + AuthsettingsV2SiteSlotConfigResource.ValidateResourceId(id); + return new AuthsettingsV2SiteSlotConfigResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -862,6 +982,30 @@ public virtual WebSiteSlotContinuousWebJobResource GetWebSiteSlotContinuousWebJo return new WebSiteSlotContinuousWebJobResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteDeploymentStatuResource GetSiteDeploymentStatuResource(ResourceIdentifier id) + { + SiteDeploymentStatuResource.ValidateResourceId(id); + return new SiteDeploymentStatuResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotDeploymentStatuResource GetSiteSlotDeploymentStatuResource(ResourceIdentifier id) + { + SiteSlotDeploymentStatuResource.ValidateResourceId(id); + return new SiteSlotDeploymentStatuResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -1246,6 +1390,30 @@ public virtual WebSiteSlotPublicCertificateResource GetWebSiteSlotPublicCertific return new WebSiteSlotPublicCertificateResource(Client, id); } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSitecontainerResource GetSiteSitecontainerResource(ResourceIdentifier id) + { + SiteSitecontainerResource.ValidateResourceId(id); + return new SiteSitecontainerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotSitecontainerResource GetSiteSlotSitecontainerResource(ResourceIdentifier id) + { + SiteSlotSitecontainerResource.ValidateResourceId(id); + return new SiteSlotSitecontainerResource(Client, id); + } + /// /// Gets an object representing a along with the instance operations that can be performed on it but with no data. /// You can use to create a from its components. @@ -1341,5 +1509,125 @@ public virtual WebSiteWebJobResource GetWebSiteWebJobResource(ResourceIdentifier WebSiteWebJobResource.ValidateResourceId(id); return new WebSiteWebJobResource(Client, id); } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteSlotWorkflowResource GetSiteSlotWorkflowResource(ResourceIdentifier id) + { + SiteSlotWorkflowResource.ValidateResourceId(id); + return new SiteSlotWorkflowResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteWorkflowResource GetSiteWorkflowResource(ResourceIdentifier id) + { + SiteWorkflowResource.ValidateResourceId(id); + return new SiteWorkflowResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkflowRunResource GetWorkflowRunResource(ResourceIdentifier id) + { + WorkflowRunResource.ValidateResourceId(id); + return new WorkflowRunResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkflowRunActionResource GetWorkflowRunActionResource(ResourceIdentifier id) + { + WorkflowRunActionResource.ValidateResourceId(id); + return new WorkflowRunActionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource GetSiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource(ResourceIdentifier id) + { + SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource.ValidateResourceId(id); + return new SiteHostruntimeWebhookApiWorkflowRunActionRepetitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource GetSiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource(ResourceIdentifier id) + { + SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource.ValidateResourceId(id); + return new SiteHostruntimeWebhookApiWorkflowRunActionScopeRepetitionResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual RequestHistoryResource GetRequestHistoryResource(ResourceIdentifier id) + { + RequestHistoryResource.ValidateResourceId(id); + return new RequestHistoryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkflowTriggerResource GetWorkflowTriggerResource(ResourceIdentifier id) + { + WorkflowTriggerResource.ValidateResourceId(id); + return new WorkflowTriggerResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkflowTriggerHistoryResource GetWorkflowTriggerHistoryResource(ResourceIdentifier id) + { + WorkflowTriggerHistoryResource.ValidateResourceId(id); + return new WorkflowTriggerHistoryResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkflowVersionResource GetWorkflowVersionResource(ResourceIdentifier id) + { + WorkflowVersionResource.ValidateResourceId(id); + return new WorkflowVersionResource(Client, id); + } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceResourceGroupResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceResourceGroupResource.cs index ed705c9a07c91..4a5783a72f191 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceResourceGroupResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceResourceGroupResource.cs @@ -66,7 +66,7 @@ public virtual AppServiceCertificateOrderCollection GetAppServiceCertificateOrde /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -97,7 +97,7 @@ public virtual async Task> GetAppSe /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -135,7 +135,7 @@ public virtual AppServiceDomainCollection GetAppServiceDomains() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -166,7 +166,7 @@ public virtual async Task> GetAppServiceDomai /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -204,7 +204,7 @@ public virtual AppServiceEnvironmentCollection GetAppServiceEnvironments() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -235,7 +235,7 @@ public virtual async Task> GetAppService /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -273,7 +273,7 @@ public virtual AppServicePlanCollection GetAppServicePlans() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -304,7 +304,7 @@ public virtual async Task> GetAppServicePlanAsy /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -342,7 +342,7 @@ public virtual AppCertificateCollection GetAppCertificates() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -373,7 +373,7 @@ public virtual async Task> GetAppCertificateAsy /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -391,6 +391,75 @@ public virtual Response GetAppCertificate(string name, C return GetAppCertificates().Get(name, cancellationToken); } + /// Gets a collection of ContainerAppResources in the ResourceGroupResource. + /// An object representing collection of ContainerAppResources and their operations over a ContainerAppResource. + public virtual ContainerAppCollection GetContainerApps() + { + return GetCachedClient(client => new ContainerAppCollection(client, Id)); + } + + /// + /// Get the properties of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetContainerAppAsync(string name, CancellationToken cancellationToken = default) + { + return await GetContainerApps().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a Container App. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Web/containerApps/{name} + /// + /// + /// Operation Id + /// ContainerApps_Get + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetContainerApp(string name, CancellationToken cancellationToken = default) + { + return GetContainerApps().Get(name, cancellationToken); + } + /// Gets a collection of KubeEnvironmentResources in the ResourceGroupResource. /// An object representing collection of KubeEnvironmentResources and their operations over a KubeEnvironmentResource. public virtual KubeEnvironmentCollection GetKubeEnvironments() @@ -411,7 +480,7 @@ public virtual KubeEnvironmentCollection GetKubeEnvironments() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -442,7 +511,7 @@ public virtual async Task> GetKubeEnvironmentA /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -480,7 +549,7 @@ public virtual StaticSiteCollection GetStaticSites() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -511,7 +580,7 @@ public virtual async Task> GetStaticSiteAsync(strin /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -549,7 +618,7 @@ public virtual WebSiteCollection GetWebSites() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -580,7 +649,7 @@ public virtual async Task> GetWebSiteAsync(string name /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -611,7 +680,7 @@ public virtual Response GetWebSite(string name, CancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -649,7 +718,7 @@ public virtual async Task> ValidateAsync(AppS /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceSubscriptionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceSubscriptionResource.cs index 7c387626132f9..e900823affeba 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceSubscriptionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceSubscriptionResource.cs @@ -32,6 +32,8 @@ public partial class MockableAppServiceSubscriptionResource : ArmResource private AppServicePlansRestOperations _appServicePlanRestClient; private ClientDiagnostics _appCertificateCertificatesClientDiagnostics; private CertificatesRestOperations _appCertificateCertificatesRestClient; + private ClientDiagnostics _containerAppClientDiagnostics; + private ContainerAppsRestOperations _containerAppRestClient; private ClientDiagnostics _deletedSiteDeletedWebAppsClientDiagnostics; private DeletedWebAppsRestOperations _deletedSiteDeletedWebAppsRestClient; private ClientDiagnostics _kubeEnvironmentClientDiagnostics; @@ -44,6 +46,8 @@ public partial class MockableAppServiceSubscriptionResource : ArmResource private ResourceHealthMetadataRestOperations _resourceHealthMetadataRestClient; private ClientDiagnostics _defaultClientDiagnostics; private WebSiteManagementRestOperations _defaultRestClient; + private ClientDiagnostics _getUsagesInLocationClientDiagnostics; + private GetUsagesInLocationRestOperations _getUsagesInLocationRestClient; private ClientDiagnostics _staticSitesClientDiagnostics; private StaticSitesRestOperations _staticSitesRestClient; private ClientDiagnostics _staticSiteClientDiagnostics; @@ -77,6 +81,8 @@ internal MockableAppServiceSubscriptionResource(ArmClient client, ResourceIdenti private AppServicePlansRestOperations AppServicePlanRestClient => _appServicePlanRestClient ??= new AppServicePlansRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppServicePlanResource.ResourceType)); private ClientDiagnostics AppCertificateCertificatesClientDiagnostics => _appCertificateCertificatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", AppCertificateResource.ResourceType.Namespace, Diagnostics); private CertificatesRestOperations AppCertificateCertificatesRestClient => _appCertificateCertificatesRestClient ??= new CertificatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AppCertificateResource.ResourceType)); + private ClientDiagnostics ContainerAppClientDiagnostics => _containerAppClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ContainerAppResource.ResourceType.Namespace, Diagnostics); + private ContainerAppsRestOperations ContainerAppRestClient => _containerAppRestClient ??= new ContainerAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ContainerAppResource.ResourceType)); private ClientDiagnostics DeletedSiteDeletedWebAppsClientDiagnostics => _deletedSiteDeletedWebAppsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", DeletedSiteResource.ResourceType.Namespace, Diagnostics); private DeletedWebAppsRestOperations DeletedSiteDeletedWebAppsRestClient => _deletedSiteDeletedWebAppsRestClient ??= new DeletedWebAppsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DeletedSiteResource.ResourceType)); private ClientDiagnostics KubeEnvironmentClientDiagnostics => _kubeEnvironmentClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", KubeEnvironmentResource.ResourceType.Namespace, Diagnostics); @@ -89,6 +95,8 @@ internal MockableAppServiceSubscriptionResource(ArmClient client, ResourceIdenti private ResourceHealthMetadataRestOperations ResourceHealthMetadataRestClient => _resourceHealthMetadataRestClient ??= new ResourceHealthMetadataRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics DefaultClientDiagnostics => _defaultClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); private WebSiteManagementRestOperations DefaultRestClient => _defaultRestClient ??= new WebSiteManagementRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + private ClientDiagnostics GetUsagesInLocationClientDiagnostics => _getUsagesInLocationClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private GetUsagesInLocationRestOperations GetUsagesInLocationRestClient => _getUsagesInLocationRestClient ??= new GetUsagesInLocationRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics StaticSitesClientDiagnostics => _staticSitesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", ProviderConstants.DefaultProviderNamespace, Diagnostics); private StaticSitesRestOperations StaticSitesRestClient => _staticSitesRestClient ??= new StaticSitesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics StaticSiteClientDiagnostics => _staticSiteClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AppService", StaticSiteResource.ResourceType.Namespace, Diagnostics); @@ -122,7 +130,7 @@ public virtual TopLevelDomainCollection GetTopLevelDomains() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -153,7 +161,7 @@ public virtual async Task> GetTopLevelDomainAsy /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -191,7 +199,7 @@ public virtual DeletedSiteCollection GetDeletedSites() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -222,7 +230,7 @@ public virtual async Task> GetDeletedSiteAsync(str /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -253,7 +261,7 @@ public virtual Response GetDeletedSite(string deletedSiteId /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -283,7 +291,7 @@ public virtual AsyncPageable GetAppServiceCe /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -313,7 +321,7 @@ public virtual Pageable GetAppServiceCertifi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -351,7 +359,7 @@ public virtual async Task ValidateAppServiceCertificateOrderPurchaseIn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -389,7 +397,7 @@ public virtual Response ValidateAppServiceCertificateOrderPurchaseInformation(Ap /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -427,7 +435,7 @@ public virtual async Task> CheckAppServi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -465,7 +473,7 @@ public virtual Response CheckAppServiceDomainRegi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -495,7 +503,7 @@ public virtual AsyncPageable GetAppServiceDomainsAsync /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -525,7 +533,7 @@ public virtual Pageable GetAppServiceDomains(Cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -559,7 +567,7 @@ public virtual async Task> GetContro /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -593,7 +601,7 @@ public virtual Response GetControlCenterSsoRe /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -623,7 +631,7 @@ public virtual AsyncPageable GetAppServiceDomain /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -653,7 +661,7 @@ public virtual Pageable GetAppServiceDomainRecom /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -683,7 +691,7 @@ public virtual AsyncPageable GetAppServiceEnviron /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -713,7 +721,7 @@ public virtual Pageable GetAppServiceEnvironments /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -747,7 +755,7 @@ public virtual AsyncPageable GetAppServicePlansAsync(boo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -781,7 +789,7 @@ public virtual Pageable GetAppServicePlans(bool? detaile /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -812,7 +820,7 @@ public virtual AsyncPageable GetAppCertificatesAsync(str /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -830,6 +838,134 @@ public virtual Pageable GetAppCertificates(string filter return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AppCertificateResource(Client, AppCertificateData.DeserializeAppCertificateData(e)), AppCertificateCertificatesClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAppCertificates", "value", "nextLink", cancellationToken); } + /// + /// Get the Container Apps in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/containerApps + /// + /// + /// Operation Id + /// ContainerApps_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetContainerAppsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), ContainerAppClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetContainerApps", "value", "nextLink", cancellationToken); + } + + /// + /// Get the Container Apps in a given subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/containerApps + /// + /// + /// Operation Id + /// ContainerApps_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetContainerApps(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ContainerAppRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ContainerAppResource(Client, ContainerAppData.DeserializeContainerAppData(e)), ContainerAppClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetContainerApps", "value", "nextLink", cancellationToken); + } + + /// + /// List secrets for a container app + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/containerApps/{name}/listSecrets + /// + /// + /// Operation Id + /// ContainerApps_ListSecrets + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecretsContainerAppsAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppRestClient.CreateListSecretsRequest(Id.SubscriptionId, name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => ContainerAppSecret.DeserializeContainerAppSecret(e), ContainerAppClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetSecretsContainerApps", "value", null, cancellationToken); + } + + /// + /// List secrets for a container app + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/containerApps/{name}/listSecrets + /// + /// + /// Operation Id + /// ContainerApps_ListSecrets + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Container App. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecretsContainerApps(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => ContainerAppRestClient.CreateListSecretsRequest(Id.SubscriptionId, name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => ContainerAppSecret.DeserializeContainerAppSecret(e), ContainerAppClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetSecretsContainerApps", "value", null, cancellationToken); + } + /// /// Description for Get all deleted apps for a subscription at location /// @@ -843,7 +979,7 @@ public virtual Pageable GetAppCertificates(string filter /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -874,7 +1010,7 @@ public virtual AsyncPageable GetDeletedSitesByLocationAsync /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -905,7 +1041,7 @@ public virtual Pageable GetDeletedSitesByLocation(AzureLoca /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -949,7 +1085,7 @@ public virtual async Task> GetDeletedWebAppByLocat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -993,7 +1129,7 @@ public virtual Response GetDeletedWebAppByLocationDeletedWe /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1023,7 +1159,7 @@ public virtual AsyncPageable GetKubeEnvironmentsAsync(C /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1053,7 +1189,7 @@ public virtual Pageable GetKubeEnvironments(Cancellatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1080,7 +1216,7 @@ public virtual AsyncPageable GetAvailableStacksOnPremP /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1107,7 +1243,7 @@ public virtual Pageable GetAvailableStacksOnPremProvid /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1135,7 +1271,7 @@ public virtual AsyncPageable GetRecommendationsAsync(b /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1163,7 +1299,7 @@ public virtual Pageable GetRecommendations(bool? featu /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1197,7 +1333,7 @@ public virtual async Task ResetAllRecommendationFiltersAsync(Cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1231,7 +1367,7 @@ public virtual Response ResetAllRecommendationFilters(CancellationToken cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1270,7 +1406,7 @@ public virtual async Task DisableAppServiceRecommendationAsync(string /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1309,7 +1445,7 @@ public virtual Response DisableAppServiceRecommendation(string name, Cancellatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1335,7 +1471,7 @@ public virtual AsyncPageable GetAllResourceHealthMet /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1361,7 +1497,7 @@ public virtual Pageable GetAllResourceHealthMetadata /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1389,7 +1525,7 @@ public virtual AsyncPageable GetBillingMetersAsync(strin /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1417,7 +1553,7 @@ public virtual Pageable GetBillingMeters(string billingL /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1455,7 +1591,7 @@ public virtual async Task> CheckAppServiceNam /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1480,6 +1616,60 @@ public virtual Response CheckAppServiceNameAvailabilit } } + /// + /// Get custom hostnames under this subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/customhostnameSites + /// + /// + /// Operation Id + /// ListCustomHostNameSites + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// Specific hostname. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetCustomHostNameSitesAsync(string hostname = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListCustomHostNameSitesRequest(Id.SubscriptionId, hostname); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListCustomHostNameSitesNextPageRequest(nextLink, Id.SubscriptionId, hostname); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => CustomHostnameSites.DeserializeCustomHostnameSites(e), DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetCustomHostNameSites", "value", "nextLink", cancellationToken); + } + + /// + /// Get custom hostnames under this subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/customhostnameSites + /// + /// + /// Operation Id + /// ListCustomHostNameSites + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// Specific hostname. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetCustomHostNameSites(string hostname = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListCustomHostNameSitesRequest(Id.SubscriptionId, hostname); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListCustomHostNameSitesNextPageRequest(nextLink, Id.SubscriptionId, hostname); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => CustomHostnameSites.DeserializeCustomHostnameSites(e), DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetCustomHostNameSites", "value", "nextLink", cancellationToken); + } + /// /// Description for Gets list of available geo regions plus ministamps /// @@ -1493,7 +1683,7 @@ public virtual Response CheckAppServiceNameAvailabilit /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1527,7 +1717,7 @@ public virtual async Task> GetAppService /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1548,6 +1738,58 @@ public virtual Response GetAppServiceDeploymentLo } } + /// + /// Description for get a list of available ASE regions and its supported Skus. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/aseRegions + /// + /// + /// Operation Id + /// ListAseRegions + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAseRegionsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListAseRegionsRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListAseRegionsNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => AseRegion.DeserializeAseRegion(e), DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAseRegions", "value", "nextLink", cancellationToken); + } + + /// + /// Description for get a list of available ASE regions and its supported Skus. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/aseRegions + /// + /// + /// Operation Id + /// ListAseRegions + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAseRegions(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => DefaultRestClient.CreateListAseRegionsRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DefaultRestClient.CreateListAseRegionsNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => AseRegion.DeserializeAseRegion(e), DefaultClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetAseRegions", "value", "nextLink", cancellationToken); + } + /// /// Description for Get a list of available geographical regions. /// @@ -1561,7 +1803,7 @@ public virtual Response GetAppServiceDeploymentLo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1591,7 +1833,7 @@ public virtual AsyncPageable GetGeoRegionsAsync(AppServiceS /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1621,7 +1863,7 @@ public virtual Pageable GetGeoRegions(AppServiceSkuName? sk /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1647,7 +1889,7 @@ public virtual AsyncPageable GetPremierAddOnOffersAsync(Cance /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1673,7 +1915,7 @@ public virtual Pageable GetPremierAddOnOffers(CancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1707,7 +1949,7 @@ public virtual async Task> GetSkusAsync(Cancellati /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1741,7 +1983,7 @@ public virtual Response GetSkus(CancellationToken cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1779,7 +2021,7 @@ public virtual async Task> Veri /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1804,6 +2046,60 @@ public virtual Response VerifyHostingEnv } } + /// + /// List usages in cores for all skus used by a subscription in a given location, for a specific quota type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/usages + /// + /// + /// Operation Id + /// GetUsagesInLocation_List + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGetUsagesInLocationsAsync(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GetUsagesInLocationRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GetUsagesInLocationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => CsmUsageQuota.DeserializeCsmUsageQuota(e), GetUsagesInLocationClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetGetUsagesInLocations", "value", "nextLink", cancellationToken); + } + + /// + /// List usages in cores for all skus used by a subscription in a given location, for a specific quota type. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Web/locations/{location}/usages + /// + /// + /// Operation Id + /// GetUsagesInLocation_List + /// + /// + /// Default Api Version + /// 2024-04-01 + /// + /// + /// + /// The name of the Azure region. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGetUsagesInLocations(AzureLocation location, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => GetUsagesInLocationRestClient.CreateListRequest(Id.SubscriptionId, location); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => GetUsagesInLocationRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, location); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => CsmUsageQuota.DeserializeCsmUsageQuota(e), GetUsagesInLocationClientDiagnostics, Pipeline, "MockableAppServiceSubscriptionResource.GetGetUsagesInLocations", "value", "nextLink", cancellationToken); + } + /// /// Description for Generates a preview workflow file for the static site /// @@ -1817,7 +2113,7 @@ public virtual Response VerifyHostingEnv /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1856,7 +2152,7 @@ public virtual async Task> PreviewStaticSit /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -1895,7 +2191,7 @@ public virtual Response PreviewStaticSiteWorkflow(Az /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1925,7 +2221,7 @@ public virtual AsyncPageable GetStaticSitesAsync(Cancellatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1955,7 +2251,7 @@ public virtual Pageable GetStaticSites(CancellationToken can /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -1985,7 +2281,7 @@ public virtual AsyncPageable GetWebSitesAsync(CancellationToken /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceTenantResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceTenantResource.cs index b703e2ab27ccf..afad872733257 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceTenantResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Extensions/MockableAppServiceTenantResource.cs @@ -77,7 +77,7 @@ public virtual AppServiceSourceControlCollection GetAppServiceSourceControls() /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -108,7 +108,7 @@ public virtual async Task> GetAppServi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -139,7 +139,7 @@ public virtual Response GetAppServiceSourceCont /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -165,7 +165,7 @@ public virtual AsyncPageable GetOperationsCertificateRe /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -191,7 +191,7 @@ public virtual Pageable GetOperationsCertificateRegistr /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -217,7 +217,7 @@ public virtual AsyncPageable GetOperationsDomainRegistr /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -243,7 +243,7 @@ public virtual Pageable GetOperationsDomainRegistration /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -270,7 +270,7 @@ public virtual AsyncPageable GetAvailableStacksProvide /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -297,7 +297,7 @@ public virtual Pageable GetAvailableStacksProviders(Pr /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -324,7 +324,7 @@ public virtual AsyncPageable GetFunctionAppStacksProvidersAsyn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -351,7 +351,7 @@ public virtual Pageable GetFunctionAppStacksProviders(Provider /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -379,7 +379,7 @@ public virtual AsyncPageable GetFunctionAppStacksForLocationPr /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -407,7 +407,7 @@ public virtual Pageable GetFunctionAppStacksForLocationProvide /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -435,7 +435,7 @@ public virtual AsyncPageable GetWebAppStacksByLocationAsync(AzureLo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -463,7 +463,7 @@ public virtual Pageable GetWebAppStacksByLocation(AzureLocation loc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -489,7 +489,7 @@ public virtual AsyncPageable GetOperationsProvidersAsyn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -515,7 +515,7 @@ public virtual Pageable GetOperationsProviders(Cancella /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -542,7 +542,7 @@ public virtual AsyncPageable GetWebAppStacksProvidersAsync(Provider /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorCollection.cs index b95fbd4ceb00a..70b785452c2f9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -112,7 +112,7 @@ public virtual async Task> GetAsync /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -160,7 +160,7 @@ public virtual Response Get(string detectorN /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -190,7 +190,7 @@ public virtual AsyncPageable GetAllAsync(Can /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -220,7 +220,7 @@ public virtual Pageable GetAll(CancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -266,7 +266,7 @@ public virtual async Task> ExistsAsync(string detectorName, DateT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Response Exists(string detectorName, DateTimeOffset? startT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -360,7 +360,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorResource.cs index afeb4ca2c0868..89eb5886fa266 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentDetectorResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -144,7 +144,7 @@ public virtual async Task> GetAsync /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentMultiRolePoolResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentMultiRolePoolResource.cs index 63e149c91635a..f73111354a553 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentMultiRolePoolResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentMultiRolePoolResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> Get /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(Cancellatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -224,7 +224,7 @@ public virtual async Task> Upd /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -266,7 +266,7 @@ public virtual Response Update(AppServi /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -312,7 +312,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -358,7 +358,7 @@ public virtual ArmOperation CreateOrUpd /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -389,7 +389,7 @@ public virtual AsyncPageable GetMultiRolePoolInstanceM /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -420,7 +420,7 @@ public virtual Pageable GetMultiRolePoolInstanceMetric /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -450,7 +450,7 @@ public virtual AsyncPageable GetMultiRoleMetricDefinit /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -480,7 +480,7 @@ public virtual Pageable GetMultiRoleMetricDefinitions( /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -510,7 +510,7 @@ public virtual AsyncPageable GetMultiRolePoolSkusAsync(Ca /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -540,7 +540,7 @@ public virtual Pageable GetMultiRolePoolSkus(Cancellation /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -570,7 +570,7 @@ public virtual AsyncPageable GetMultiRoleUsagesAsync(Cancellati /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionCollection.cs index 71365c8fbcdf2..efdc5781732a9 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionCollection.cs @@ -14,7 +14,6 @@ using Autorest.CSharp.Core; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.AppService.Models; namespace Azure.ResourceManager.AppService { @@ -65,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -75,21 +74,21 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The to use. - /// The to use. + /// The to use. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, PrivateLinkConnectionApprovalRequestInfo info, CancellationToken cancellationToken = default) + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, RemotePrivateEndpointConnectionARMResourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(info, nameof(info)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics.CreateScope("HostingEnvironmentPrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.ApproveOrRejectPrivateEndpointConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, info, cancellationToken).ConfigureAwait(false); - var operation = new AppServiceArmOperation(new HostingEnvironmentPrivateEndpointConnectionOperationSource(Client), _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics, Pipeline, _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.CreateApproveOrRejectPrivateEndpointConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, info).Request, response, OperationFinalStateVia.Location); + var response = await _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.ApproveOrRejectPrivateEndpointConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken).ConfigureAwait(false); + var operation = new AppServiceArmOperation(new HostingEnvironmentPrivateEndpointConnectionOperationSource(Client), _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics, Pipeline, _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.CreateApproveOrRejectPrivateEndpointConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -114,7 +113,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -124,21 +123,21 @@ public virtual async Task /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. /// The to use. - /// The to use. + /// The to use. /// The cancellation token to use. /// is an empty string, and was expected to be non-empty. - /// or is null. - public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, PrivateLinkConnectionApprovalRequestInfo info, CancellationToken cancellationToken = default) + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, RemotePrivateEndpointConnectionARMResourceData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); - Argument.AssertNotNull(info, nameof(info)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics.CreateScope("HostingEnvironmentPrivateEndpointConnectionCollection.CreateOrUpdate"); scope.Start(); try { - var response = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.ApproveOrRejectPrivateEndpointConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, info, cancellationToken); - var operation = new AppServiceArmOperation(new HostingEnvironmentPrivateEndpointConnectionOperationSource(Client), _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics, Pipeline, _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.CreateApproveOrRejectPrivateEndpointConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, info).Request, response, OperationFinalStateVia.Location); + var response = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.ApproveOrRejectPrivateEndpointConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); + var operation = new AppServiceArmOperation(new HostingEnvironmentPrivateEndpointConnectionOperationSource(Client), _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics, Pipeline, _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.CreateApproveOrRejectPrivateEndpointConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -163,7 +162,7 @@ public virtual ArmOperation /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -208,7 +207,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -253,7 +252,7 @@ public virtual Response Get /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -283,7 +282,7 @@ public virtual AsyncPageable /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -313,7 +312,7 @@ public virtual Pageable Get /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -356,7 +355,7 @@ public virtual async Task> ExistsAsync(string privateEndpointConn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -399,7 +398,7 @@ public virtual Response Exists(string privateEndpointConnectionName, Cance /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -444,7 +443,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionResource.cs index d2f9c8bbe2244..fa73801e11b66 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentPrivateEndpointConnectionResource.cs @@ -11,7 +11,6 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Core.Pipeline; -using Azure.ResourceManager.AppService.Models; namespace Azure.ResourceManager.AppService { @@ -102,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -142,7 +141,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -182,7 +181,7 @@ public virtual Response Get /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -224,7 +223,7 @@ public virtual async Task> DeleteAsync(WaitUntil waitUn /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -266,7 +265,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, Cancellation /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -275,19 +274,19 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, Cancellation /// /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The to use. + /// The to use. /// The cancellation token to use. - /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, PrivateLinkConnectionApprovalRequestInfo info, CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, RemotePrivateEndpointConnectionARMResourceData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(info, nameof(info)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics.CreateScope("HostingEnvironmentPrivateEndpointConnectionResource.Update"); scope.Start(); try { - var response = await _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.ApproveOrRejectPrivateEndpointConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, info, cancellationToken).ConfigureAwait(false); - var operation = new AppServiceArmOperation(new HostingEnvironmentPrivateEndpointConnectionOperationSource(Client), _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics, Pipeline, _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.CreateApproveOrRejectPrivateEndpointConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, info).Request, response, OperationFinalStateVia.Location); + var response = await _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.ApproveOrRejectPrivateEndpointConnectionAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new AppServiceArmOperation(new HostingEnvironmentPrivateEndpointConnectionOperationSource(Client), _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics, Pipeline, _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.CreateApproveOrRejectPrivateEndpointConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -312,7 +311,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -321,19 +320,19 @@ public virtual async Task /// /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. - /// The to use. + /// The to use. /// The cancellation token to use. - /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, PrivateLinkConnectionApprovalRequestInfo info, CancellationToken cancellationToken = default) + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, RemotePrivateEndpointConnectionARMResourceData data, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(info, nameof(info)); + Argument.AssertNotNull(data, nameof(data)); using var scope = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics.CreateScope("HostingEnvironmentPrivateEndpointConnectionResource.Update"); scope.Start(); try { - var response = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.ApproveOrRejectPrivateEndpointConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, info, cancellationToken); - var operation = new AppServiceArmOperation(new HostingEnvironmentPrivateEndpointConnectionOperationSource(Client), _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics, Pipeline, _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.CreateApproveOrRejectPrivateEndpointConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, info).Request, response, OperationFinalStateVia.Location); + var response = _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.ApproveOrRejectPrivateEndpointConnection(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new AppServiceArmOperation(new HostingEnvironmentPrivateEndpointConnectionOperationSource(Client), _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsClientDiagnostics, Pipeline, _hostingEnvironmentPrivateEndpointConnectionAppServiceEnvironmentsRestClient.CreateApproveOrRejectPrivateEndpointConnectionRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationCollection.cs index b9ceb07582cb0..eddca60279fe4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationCollection.cs @@ -61,7 +61,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -108,7 +108,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -155,7 +155,7 @@ public virtual Response Get(string nam /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -200,7 +200,7 @@ public virtual async Task> ExistsAsync(string name, bool? updateS /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -245,7 +245,7 @@ public virtual Response Exists(string name, bool? updateSeen = null, strin /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -292,7 +292,7 @@ public virtual async Task /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationResource.cs index e7356fa8edea9..3b1446b9dedb0 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentRecommendationResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -185,7 +185,7 @@ public virtual Response Get(bool? upda /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -227,7 +227,7 @@ public virtual async Task DisableRecommendationForHostingEnvironmentAs /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolCollection.cs index 6f12ccfdae25a..7487048d19759 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -113,7 +113,7 @@ public virtual async Task> Cr /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -162,7 +162,7 @@ public virtual ArmOperation CreateOrUpdate /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -207,7 +207,7 @@ public virtual async Task> GetAsy /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -252,7 +252,7 @@ public virtual Response Get(string workerP /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -282,7 +282,7 @@ public virtual AsyncPageable GetAllAsync(C /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -312,7 +312,7 @@ public virtual Pageable GetAll(Cancellatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -355,7 +355,7 @@ public virtual async Task> ExistsAsync(string workerPoolName, Can /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -398,7 +398,7 @@ public virtual Response Exists(string workerPoolName, CancellationToken ca /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -443,7 +443,7 @@ public virtual async Task /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolResource.cs index 95b3bb40b7351..4fa570b444301 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HostingEnvironmentWorkerPoolResource.cs @@ -103,7 +103,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -143,7 +143,7 @@ public virtual async Task> GetAsy /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -183,7 +183,7 @@ public virtual Response Get(CancellationTo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -225,7 +225,7 @@ public virtual async Task> Update /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -267,7 +267,7 @@ public virtual Response Update(AppServiceW /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -298,7 +298,7 @@ public virtual AsyncPageable GetWorkerPoolInstanceMetr /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// @@ -329,7 +329,7 @@ public virtual Pageable GetWorkerPoolInstanceMetricDef /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -359,7 +359,7 @@ public virtual AsyncPageable GetWebWorkerMetricDefinit /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -389,7 +389,7 @@ public virtual Pageable GetWebWorkerMetricDefinitions( /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -419,7 +419,7 @@ public virtual AsyncPageable GetWorkerPoolSkusAsync(Cance /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -449,7 +449,7 @@ public virtual Pageable GetWorkerPoolSkus(CancellationTok /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -479,7 +479,7 @@ public virtual AsyncPageable GetWebWorkerUsagesAsync(Cancellati /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitResource.cs index 48a306b7c966d..885ebf84011d8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/HybridConnectionLimitResource.cs @@ -100,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -140,7 +140,7 @@ public virtual async Task> GetAsync(Canc /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentCollection.cs index ef866f2c13d9f..1eecd103362c0 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentCollection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentCollection.cs @@ -65,7 +65,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -114,7 +114,7 @@ public virtual async Task> CreateOrUpdateA /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -163,7 +163,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil wa /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -208,7 +208,7 @@ public virtual async Task> GetAsync(string nam /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -253,7 +253,7 @@ public virtual Response Get(string name, CancellationTo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -283,7 +283,7 @@ public virtual AsyncPageable GetAllAsync(CancellationTo /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -313,7 +313,7 @@ public virtual Pageable GetAll(CancellationToken cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -356,7 +356,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -399,7 +399,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -444,7 +444,7 @@ public virtual async Task> GetIfExists /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentData.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentData.Serialization.cs index 0d6f8e9bb50dd..13c0b5d8b2f04 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentData.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentData.Serialization.cs @@ -101,6 +101,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("staticIp"u8); writer.WriteStringValue(StaticIP); } + if (Optional.IsDefined(EnvironmentType)) + { + writer.WritePropertyName("environmentType"u8); + writer.WriteStringValue(EnvironmentType); + } if (Optional.IsDefined(ArcConfiguration)) { writer.WritePropertyName("arcConfiguration"u8); @@ -111,6 +116,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("appLogsConfiguration"u8); writer.WriteObjectValue(AppLogsConfiguration, options); } + if (Optional.IsDefined(ContainerAppsConfiguration)) + { + writer.WritePropertyName("containerAppsConfiguration"u8); + writer.WriteObjectValue(ContainerAppsConfiguration, options); + } if (Optional.IsDefined(AksResourceId)) { writer.WritePropertyName("aksResourceID"u8); @@ -168,8 +178,10 @@ internal static KubeEnvironmentData DeserializeKubeEnvironmentData(JsonElement e bool? internalLoadBalancerEnabled = default; string defaultDomain = default; string staticIP = default; + string environmentType = default; ArcConfiguration arcConfiguration = default; AppLogsConfiguration appLogsConfiguration = default; + ContainerAppsConfiguration containerAppsConfiguration = default; ResourceIdentifier aksResourceId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -274,6 +286,11 @@ internal static KubeEnvironmentData DeserializeKubeEnvironmentData(JsonElement e staticIP = property0.Value.GetString(); continue; } + if (property0.NameEquals("environmentType"u8)) + { + environmentType = property0.Value.GetString(); + continue; + } if (property0.NameEquals("arcConfiguration"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -292,6 +309,15 @@ internal static KubeEnvironmentData DeserializeKubeEnvironmentData(JsonElement e appLogsConfiguration = AppLogsConfiguration.DeserializeAppLogsConfiguration(property0.Value, options); continue; } + if (property0.NameEquals("containerAppsConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerAppsConfiguration = ContainerAppsConfiguration.DeserializeContainerAppsConfiguration(property0.Value, options); + continue; + } if (property0.NameEquals("aksResourceID"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -323,8 +349,10 @@ internal static KubeEnvironmentData DeserializeKubeEnvironmentData(JsonElement e internalLoadBalancerEnabled, defaultDomain, staticIP, + environmentType, arcConfiguration, appLogsConfiguration, + containerAppsConfiguration, aksResourceId, kind, serializedAdditionalRawData); @@ -583,6 +611,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnvironmentType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" environmentType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnvironmentType)) + { + builder.Append(" environmentType: "); + if (EnvironmentType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{EnvironmentType}'''"); + } + else + { + builder.AppendLine($"'{EnvironmentType}'"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ArcConfiguration), out propertyOverride); if (hasPropertyOverride) { @@ -613,6 +664,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContainerAppsConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" containerAppsConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContainerAppsConfiguration)) + { + builder.Append(" containerAppsConfiguration: "); + BicepSerializationHelpers.AppendChildObject(builder, ContainerAppsConfiguration, options, 4, false, " containerAppsConfiguration: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AksResourceId), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentData.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentData.cs index b0e4ccd0a0b0b..3fa4bc7fadc11 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentData.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentData.cs @@ -71,6 +71,7 @@ public KubeEnvironmentData(AzureLocation location) : base(location) /// Only visible within Vnet/Subnet. /// Default Domain Name for the cluster. /// Static IP of the KubeEnvironment. + /// Type of Kubernetes Environment. Only supported for Container App Environments with value as Managed. /// /// Cluster configuration which determines the ARC cluster /// components types. Eg: Choosing between BuildService kind, @@ -81,10 +82,11 @@ public KubeEnvironmentData(AzureLocation location) : base(location) /// app logs to a destination. Currently only "log-analytics" is /// supported /// + /// Cluster configuration for Container Apps Environments to configure Dapr Instrumentation Key and VNET Configuration. /// - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. /// Keeps track of any properties unknown to the library. - internal KubeEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, KubeEnvironmentProvisioningState? provisioningState, string deploymentErrors, bool? isInternalLoadBalancerEnabled, string defaultDomain, string staticIP, ArcConfiguration arcConfiguration, AppLogsConfiguration appLogsConfiguration, ResourceIdentifier aksResourceId, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + internal KubeEnvironmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ExtendedLocation extendedLocation, KubeEnvironmentProvisioningState? provisioningState, string deploymentErrors, bool? isInternalLoadBalancerEnabled, string defaultDomain, string staticIP, string environmentType, ArcConfiguration arcConfiguration, AppLogsConfiguration appLogsConfiguration, ContainerAppsConfiguration containerAppsConfiguration, ResourceIdentifier aksResourceId, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) { ExtendedLocation = extendedLocation; ProvisioningState = provisioningState; @@ -92,8 +94,10 @@ internal KubeEnvironmentData(ResourceIdentifier id, string name, ResourceType re IsInternalLoadBalancerEnabled = isInternalLoadBalancerEnabled; DefaultDomain = defaultDomain; StaticIP = staticIP; + EnvironmentType = environmentType; ArcConfiguration = arcConfiguration; AppLogsConfiguration = appLogsConfiguration; + ContainerAppsConfiguration = containerAppsConfiguration; AksResourceId = aksResourceId; Kind = kind; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -122,6 +126,9 @@ internal KubeEnvironmentData() /// Static IP of the KubeEnvironment. [WirePath("properties.staticIp")] public string StaticIP { get; set; } + /// Type of Kubernetes Environment. Only supported for Container App Environments with value as Managed. + [WirePath("properties.environmentType")] + public string EnvironmentType { get; set; } /// /// Cluster configuration which determines the ARC cluster /// components types. Eg: Choosing between BuildService kind, @@ -136,10 +143,13 @@ internal KubeEnvironmentData() /// [WirePath("properties.appLogsConfiguration")] public AppLogsConfiguration AppLogsConfiguration { get; set; } + /// Cluster configuration for Container Apps Environments to configure Dapr Instrumentation Key and VNET Configuration. + [WirePath("properties.containerAppsConfiguration")] + public ContainerAppsConfiguration ContainerAppsConfiguration { get; set; } /// Gets or sets the aks resource id. [WirePath("properties.aksResourceID")] public ResourceIdentifier AksResourceId { get; set; } - /// Kind of resource. + /// Kind of resource. If the resource is an app, you can refer to https://github.com/Azure/app-service-linux-docs/blob/master/Things_You_Should_Know/kind_property.md#app-service-resource-kind-reference for details supported values for kind. [WirePath("kind")] public string Kind { get; set; } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentResource.cs index 89ee8ce530c32..280e92f5cf9e1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/KubeEnvironmentResource.cs @@ -102,7 +102,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -142,7 +142,7 @@ public virtual async Task> GetAsync(Cancellati /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -182,7 +182,7 @@ public virtual Response Get(CancellationToken cancellat /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -224,7 +224,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -266,7 +266,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -308,7 +308,7 @@ public virtual async Task> UpdateAsync(KubeEnv /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteConfigResource.cs index 4fa107b04d27f..016709b3b2d31 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteConfigResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteConfigResource.cs @@ -100,7 +100,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -140,7 +140,7 @@ public virtual async Task> GetAsync(Cancellatio /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -180,7 +180,7 @@ public virtual Response Get(CancellationToken cancellati /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -228,7 +228,7 @@ public virtual async Task> CreateOrUpdateAs /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteSlotConfigResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteSlotConfigResource.cs index a82aac0c52af6..ce4299bddb835 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteSlotConfigResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LogsSiteSlotConfigResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync(Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -181,7 +181,7 @@ public virtual Response Get(CancellationToken cancel /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -229,7 +229,7 @@ public virtual async Task> CreateOrUpda /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/ContainerAppOperationSource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/ContainerAppOperationSource.cs new file mode 100644 index 0000000000000..6a660bec3bc41 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/ContainerAppOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.AppService +{ + internal class ContainerAppOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ContainerAppOperationSource(ArmClient client) + { + _client = client; + } + + ContainerAppResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ContainerAppData.DeserializeContainerAppData(document.RootElement); + return new ContainerAppResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ContainerAppData.DeserializeContainerAppData(document.RootElement); + return new ContainerAppResource(_client, data); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/SiteDeploymentStatuOperationSource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/SiteDeploymentStatuOperationSource.cs new file mode 100644 index 0000000000000..a81381b359ae3 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/SiteDeploymentStatuOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.AppService +{ + internal class SiteDeploymentStatuOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SiteDeploymentStatuOperationSource(ArmClient client) + { + _client = client; + } + + SiteDeploymentStatuResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = CsmDeploymentStatusData.DeserializeCsmDeploymentStatusData(document.RootElement); + return new SiteDeploymentStatuResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = CsmDeploymentStatusData.DeserializeCsmDeploymentStatusData(document.RootElement); + return new SiteDeploymentStatuResource(_client, data); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/SiteSlotDeploymentStatuOperationSource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/SiteSlotDeploymentStatuOperationSource.cs new file mode 100644 index 0000000000000..c4d39e3c1cee8 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/SiteSlotDeploymentStatuOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.AppService +{ + internal class SiteSlotDeploymentStatuOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SiteSlotDeploymentStatuOperationSource(ArmClient client) + { + _client = client; + } + + SiteSlotDeploymentStatuResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = CsmDeploymentStatusData.DeserializeCsmDeploymentStatusData(document.RootElement); + return new SiteSlotDeploymentStatuResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = CsmDeploymentStatusData.DeserializeCsmDeploymentStatusData(document.RootElement); + return new SiteSlotDeploymentStatuResource(_client, data); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/StaticSiteBuildLinkedBackendOperationSource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/StaticSiteBuildLinkedBackendOperationSource.cs new file mode 100644 index 0000000000000..d0fc9a6cd3c26 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/StaticSiteBuildLinkedBackendOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.AppService +{ + internal class StaticSiteBuildLinkedBackendOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal StaticSiteBuildLinkedBackendOperationSource(ArmClient client) + { + _client = client; + } + + StaticSiteBuildLinkedBackendResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = StaticSiteLinkedBackendARMResourceData.DeserializeStaticSiteLinkedBackendARMResourceData(document.RootElement); + return new StaticSiteBuildLinkedBackendResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = StaticSiteLinkedBackendARMResourceData.DeserializeStaticSiteLinkedBackendARMResourceData(document.RootElement); + return new StaticSiteBuildLinkedBackendResource(_client, data); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/StaticSiteLinkedBackendOperationSource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/StaticSiteLinkedBackendOperationSource.cs new file mode 100644 index 0000000000000..cd6aaac93a118 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/LongRunningOperation/StaticSiteLinkedBackendOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.AppService +{ + internal class StaticSiteLinkedBackendOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal StaticSiteLinkedBackendOperationSource(ArmClient client) + { + _client = client; + } + + StaticSiteLinkedBackendResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = StaticSiteLinkedBackendARMResourceData.DeserializeStaticSiteLinkedBackendARMResourceData(document.RootElement); + return new StaticSiteLinkedBackendResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = StaticSiteLinkedBackendARMResourceData.DeserializeStaticSiteLinkedBackendARMResourceData(document.RootElement); + return new StaticSiteLinkedBackendResource(_client, data); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusResource.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusResource.cs index 27581ff51bbd2..96c28fe6b461c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusResource.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/MigrateMySqlStatusResource.cs @@ -101,7 +101,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource @@ -141,7 +141,7 @@ public virtual async Task> GetAsync(Cancell /// /// /// Default Api Version - /// 2021-02-01 + /// 2024-04-01 /// /// /// Resource diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ActiveRevisionsMode.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ActiveRevisionsMode.cs new file mode 100644 index 0000000000000..8a8678db52653 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ActiveRevisionsMode.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// + /// ActiveRevisionsMode controls how active revisions are handled for the Container app: + /// <list><item>Multiple: multiple revisions can be active. If no value if provided, this is the default</item><item>Single: Only one revision can be active at a time. Revision weights can not be used in this mode</item></list> + /// + public readonly partial struct ActiveRevisionsMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ActiveRevisionsMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string MultipleValue = "multiple"; + private const string SingleValue = "single"; + + /// multiple. + public static ActiveRevisionsMode Multiple { get; } = new ActiveRevisionsMode(MultipleValue); + /// single. + public static ActiveRevisionsMode Single { get; } = new ActiveRevisionsMode(SingleValue); + /// Determines if two values are the same. + public static bool operator ==(ActiveRevisionsMode left, ActiveRevisionsMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ActiveRevisionsMode left, ActiveRevisionsMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ActiveRevisionsMode(string value) => new ActiveRevisionsMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ActiveRevisionsMode other && Equals(other); + /// + public bool Equals(ActiveRevisionsMode other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceCertificateEmail.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceCertificateEmail.Serialization.cs index cc6d52d5bb21e..f8d7ae39f8bd6 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceCertificateEmail.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceCertificateEmail.Serialization.cs @@ -11,7 +11,6 @@ using System.Text; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppService.Models { @@ -27,33 +26,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe throw new FormatException($"The model {nameof(AppServiceCertificateEmail)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (Optional.IsDefined(Kind)) - { - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - } - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } - writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (Optional.IsDefined(EmailId)) { @@ -65,7 +37,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe writer.WritePropertyName("timeStamp"u8); writer.WriteStringValue(TimeStamp.Value, "O"); } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -104,70 +75,24 @@ internal static AppServiceCertificateEmail DeserializeAppServiceCertificateEmail { return null; } - string kind = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; string emailId = default; DateTimeOffset? timeStamp = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) + if (property.NameEquals("emailId"u8)) { - type = new ResourceType(property.Value.GetString()); + emailId = property.Value.GetString(); continue; } - if (property.NameEquals("systemData"u8)) + if (property.NameEquals("timeStamp"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); - continue; - } - if (property.NameEquals("properties"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - property.ThrowNonNullablePropertyIsNull(); - continue; - } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("emailId"u8)) - { - emailId = property0.Value.GetString(); - continue; - } - if (property0.NameEquals("timeStamp"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - timeStamp = property0.Value.GetDateTimeOffset("O"); - continue; - } - } + timeStamp = property.Value.GetDateTimeOffset("O"); continue; } if (options.Format != "W") @@ -176,15 +101,7 @@ internal static AppServiceCertificateEmail DeserializeAppServiceCertificateEmail } } serializedAdditionalRawData = rawDataDictionary; - return new AppServiceCertificateEmail( - id, - name, - type, - systemData, - emailId, - timeStamp, - kind, - serializedAdditionalRawData); + return new AppServiceCertificateEmail(emailId, timeStamp, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -198,95 +115,17 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kind: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Kind)) - { - builder.Append(" kind: "); - if (Kind.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Kind}'''"); - } - else - { - builder.AppendLine($"'{Kind}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EmailId), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" emailId: "); + builder.Append(" emailId: "); builder.AppendLine(propertyOverride); } else { if (Optional.IsDefined(EmailId)) { - builder.Append(" emailId: "); + builder.Append(" emailId: "); if (EmailId.Contains(Environment.NewLine)) { builder.AppendLine("'''"); @@ -302,20 +141,19 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TimeStamp), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" timeStamp: "); + builder.Append(" timeStamp: "); builder.AppendLine(propertyOverride); } else { if (Optional.IsDefined(TimeStamp)) { - builder.Append(" timeStamp: "); + builder.Append(" timeStamp: "); var formattedDateTimeString = TypeFormatters.ToString(TimeStamp.Value, "o"); builder.AppendLine($"'{formattedDateTimeString}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceCertificateEmail.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceCertificateEmail.cs index c768852aad328..76f500db148c7 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceCertificateEmail.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceCertificateEmail.cs @@ -7,13 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppService.Models { /// SSL certificate email. - public partial class AppServiceCertificateEmail : ResourceData + public partial class AppServiceCertificateEmail { /// /// Keeps track of any properties unknown to the library. @@ -48,35 +46,26 @@ public partial class AppServiceCertificateEmail : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public AppServiceCertificateEmail() + internal AppServiceCertificateEmail() { } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. /// Email id. /// Time stamp. - /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal AppServiceCertificateEmail(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string emailId, DateTimeOffset? timeStamp, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal AppServiceCertificateEmail(string emailId, DateTimeOffset? timeStamp, IDictionary serializedAdditionalRawData) { EmailId = emailId; TimeStamp = timeStamp; - Kind = kind; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Email id. - [WirePath("properties.emailId")] - public string EmailId { get; set; } + [WirePath("emailId")] + public string EmailId { get; } /// Time stamp. - [WirePath("properties.timeStamp")] - public DateTimeOffset? TimeStamp { get; set; } - /// Kind of resource. - [WirePath("kind")] - public string Kind { get; set; } + [WirePath("timeStamp")] + public DateTimeOffset? TimeStamp { get; } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEndpointDetail.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEndpointDetail.Serialization.cs index aafd6a5c2bc7a..b5785f6ad271c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEndpointDetail.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEndpointDetail.Serialization.cs @@ -86,7 +86,7 @@ internal static AppServiceEndpointDetail DeserializeAppServiceEndpointDetail(Jso { return null; } - IPAddress ipAddress = default; + System.Net.IPAddress ipAddress = default; int? port = default; double? latency = default; bool? isAccessible = default; @@ -100,7 +100,7 @@ internal static AppServiceEndpointDetail DeserializeAppServiceEndpointDetail(Jso { continue; } - ipAddress = IPAddress.Parse(property.Value.GetString()); + ipAddress = System.Net.IPAddress.Parse(property.Value.GetString()); continue; } if (property.NameEquals("port"u8)) diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEndpointDetail.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEndpointDetail.cs index 897a883de4207..0bb40c984e8b1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEndpointDetail.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEndpointDetail.cs @@ -57,7 +57,7 @@ internal AppServiceEndpointDetail() /// The time in milliseconds it takes for a TCP connection to be created from the App Service Environment to this IpAddress at this Port. /// Whether it is possible to create a TCP connection from the App Service Environment to this IpAddress at this Port. /// Keeps track of any properties unknown to the library. - internal AppServiceEndpointDetail(IPAddress ipAddress, int? port, double? latency, bool? isAccessible, IDictionary serializedAdditionalRawData) + internal AppServiceEndpointDetail(System.Net.IPAddress ipAddress, int? port, double? latency, bool? isAccessible, IDictionary serializedAdditionalRawData) { IPAddress = ipAddress; Port = port; @@ -68,7 +68,7 @@ internal AppServiceEndpointDetail(IPAddress ipAddress, int? port, double? latenc /// An IP Address that Domain Name currently resolves to. [WirePath("ipAddress")] - public IPAddress IPAddress { get; } + public System.Net.IPAddress IPAddress { get; } /// The port an endpoint is connected to. [WirePath("port")] public int? Port { get; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentAddressResult.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentAddressResult.Serialization.cs index f13e9d84913a0..f37cb4371ca12 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentAddressResult.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentAddressResult.Serialization.cs @@ -136,9 +136,9 @@ internal static AppServiceEnvironmentAddressResult DeserializeAppServiceEnvironm string name = default; ResourceType type = default; SystemData systemData = default; - IPAddress serviceIPAddress = default; - IPAddress internalIPAddress = default; - IList outboundIPAddresses = default; + System.Net.IPAddress serviceIPAddress = default; + System.Net.IPAddress internalIPAddress = default; + IList outboundIPAddresses = default; IList vipMappings = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -188,7 +188,7 @@ internal static AppServiceEnvironmentAddressResult DeserializeAppServiceEnvironm { continue; } - serviceIPAddress = IPAddress.Parse(property0.Value.GetString()); + serviceIPAddress = System.Net.IPAddress.Parse(property0.Value.GetString()); continue; } if (property0.NameEquals("internalIpAddress"u8)) @@ -197,7 +197,7 @@ internal static AppServiceEnvironmentAddressResult DeserializeAppServiceEnvironm { continue; } - internalIPAddress = IPAddress.Parse(property0.Value.GetString()); + internalIPAddress = System.Net.IPAddress.Parse(property0.Value.GetString()); continue; } if (property0.NameEquals("outboundIpAddresses"u8)) @@ -206,7 +206,7 @@ internal static AppServiceEnvironmentAddressResult DeserializeAppServiceEnvironm { continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) @@ -215,7 +215,7 @@ internal static AppServiceEnvironmentAddressResult DeserializeAppServiceEnvironm } else { - array.Add(IPAddress.Parse(item.GetString())); + array.Add(System.Net.IPAddress.Parse(item.GetString())); } } outboundIPAddresses = array; @@ -251,7 +251,7 @@ internal static AppServiceEnvironmentAddressResult DeserializeAppServiceEnvironm systemData, serviceIPAddress, internalIPAddress, - outboundIPAddresses ?? new ChangeTrackingList(), + outboundIPAddresses ?? new ChangeTrackingList(), vipMappings ?? new ChangeTrackingList(), kind, serializedAdditionalRawData); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentAddressResult.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentAddressResult.cs index 46f95004cce20..a8981181dd7b6 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentAddressResult.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentAddressResult.cs @@ -51,7 +51,7 @@ public partial class AppServiceEnvironmentAddressResult : ResourceData /// Initializes a new instance of . public AppServiceEnvironmentAddressResult() { - OutboundIPAddresses = new ChangeTrackingList(); + OutboundIPAddresses = new ChangeTrackingList(); VirtualIPMappings = new ChangeTrackingList(); } @@ -66,7 +66,7 @@ public AppServiceEnvironmentAddressResult() /// Additional virtual IPs. /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal AppServiceEnvironmentAddressResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IPAddress serviceIPAddress, IPAddress internalIPAddress, IList outboundIPAddresses, IList virtualIPMappings, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal AppServiceEnvironmentAddressResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, System.Net.IPAddress serviceIPAddress, System.Net.IPAddress internalIPAddress, IList outboundIPAddresses, IList virtualIPMappings, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ServiceIPAddress = serviceIPAddress; InternalIPAddress = internalIPAddress; @@ -78,13 +78,13 @@ internal AppServiceEnvironmentAddressResult(ResourceIdentifier id, string name, /// Main public virtual IP. [WirePath("properties.serviceIpAddress")] - public IPAddress ServiceIPAddress { get; set; } + public System.Net.IPAddress ServiceIPAddress { get; set; } /// Virtual Network internal IP address of the App Service Environment if it is in internal load-balancing mode. [WirePath("properties.internalIpAddress")] - public IPAddress InternalIPAddress { get; set; } + public System.Net.IPAddress InternalIPAddress { get; set; } /// IP addresses appearing on outbound connections. [WirePath("properties.outboundIpAddresses")] - public IList OutboundIPAddresses { get; } + public IList OutboundIPAddresses { get; } /// Additional virtual IPs. [WirePath("properties.vipMappings")] public IList VirtualIPMappings { get; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentPatch.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentPatch.Serialization.cs index 4e82be33197ab..e855bb5e2dd0d 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentPatch.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentPatch.Serialization.cs @@ -136,6 +136,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe writer.WritePropertyName("hasLinuxWorkers"u8); writer.WriteBooleanValue(HasLinuxWorkers.Value); } + if (Optional.IsDefined(UpgradePreference)) + { + writer.WritePropertyName("upgradePreference"u8); + writer.WriteStringValue(UpgradePreference.Value.ToString()); + } if (Optional.IsDefined(DedicatedHostCount)) { writer.WritePropertyName("dedicatedHostCount"u8); @@ -146,6 +151,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe writer.WritePropertyName("zoneRedundant"u8); writer.WriteBooleanValue(IsZoneRedundant.Value); } + if (Optional.IsDefined(CustomDnsSuffixConfiguration)) + { + writer.WritePropertyName("customDnsSuffixConfiguration"u8); + writer.WriteObjectValue(CustomDnsSuffixConfiguration, options); + } + if (Optional.IsDefined(NetworkingConfiguration)) + { + writer.WritePropertyName("networkingConfiguration"u8); + writer.WriteObjectValue(NetworkingConfiguration, options); + } + if (options.Format != "W" && Optional.IsDefined(UpgradeAvailability)) + { + writer.WritePropertyName("upgradeAvailability"u8); + writer.WriteStringValue(UpgradeAvailability.Value.ToString()); + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -204,8 +224,12 @@ internal static AppServiceEnvironmentPatch DeserializeAppServiceEnvironmentPatch IList clusterSettings = default; IList userWhitelistedIPRanges = default; bool? hasLinuxWorkers = default; + UpgradePreference? upgradePreference = default; int? dedicatedHostCount = default; bool? zoneRedundant = default; + CustomDnsSuffixConfigurationData customDnsSuffixConfiguration = default; + AseV3NetworkingConfigurationData networkingConfiguration = default; + UpgradeAvailability? upgradeAvailability = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -376,6 +400,15 @@ internal static AppServiceEnvironmentPatch DeserializeAppServiceEnvironmentPatch hasLinuxWorkers = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("upgradePreference"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upgradePreference = new UpgradePreference(property0.Value.GetString()); + continue; + } if (property0.NameEquals("dedicatedHostCount"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -394,6 +427,33 @@ internal static AppServiceEnvironmentPatch DeserializeAppServiceEnvironmentPatch zoneRedundant = property0.Value.GetBoolean(); continue; } + if (property0.NameEquals("customDnsSuffixConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customDnsSuffixConfiguration = CustomDnsSuffixConfigurationData.DeserializeCustomDnsSuffixConfigurationData(property0.Value, options); + continue; + } + if (property0.NameEquals("networkingConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkingConfiguration = AseV3NetworkingConfigurationData.DeserializeAseV3NetworkingConfigurationData(property0.Value, options); + continue; + } + if (property0.NameEquals("upgradeAvailability"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upgradeAvailability = new UpgradeAvailability(property0.Value.GetString()); + continue; + } } continue; } @@ -422,8 +482,12 @@ internal static AppServiceEnvironmentPatch DeserializeAppServiceEnvironmentPatch clusterSettings ?? new ChangeTrackingList(), userWhitelistedIPRanges ?? new ChangeTrackingList(), hasLinuxWorkers, + upgradePreference, dedicatedHostCount, zoneRedundant, + customDnsSuffixConfiguration, + networkingConfiguration, + upgradeAvailability, kind, serializedAdditionalRawData); } @@ -774,6 +838,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpgradePreference), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" upgradePreference: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UpgradePreference)) + { + builder.Append(" upgradePreference: "); + builder.AppendLine($"'{UpgradePreference.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DedicatedHostCount), out propertyOverride); if (hasPropertyOverride) { @@ -805,6 +884,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomDnsSuffixConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customDnsSuffixConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CustomDnsSuffixConfiguration)) + { + builder.Append(" customDnsSuffixConfiguration: "); + BicepSerializationHelpers.AppendChildObject(builder, CustomDnsSuffixConfiguration, options, 4, false, " customDnsSuffixConfiguration: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkingConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkingConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkingConfiguration)) + { + builder.Append(" networkingConfiguration: "); + BicepSerializationHelpers.AppendChildObject(builder, NetworkingConfiguration, options, 4, false, " networkingConfiguration: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpgradeAvailability), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" upgradeAvailability: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UpgradeAvailability)) + { + builder.Append(" upgradeAvailability: "); + builder.AppendLine($"'{UpgradeAvailability.Value.ToString()}'"); + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentPatch.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentPatch.cs index 1617071c6e01e..d2694d948c2ed 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentPatch.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentPatch.cs @@ -76,11 +76,15 @@ public AppServiceEnvironmentPatch() /// Custom settings for changing the behavior of the App Service Environment. /// User added ip ranges to whitelist on ASE db. /// Flag that displays whether an ASE has linux workers or not. + /// Upgrade Preference. /// Dedicated Host Count. /// Whether or not this App Service Environment is zone-redundant. + /// Full view of the custom domain suffix configuration for ASEv3. + /// Full view of networking configuration for an ASE. + /// Whether an upgrade is available for this App Service Environment. /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal AppServiceEnvironmentPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisioningState? provisioningState, HostingEnvironmentStatus? status, AppServiceVirtualNetworkProfile virtualNetwork, LoadBalancingMode? internalLoadBalancingMode, string multiSize, int? multiRoleCount, int? ipSslAddressCount, string dnsSuffix, int? maximumNumberOfMachines, int? frontEndScaleFactor, bool? isSuspended, IList clusterSettings, IList userWhitelistedIPRanges, bool? hasLinuxWorkers, int? dedicatedHostCount, bool? isZoneRedundant, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal AppServiceEnvironmentPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisioningState? provisioningState, HostingEnvironmentStatus? status, AppServiceVirtualNetworkProfile virtualNetwork, LoadBalancingMode? internalLoadBalancingMode, string multiSize, int? multiRoleCount, int? ipSslAddressCount, string dnsSuffix, int? maximumNumberOfMachines, int? frontEndScaleFactor, bool? isSuspended, IList clusterSettings, IList userWhitelistedIPRanges, bool? hasLinuxWorkers, UpgradePreference? upgradePreference, int? dedicatedHostCount, bool? isZoneRedundant, CustomDnsSuffixConfigurationData customDnsSuffixConfiguration, AseV3NetworkingConfigurationData networkingConfiguration, UpgradeAvailability? upgradeAvailability, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; Status = status; @@ -96,8 +100,12 @@ internal AppServiceEnvironmentPatch(ResourceIdentifier id, string name, Resource ClusterSettings = clusterSettings; UserWhitelistedIPRanges = userWhitelistedIPRanges; HasLinuxWorkers = hasLinuxWorkers; + UpgradePreference = upgradePreference; DedicatedHostCount = dedicatedHostCount; IsZoneRedundant = isZoneRedundant; + CustomDnsSuffixConfiguration = customDnsSuffixConfiguration; + NetworkingConfiguration = networkingConfiguration; + UpgradeAvailability = upgradeAvailability; Kind = kind; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -147,12 +155,24 @@ internal AppServiceEnvironmentPatch(ResourceIdentifier id, string name, Resource /// Flag that displays whether an ASE has linux workers or not. [WirePath("properties.hasLinuxWorkers")] public bool? HasLinuxWorkers { get; } + /// Upgrade Preference. + [WirePath("properties.upgradePreference")] + public UpgradePreference? UpgradePreference { get; set; } /// Dedicated Host Count. [WirePath("properties.dedicatedHostCount")] public int? DedicatedHostCount { get; set; } /// Whether or not this App Service Environment is zone-redundant. [WirePath("properties.zoneRedundant")] public bool? IsZoneRedundant { get; set; } + /// Full view of the custom domain suffix configuration for ASEv3. + [WirePath("properties.customDnsSuffixConfiguration")] + public CustomDnsSuffixConfigurationData CustomDnsSuffixConfiguration { get; set; } + /// Full view of networking configuration for an ASE. + [WirePath("properties.networkingConfiguration")] + public AseV3NetworkingConfigurationData NetworkingConfiguration { get; set; } + /// Whether an upgrade is available for this App Service Environment. + [WirePath("properties.upgradeAvailability")] + public UpgradeAvailability? UpgradeAvailability { get; } /// Kind of resource. [WirePath("kind")] public string Kind { get; set; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentProperties.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentProperties.Serialization.cs index 9d93148e6ccdc..748d8399d9da7 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentProperties.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentProperties.Serialization.cs @@ -105,6 +105,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo writer.WritePropertyName("hasLinuxWorkers"u8); writer.WriteBooleanValue(HasLinuxWorkers.Value); } + if (Optional.IsDefined(UpgradePreference)) + { + writer.WritePropertyName("upgradePreference"u8); + writer.WriteStringValue(UpgradePreference.Value.ToString()); + } if (Optional.IsDefined(DedicatedHostCount)) { writer.WritePropertyName("dedicatedHostCount"u8); @@ -115,6 +120,21 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo writer.WritePropertyName("zoneRedundant"u8); writer.WriteBooleanValue(IsZoneRedundant.Value); } + if (Optional.IsDefined(CustomDnsSuffixConfiguration)) + { + writer.WritePropertyName("customDnsSuffixConfiguration"u8); + writer.WriteObjectValue(CustomDnsSuffixConfiguration, options); + } + if (Optional.IsDefined(NetworkingConfiguration)) + { + writer.WritePropertyName("networkingConfiguration"u8); + writer.WriteObjectValue(NetworkingConfiguration, options); + } + if (options.Format != "W" && Optional.IsDefined(UpgradeAvailability)) + { + writer.WritePropertyName("upgradeAvailability"u8); + writer.WriteStringValue(UpgradeAvailability.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -167,8 +187,12 @@ internal static AppServiceEnvironmentProperties DeserializeAppServiceEnvironment IList clusterSettings = default; IList userWhitelistedIPRanges = default; bool? hasLinuxWorkers = default; + UpgradePreference? upgradePreference = default; int? dedicatedHostCount = default; bool? zoneRedundant = default; + CustomDnsSuffixConfigurationData customDnsSuffixConfiguration = default; + AseV3NetworkingConfigurationData networkingConfiguration = default; + UpgradeAvailability? upgradeAvailability = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -297,6 +321,15 @@ internal static AppServiceEnvironmentProperties DeserializeAppServiceEnvironment hasLinuxWorkers = property.Value.GetBoolean(); continue; } + if (property.NameEquals("upgradePreference"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upgradePreference = new UpgradePreference(property.Value.GetString()); + continue; + } if (property.NameEquals("dedicatedHostCount"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -315,6 +348,33 @@ internal static AppServiceEnvironmentProperties DeserializeAppServiceEnvironment zoneRedundant = property.Value.GetBoolean(); continue; } + if (property.NameEquals("customDnsSuffixConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customDnsSuffixConfiguration = CustomDnsSuffixConfigurationData.DeserializeCustomDnsSuffixConfigurationData(property.Value, options); + continue; + } + if (property.NameEquals("networkingConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + networkingConfiguration = AseV3NetworkingConfigurationData.DeserializeAseV3NetworkingConfigurationData(property.Value, options); + continue; + } + if (property.NameEquals("upgradeAvailability"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + upgradeAvailability = new UpgradeAvailability(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -336,8 +396,12 @@ internal static AppServiceEnvironmentProperties DeserializeAppServiceEnvironment clusterSettings ?? new ChangeTrackingList(), userWhitelistedIPRanges ?? new ChangeTrackingList(), hasLinuxWorkers, + upgradePreference, dedicatedHostCount, zoneRedundant, + customDnsSuffixConfiguration, + networkingConfiguration, + upgradeAvailability, serializedAdditionalRawData); } @@ -609,6 +673,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpgradePreference), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" upgradePreference: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UpgradePreference)) + { + builder.Append(" upgradePreference: "); + builder.AppendLine($"'{UpgradePreference.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DedicatedHostCount), out propertyOverride); if (hasPropertyOverride) { @@ -640,6 +719,51 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomDnsSuffixConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customDnsSuffixConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CustomDnsSuffixConfiguration)) + { + builder.Append(" customDnsSuffixConfiguration: "); + BicepSerializationHelpers.AppendChildObject(builder, CustomDnsSuffixConfiguration, options, 2, false, " customDnsSuffixConfiguration: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NetworkingConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" networkingConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NetworkingConfiguration)) + { + builder.Append(" networkingConfiguration: "); + BicepSerializationHelpers.AppendChildObject(builder, NetworkingConfiguration, options, 2, false, " networkingConfiguration: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UpgradeAvailability), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" upgradeAvailability: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UpgradeAvailability)) + { + builder.Append(" upgradeAvailability: "); + builder.AppendLine($"'{UpgradeAvailability.Value.ToString()}'"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentProperties.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentProperties.cs index fe7e8ea1abbfa..52185f07e232c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentProperties.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceEnvironmentProperties.cs @@ -75,10 +75,14 @@ public AppServiceEnvironmentProperties(AppServiceVirtualNetworkProfile virtualNe /// Custom settings for changing the behavior of the App Service Environment. /// User added ip ranges to whitelist on ASE db. /// Flag that displays whether an ASE has linux workers or not. + /// Upgrade Preference. /// Dedicated Host Count. /// Whether or not this App Service Environment is zone-redundant. + /// Full view of the custom domain suffix configuration for ASEv3. + /// Full view of networking configuration for an ASE. + /// Whether an upgrade is available for this App Service Environment. /// Keeps track of any properties unknown to the library. - internal AppServiceEnvironmentProperties(ProvisioningState? provisioningState, HostingEnvironmentStatus? status, AppServiceVirtualNetworkProfile virtualNetwork, LoadBalancingMode? internalLoadBalancingMode, string multiSize, int? multiRoleCount, int? ipSslAddressCount, string dnsSuffix, int? maximumNumberOfMachines, int? frontEndScaleFactor, bool? isSuspended, IList clusterSettings, IList userWhitelistedIPRanges, bool? hasLinuxWorkers, int? dedicatedHostCount, bool? isZoneRedundant, IDictionary serializedAdditionalRawData) + internal AppServiceEnvironmentProperties(ProvisioningState? provisioningState, HostingEnvironmentStatus? status, AppServiceVirtualNetworkProfile virtualNetwork, LoadBalancingMode? internalLoadBalancingMode, string multiSize, int? multiRoleCount, int? ipSslAddressCount, string dnsSuffix, int? maximumNumberOfMachines, int? frontEndScaleFactor, bool? isSuspended, IList clusterSettings, IList userWhitelistedIPRanges, bool? hasLinuxWorkers, UpgradePreference? upgradePreference, int? dedicatedHostCount, bool? isZoneRedundant, CustomDnsSuffixConfigurationData customDnsSuffixConfiguration, AseV3NetworkingConfigurationData networkingConfiguration, UpgradeAvailability? upgradeAvailability, IDictionary serializedAdditionalRawData) { ProvisioningState = provisioningState; Status = status; @@ -94,8 +98,12 @@ internal AppServiceEnvironmentProperties(ProvisioningState? provisioningState, H ClusterSettings = clusterSettings; UserWhitelistedIPRanges = userWhitelistedIPRanges; HasLinuxWorkers = hasLinuxWorkers; + UpgradePreference = upgradePreference; DedicatedHostCount = dedicatedHostCount; IsZoneRedundant = isZoneRedundant; + CustomDnsSuffixConfiguration = customDnsSuffixConfiguration; + NetworkingConfiguration = networkingConfiguration; + UpgradeAvailability = upgradeAvailability; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -149,11 +157,23 @@ internal AppServiceEnvironmentProperties() /// Flag that displays whether an ASE has linux workers or not. [WirePath("hasLinuxWorkers")] public bool? HasLinuxWorkers { get; } + /// Upgrade Preference. + [WirePath("upgradePreference")] + public UpgradePreference? UpgradePreference { get; set; } /// Dedicated Host Count. [WirePath("dedicatedHostCount")] public int? DedicatedHostCount { get; set; } /// Whether or not this App Service Environment is zone-redundant. [WirePath("zoneRedundant")] public bool? IsZoneRedundant { get; set; } + /// Full view of the custom domain suffix configuration for ASEv3. + [WirePath("customDnsSuffixConfiguration")] + public CustomDnsSuffixConfigurationData CustomDnsSuffixConfiguration { get; set; } + /// Full view of networking configuration for an ASE. + [WirePath("networkingConfiguration")] + public AseV3NetworkingConfigurationData NetworkingConfiguration { get; set; } + /// Whether an upgrade is available for this App Service Environment. + [WirePath("upgradeAvailability")] + public UpgradeAvailability? UpgradeAvailability { get; } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceKind.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceKind.cs new file mode 100644 index 0000000000000..c374d40533409 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceKind.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The workflow kind. + public readonly partial struct AppServiceKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AppServiceKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string StatefulValue = "Stateful"; + private const string StatelessValue = "Stateless"; + + /// Stateful. + public static AppServiceKind Stateful { get; } = new AppServiceKind(StatefulValue); + /// Stateless. + public static AppServiceKind Stateless { get; } = new AppServiceKind(StatelessValue); + /// Determines if two values are the same. + public static bool operator ==(AppServiceKind left, AppServiceKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AppServiceKind left, AppServiceKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AppServiceKind(string value) => new AppServiceKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AppServiceKind other && Equals(other); + /// + public bool Equals(AppServiceKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceOperation.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceOperation.Serialization.cs index 8f85055ff01e9..1a8ebefd01863 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceOperation.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceOperation.Serialization.cs @@ -49,7 +49,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri writer.WriteStartArray(); foreach (var item in Errors) { - JsonSerializer.Serialize(writer, item); + writer.WriteObjectValue(item, options); } writer.WriteEndArray(); } @@ -114,7 +114,7 @@ internal static AppServiceOperation DeserializeAppServiceOperation(JsonElement e string id = default; string name = default; AppServiceOperationStatus? status = default; - IReadOnlyList errors = default; + IReadOnlyList errors = default; DateTimeOffset? createdTime = default; DateTimeOffset? modifiedTime = default; DateTimeOffset? expirationTime = default; @@ -148,10 +148,10 @@ internal static AppServiceOperation DeserializeAppServiceOperation(JsonElement e { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(JsonSerializer.Deserialize(item.GetRawText())); + array.Add(ErrorEntity.DeserializeErrorEntity(item, options)); } errors = array; continue; @@ -202,7 +202,7 @@ internal static AppServiceOperation DeserializeAppServiceOperation(JsonElement e id, name, status, - errors ?? new ChangeTrackingList(), + errors ?? new ChangeTrackingList(), createdTime, modifiedTime, expirationTime, diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceOperation.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceOperation.cs index 46d4e57b94b24..a06ad8e7d28a1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceOperation.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceOperation.cs @@ -48,7 +48,7 @@ public partial class AppServiceOperation /// Initializes a new instance of . internal AppServiceOperation() { - Errors = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -61,7 +61,7 @@ internal AppServiceOperation() /// Time when operation will expire. /// Applicable only for stamp operation ids. /// Keeps track of any properties unknown to the library. - internal AppServiceOperation(string id, string name, AppServiceOperationStatus? status, IReadOnlyList errors, DateTimeOffset? createdOn, DateTimeOffset? modifiedOn, DateTimeOffset? expireOn, Guid? geoMasterOperationId, IDictionary serializedAdditionalRawData) + internal AppServiceOperation(string id, string name, AppServiceOperationStatus? status, IReadOnlyList errors, DateTimeOffset? createdOn, DateTimeOffset? modifiedOn, DateTimeOffset? expireOn, Guid? geoMasterOperationId, IDictionary serializedAdditionalRawData) { Id = id; Name = name; @@ -85,7 +85,7 @@ internal AppServiceOperation(string id, string name, AppServiceOperationStatus? public AppServiceOperationStatus? Status { get; } /// Any errors associate with the operation. [WirePath("errors")] - public IReadOnlyList Errors { get; } + public IReadOnlyList Errors { get; } /// Time when operation has started. [WirePath("createdTime")] public DateTimeOffset? CreatedOn { get; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanPatch.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanPatch.Serialization.cs index 577ad88732779..035f86eee8a97 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanPatch.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanPatch.Serialization.cs @@ -80,6 +80,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri writer.WritePropertyName("maximumNumberOfWorkers"u8); writer.WriteNumberValue(MaximumNumberOfWorkers.Value); } + if (options.Format != "W" && Optional.IsDefined(NumberOfWorkers)) + { + writer.WritePropertyName("numberOfWorkers"u8); + writer.WriteNumberValue(NumberOfWorkers.Value); + } if (options.Format != "W" && Optional.IsDefined(GeoRegion)) { writer.WritePropertyName("geoRegion"u8); @@ -214,6 +219,7 @@ internal static AppServicePlanPatch DeserializeAppServicePlanPatch(JsonElement e string subscription = default; HostingEnvironmentProfile hostingEnvironmentProfile = default; int? maximumNumberOfWorkers = default; + int? numberOfWorkers = default; string geoRegion = default; bool? perSiteScaling = default; bool? elasticScaleEnabled = default; @@ -310,6 +316,15 @@ internal static AppServicePlanPatch DeserializeAppServicePlanPatch(JsonElement e maximumNumberOfWorkers = property0.Value.GetInt32(); continue; } + if (property0.NameEquals("numberOfWorkers"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + numberOfWorkers = property0.Value.GetInt32(); + continue; + } if (property0.NameEquals("geoRegion"u8)) { geoRegion = property0.Value.GetString(); @@ -474,6 +489,7 @@ internal static AppServicePlanPatch DeserializeAppServicePlanPatch(JsonElement e subscription, hostingEnvironmentProfile, maximumNumberOfWorkers, + numberOfWorkers, geoRegion, perSiteScaling, elasticScaleEnabled, @@ -675,6 +691,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NumberOfWorkers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" numberOfWorkers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NumberOfWorkers)) + { + builder.Append(" numberOfWorkers: "); + builder.AppendLine($"{NumberOfWorkers.Value}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GeoRegion), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanPatch.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanPatch.cs index b68b0fc9218c6..a9acd038eafd2 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanPatch.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServicePlanPatch.cs @@ -62,6 +62,7 @@ public AppServicePlanPatch() /// App Service plan subscription. /// Specification for the App Service Environment to use for the App Service plan. /// Maximum number of instances that can be assigned to this App Service plan. + /// The number of instances that are assigned to this App Service plan. /// Geographical location for the App Service plan. /// /// If <code>true</code>, apps assigned to this App Service plan can be scaled independently. @@ -87,13 +88,14 @@ public AppServicePlanPatch() /// /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal AppServicePlanPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string workerTierName, AppServicePlanStatus? status, string subscription, HostingEnvironmentProfile hostingEnvironmentProfile, int? maximumNumberOfWorkers, string geoRegion, bool? isPerSiteScaling, bool? isElasticScaleEnabled, int? maximumElasticWorkerCount, int? numberOfSites, bool? isSpot, DateTimeOffset? spotExpirationOn, DateTimeOffset? freeOfferExpirationOn, string resourceGroup, bool? isReserved, bool? isXenon, bool? isHyperV, int? targetWorkerCount, int? targetWorkerSizeId, ProvisioningState? provisioningState, KubeEnvironmentProfile kubeEnvironmentProfile, bool? isZoneRedundant, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal AppServicePlanPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string workerTierName, AppServicePlanStatus? status, string subscription, HostingEnvironmentProfile hostingEnvironmentProfile, int? maximumNumberOfWorkers, int? numberOfWorkers, string geoRegion, bool? isPerSiteScaling, bool? isElasticScaleEnabled, int? maximumElasticWorkerCount, int? numberOfSites, bool? isSpot, DateTimeOffset? spotExpirationOn, DateTimeOffset? freeOfferExpirationOn, string resourceGroup, bool? isReserved, bool? isXenon, bool? isHyperV, int? targetWorkerCount, int? targetWorkerSizeId, ProvisioningState? provisioningState, KubeEnvironmentProfile kubeEnvironmentProfile, bool? isZoneRedundant, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { WorkerTierName = workerTierName; Status = status; Subscription = subscription; HostingEnvironmentProfile = hostingEnvironmentProfile; MaximumNumberOfWorkers = maximumNumberOfWorkers; + NumberOfWorkers = numberOfWorkers; GeoRegion = geoRegion; IsPerSiteScaling = isPerSiteScaling; IsElasticScaleEnabled = isElasticScaleEnabled; @@ -130,6 +132,9 @@ internal AppServicePlanPatch(ResourceIdentifier id, string name, ResourceType re /// Maximum number of instances that can be assigned to this App Service plan. [WirePath("properties.maximumNumberOfWorkers")] public int? MaximumNumberOfWorkers { get; } + /// The number of instances that are assigned to this App Service plan. + [WirePath("properties.numberOfWorkers")] + public int? NumberOfWorkers { get; } /// Geographical location for the App Service plan. [WirePath("properties.geoRegion")] public string GeoRegion { get; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceSkuName.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceSkuName.cs index e798b34de2fd0..e0f8208fd85ab 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceSkuName.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceSkuName.cs @@ -35,6 +35,7 @@ public AppServiceSkuName(string value) private const string PremiumContainerValue = "PremiumContainer"; private const string ElasticPremiumValue = "ElasticPremium"; private const string ElasticIsolatedValue = "ElasticIsolated"; + private const string FlexConsumptionValue = "FlexConsumption"; /// Free. public static AppServiceSkuName Free { get; } = new AppServiceSkuName(FreeValue); @@ -62,6 +63,8 @@ public AppServiceSkuName(string value) public static AppServiceSkuName ElasticPremium { get; } = new AppServiceSkuName(ElasticPremiumValue); /// ElasticIsolated. public static AppServiceSkuName ElasticIsolated { get; } = new AppServiceSkuName(ElasticIsolatedValue); + /// FlexConsumption. + public static AppServiceSkuName FlexConsumption { get; } = new AppServiceSkuName(FlexConsumptionValue); /// Determines if two values are the same. public static bool operator ==(AppServiceSkuName left, AppServiceSkuName right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceStorageAccessInfo.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceStorageAccessInfo.Serialization.cs index 7bd0d0f52b942..ea5ab49ac0bc1 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceStorageAccessInfo.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceStorageAccessInfo.Serialization.cs @@ -57,6 +57,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR writer.WritePropertyName("state"u8); writer.WriteStringValue(State.Value.ToSerialString()); } + if (Optional.IsDefined(Protocol)) + { + writer.WritePropertyName("protocol"u8); + writer.WriteStringValue(Protocol.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -101,6 +106,7 @@ internal static AppServiceStorageAccessInfo DeserializeAppServiceStorageAccessIn string accessKey = default; string mountPath = default; AppServiceStorageAccountState? state = default; + AzureStorageProtocol? protocol = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -143,6 +149,15 @@ internal static AppServiceStorageAccessInfo DeserializeAppServiceStorageAccessIn state = property.Value.GetString().ToAppServiceStorageAccountState(); continue; } + if (property.NameEquals("protocol"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocol = new AzureStorageProtocol(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); @@ -156,6 +171,7 @@ internal static AppServiceStorageAccessInfo DeserializeAppServiceStorageAccessIn accessKey, mountPath, state, + protocol, serializedAdditionalRawData); } @@ -292,6 +308,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Protocol), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" protocol: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Protocol)) + { + builder.Append(" protocol: "); + builder.AppendLine($"'{Protocol.Value.ToString()}'"); + } + } + builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceStorageAccessInfo.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceStorageAccessInfo.cs index 825ca9507713c..a6c49118cf10b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceStorageAccessInfo.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceStorageAccessInfo.cs @@ -57,8 +57,9 @@ public AppServiceStorageAccessInfo() /// Access key for the storage account. /// Path to mount the storage within the site's runtime environment. /// State of the storage account. + /// Mounting protocol to use for the storage account. /// Keeps track of any properties unknown to the library. - internal AppServiceStorageAccessInfo(AppServiceStorageType? storageType, string accountName, string shareName, string accessKey, string mountPath, AppServiceStorageAccountState? state, IDictionary serializedAdditionalRawData) + internal AppServiceStorageAccessInfo(AppServiceStorageType? storageType, string accountName, string shareName, string accessKey, string mountPath, AppServiceStorageAccountState? state, AzureStorageProtocol? protocol, IDictionary serializedAdditionalRawData) { StorageType = storageType; AccountName = accountName; @@ -66,6 +67,7 @@ internal AppServiceStorageAccessInfo(AppServiceStorageType? storageType, string AccessKey = accessKey; MountPath = mountPath; State = state; + Protocol = protocol; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -87,5 +89,8 @@ internal AppServiceStorageAccessInfo(AppServiceStorageType? storageType, string /// State of the storage account. [WirePath("state")] public AppServiceStorageAccountState? State { get; } + /// Mounting protocol to use for the storage account. + [WirePath("protocol")] + public AzureStorageProtocol? Protocol { get; set; } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceSupportedTlsVersion.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceSupportedTlsVersion.cs index 68fb8f7896801..cff486fc89fa0 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceSupportedTlsVersion.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AppServiceSupportedTlsVersion.cs @@ -25,6 +25,9 @@ public AppServiceSupportedTlsVersion(string value) private const string Tls1_0Value = "1.0"; private const string Tls1_1Value = "1.1"; private const string Tls1_2Value = "1.2"; + private const string One3Value = "1.3"; + /// 1.3. + public static AppServiceSupportedTlsVersion One3 { get; } = new AppServiceSupportedTlsVersion(One3Value); /// Determines if two values are the same. public static bool operator ==(AppServiceSupportedTlsVersion left, AppServiceSupportedTlsVersion right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegion.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegion.Serialization.cs new file mode 100644 index 0000000000000..c2ece6801551f --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegion.Serialization.cs @@ -0,0 +1,545 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class AseRegion : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AseRegion)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (options.Format != "W" && Optional.IsDefined(Standard)) + { + writer.WritePropertyName("standard"u8); + writer.WriteBooleanValue(Standard.Value); + } + if (options.Format != "W" && Optional.IsDefined(DedicatedHost)) + { + writer.WritePropertyName("dedicatedHost"u8); + writer.WriteBooleanValue(DedicatedHost.Value); + } + if (options.Format != "W" && Optional.IsDefined(ZoneRedundant)) + { + writer.WritePropertyName("zoneRedundant"u8); + writer.WriteBooleanValue(ZoneRedundant.Value); + } + if (Optional.IsCollectionDefined(AvailableSku)) + { + writer.WritePropertyName("availableSku"u8); + writer.WriteStartArray(); + foreach (var item in AvailableSku) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AvailableOS)) + { + writer.WritePropertyName("availableOS"u8); + writer.WriteStartArray(); + foreach (var item in AvailableOS) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AseRegion IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AseRegion)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAseRegion(document.RootElement, options); + } + + internal static AseRegion DeserializeAseRegion(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + string displayName = default; + bool? standard = default; + bool? dedicatedHost = default; + bool? zoneRedundant = default; + IList availableSku = default; + IList availableOS = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("standard"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + standard = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("dedicatedHost"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dedicatedHost = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("zoneRedundant"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + zoneRedundant = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("availableSku"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + availableSku = array; + continue; + } + if (property0.NameEquals("availableOS"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + availableOS = array; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AseRegion( + id, + name, + type, + systemData, + displayName, + standard, + dedicatedHost, + zoneRedundant, + availableSku ?? new ChangeTrackingList(), + availableOS ?? new ChangeTrackingList(), + kind, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kind: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Kind)) + { + builder.Append(" kind: "); + if (Kind.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Kind}'''"); + } + else + { + builder.AppendLine($"'{Kind}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DisplayName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" displayName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DisplayName)) + { + builder.Append(" displayName: "); + if (DisplayName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DisplayName}'''"); + } + else + { + builder.AppendLine($"'{DisplayName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Standard), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" standard: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Standard)) + { + builder.Append(" standard: "); + var boolValue = Standard.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DedicatedHost), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dedicatedHost: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DedicatedHost)) + { + builder.Append(" dedicatedHost: "); + var boolValue = DedicatedHost.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ZoneRedundant), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" zoneRedundant: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ZoneRedundant)) + { + builder.Append(" zoneRedundant: "); + var boolValue = ZoneRedundant.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AvailableSku), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" availableSku: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AvailableSku)) + { + if (AvailableSku.Any()) + { + builder.Append(" availableSku: "); + builder.AppendLine("["); + foreach (var item in AvailableSku) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AvailableOS), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" availableOS: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AvailableOS)) + { + if (AvailableOS.Any()) + { + builder.Append(" availableOS: "); + builder.AppendLine("["); + foreach (var item in AvailableOS) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AseRegion)} does not support writing '{options.Format}' format."); + } + } + + AseRegion IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAseRegion(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AseRegion)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegion.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegion.cs new file mode 100644 index 0000000000000..978726a876361 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegion.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService.Models +{ + /// ASE region. + public partial class AseRegion : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public AseRegion() + { + AvailableSku = new ChangeTrackingList(); + AvailableOS = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Display name for region. + /// Is region standard. + /// Dedicated host enabled. + /// Zone redundant deployment enabled. + /// Available Skus in region. + /// Available OSs in region. + /// Kind of resource. + /// Keeps track of any properties unknown to the library. + internal AseRegion(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, bool? standard, bool? dedicatedHost, bool? zoneRedundant, IList availableSku, IList availableOS, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + DisplayName = displayName; + Standard = standard; + DedicatedHost = dedicatedHost; + ZoneRedundant = zoneRedundant; + AvailableSku = availableSku; + AvailableOS = availableOS; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Display name for region. + [WirePath("properties.displayName")] + public string DisplayName { get; } + /// Is region standard. + [WirePath("properties.standard")] + public bool? Standard { get; } + /// Dedicated host enabled. + [WirePath("properties.dedicatedHost")] + public bool? DedicatedHost { get; } + /// Zone redundant deployment enabled. + [WirePath("properties.zoneRedundant")] + public bool? ZoneRedundant { get; } + /// Available Skus in region. + [WirePath("properties.availableSku")] + public IList AvailableSku { get; } + /// Available OSs in region. + [WirePath("properties.availableOS")] + public IList AvailableOS { get; } + /// Kind of resource. + [WirePath("kind")] + public string Kind { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegionCollection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegionCollection.Serialization.cs new file mode 100644 index 0000000000000..c758d1d61ebd8 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegionCollection.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class AseRegionCollection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AseRegionCollection)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AseRegionCollection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AseRegionCollection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAseRegionCollection(document.RootElement, options); + } + + internal static AseRegionCollection DeserializeAseRegionCollection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AseRegion.DeserializeAseRegion(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AseRegionCollection(value, nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AseRegionCollection)} does not support writing '{options.Format}' format."); + } + } + + AseRegionCollection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAseRegionCollection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AseRegionCollection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegionCollection.cs new file mode 100644 index 0000000000000..98e12b6fbe56d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AseRegionCollection.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Collection of ASE regions. + internal partial class AseRegionCollection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Collection of resources. + /// is null. + internal AseRegionCollection(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// Collection of resources. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal AseRegionCollection(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AseRegionCollection() + { + } + + /// Collection of resources. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AuthType.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AuthType.Serialization.cs new file mode 100644 index 0000000000000..e9e2c8617f647 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AuthType.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.AppService.Models +{ + internal static partial class AuthTypeExtensions + { + public static string ToSerialString(this AuthType value) => value switch + { + AuthType.Anonymous => "Anonymous", + AuthType.UserCredentials => "UserCredentials", + AuthType.SystemIdentity => "SystemIdentity", + AuthType.UserAssigned => "UserAssigned", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AuthType value.") + }; + + public static AuthType ToAuthType(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Anonymous")) return AuthType.Anonymous; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "UserCredentials")) return AuthType.UserCredentials; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "SystemIdentity")) return AuthType.SystemIdentity; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "UserAssigned")) return AuthType.UserAssigned; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AuthType value."); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AuthType.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AuthType.cs new file mode 100644 index 0000000000000..90ff09e29948f --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AuthType.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.AppService.Models +{ + /// Auth Type. + public enum AuthType + { + /// Anonymous. + Anonymous, + /// UserCredentials. + UserCredentials, + /// SystemIdentity. + SystemIdentity, + /// UserAssigned. + UserAssigned + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AuthenticationType.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AuthenticationType.cs new file mode 100644 index 0000000000000..db81381c0294c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AuthenticationType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Property to select authentication type to access the selected storage account. Available options: SystemAssignedIdentity, UserAssignedIdentity, StorageAccountConnectionString. + public readonly partial struct AuthenticationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthenticationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SystemAssignedIdentityValue = "SystemAssignedIdentity"; + private const string UserAssignedIdentityValue = "UserAssignedIdentity"; + private const string StorageAccountConnectionStringValue = "StorageAccountConnectionString"; + + /// SystemAssignedIdentity. + public static AuthenticationType SystemAssignedIdentity { get; } = new AuthenticationType(SystemAssignedIdentityValue); + /// UserAssignedIdentity. + public static AuthenticationType UserAssignedIdentity { get; } = new AuthenticationType(UserAssignedIdentityValue); + /// StorageAccountConnectionString. + public static AuthenticationType StorageAccountConnectionString { get; } = new AuthenticationType(StorageAccountConnectionStringValue); + /// Determines if two values are the same. + public static bool operator ==(AuthenticationType left, AuthenticationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthenticationType left, AuthenticationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AuthenticationType(string value) => new AuthenticationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthenticationType other && Equals(other); + /// + public bool Equals(AuthenticationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AutoGeneratedDomainNameLabelScope.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AutoGeneratedDomainNameLabelScope.Serialization.cs new file mode 100644 index 0000000000000..7f8b14d485f5c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AutoGeneratedDomainNameLabelScope.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.AppService.Models +{ + internal static partial class AutoGeneratedDomainNameLabelScopeExtensions + { + public static string ToSerialString(this AutoGeneratedDomainNameLabelScope value) => value switch + { + AutoGeneratedDomainNameLabelScope.TenantReuse => "TenantReuse", + AutoGeneratedDomainNameLabelScope.SubscriptionReuse => "SubscriptionReuse", + AutoGeneratedDomainNameLabelScope.ResourceGroupReuse => "ResourceGroupReuse", + AutoGeneratedDomainNameLabelScope.NoReuse => "NoReuse", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AutoGeneratedDomainNameLabelScope value.") + }; + + public static AutoGeneratedDomainNameLabelScope ToAutoGeneratedDomainNameLabelScope(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "TenantReuse")) return AutoGeneratedDomainNameLabelScope.TenantReuse; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "SubscriptionReuse")) return AutoGeneratedDomainNameLabelScope.SubscriptionReuse; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "ResourceGroupReuse")) return AutoGeneratedDomainNameLabelScope.ResourceGroupReuse; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "NoReuse")) return AutoGeneratedDomainNameLabelScope.NoReuse; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AutoGeneratedDomainNameLabelScope value."); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AutoGeneratedDomainNameLabelScope.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AutoGeneratedDomainNameLabelScope.cs new file mode 100644 index 0000000000000..423dd363dec71 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AutoGeneratedDomainNameLabelScope.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.AppService.Models +{ + /// Specifies the DNL scope of the default hostname. + public enum AutoGeneratedDomainNameLabelScope + { + /// TenantReuse. + TenantReuse, + /// SubscriptionReuse. + SubscriptionReuse, + /// ResourceGroupReuse. + ResourceGroupReuse, + /// NoReuse. + NoReuse + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AzureResourceErrorInfo.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AzureResourceErrorInfo.Serialization.cs new file mode 100644 index 0000000000000..1e4aa98620113 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AzureResourceErrorInfo.Serialization.cs @@ -0,0 +1,240 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class AzureResourceErrorInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureResourceErrorInfo)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + if (Optional.IsCollectionDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStartArray(); + foreach (var item in Details) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AzureResourceErrorInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AzureResourceErrorInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureResourceErrorInfo(document.RootElement, options); + } + + internal static AzureResourceErrorInfo DeserializeAzureResourceErrorInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string message = default; + IReadOnlyList details = default; + string code = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("details"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeAzureResourceErrorInfo(item, options)); + } + details = array; + continue; + } + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureResourceErrorInfo(code, serializedAdditionalRawData, message, details ?? new ChangeTrackingList()); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" message: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Message)) + { + builder.Append(" message: "); + if (Message.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Message}'''"); + } + else + { + builder.AppendLine($"'{Message}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Details), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" details: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Details)) + { + if (Details.Any()) + { + builder.Append(" details: "); + builder.AppendLine("["); + foreach (var item in Details) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " details: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Code), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" code: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Code)) + { + builder.Append(" code: "); + if (Code.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Code}'''"); + } + else + { + builder.AppendLine($"'{Code}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(AzureResourceErrorInfo)} does not support writing '{options.Format}' format."); + } + } + + AzureResourceErrorInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAzureResourceErrorInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureResourceErrorInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AzureResourceErrorInfo.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AzureResourceErrorInfo.cs new file mode 100644 index 0000000000000..1c6be691df7bd --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AzureResourceErrorInfo.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The azure resource error info. + public partial class AzureResourceErrorInfo : ErrorInfo + { + /// Initializes a new instance of . + /// The error code. + /// The error message. + /// or is null. + internal AzureResourceErrorInfo(string code, string message) : base(code) + { + Argument.AssertNotNull(code, nameof(code)); + Argument.AssertNotNull(message, nameof(message)); + + Message = message; + Details = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The error code. + /// Keeps track of any properties unknown to the library. + /// The error message. + /// The error details. + internal AzureResourceErrorInfo(string code, IDictionary serializedAdditionalRawData, string message, IReadOnlyList details) : base(code, serializedAdditionalRawData) + { + Message = message; + Details = details; + } + + /// Initializes a new instance of for deserialization. + internal AzureResourceErrorInfo() + { + } + + /// The error message. + [WirePath("message")] + public string Message { get; } + /// The error details. + [WirePath("details")] + public IReadOnlyList Details { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AzureStorageProtocol.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AzureStorageProtocol.cs new file mode 100644 index 0000000000000..c002ea9d4827e --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/AzureStorageProtocol.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Mounting protocol to use for the storage account. + public readonly partial struct AzureStorageProtocol : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AzureStorageProtocol(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SmbValue = "Smb"; + private const string HttpValue = "Http"; + private const string NfsValue = "Nfs"; + + /// Smb. + public static AzureStorageProtocol Smb { get; } = new AzureStorageProtocol(SmbValue); + /// Http. + public static AzureStorageProtocol Http { get; } = new AzureStorageProtocol(HttpValue); + /// Nfs. + public static AzureStorageProtocol Nfs { get; } = new AzureStorageProtocol(NfsValue); + /// Determines if two values are the same. + public static bool operator ==(AzureStorageProtocol left, AzureStorageProtocol right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AzureStorageProtocol left, AzureStorageProtocol right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AzureStorageProtocol(string value) => new AzureStorageProtocol(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AzureStorageProtocol other && Equals(other); + /// + public bool Equals(AzureStorageProtocol other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/BasicAuthName.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/BasicAuthName.cs new file mode 100644 index 0000000000000..0ea2bf82ceea2 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/BasicAuthName.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The BasicAuthName. + public readonly partial struct BasicAuthName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public BasicAuthName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "default"; + + /// default. + public static BasicAuthName Default { get; } = new BasicAuthName(DefaultValue); + /// Determines if two values are the same. + public static bool operator ==(BasicAuthName left, BasicAuthName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(BasicAuthName left, BasicAuthName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator BasicAuthName(string value) => new BasicAuthName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is BasicAuthName other && Equals(other); + /// + public bool Equals(BasicAuthName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CertificateOrderAction.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CertificateOrderAction.Serialization.cs index fef8ef883c631..3893e6bfe07f8 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CertificateOrderAction.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CertificateOrderAction.Serialization.cs @@ -11,7 +11,6 @@ using System.Text; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppService.Models { @@ -27,33 +26,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader throw new FormatException($"The model {nameof(CertificateOrderAction)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (Optional.IsDefined(Kind)) - { - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - } - if (options.Format != "W") - { - writer.WritePropertyName("id"u8); - writer.WriteStringValue(Id); - } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (options.Format != "W") - { - writer.WritePropertyName("type"u8); - writer.WriteStringValue(ResourceType); - } - if (options.Format != "W" && Optional.IsDefined(SystemData)) - { - writer.WritePropertyName("systemData"u8); - JsonSerializer.Serialize(writer, SystemData); - } - writer.WritePropertyName("properties"u8); writer.WriteStartObject(); if (options.Format != "W" && Optional.IsDefined(ActionType)) { @@ -65,7 +37,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReader writer.WritePropertyName("createdAt"u8); writer.WriteStringValue(CreatedOn.Value, "O"); } - writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -104,74 +75,28 @@ internal static CertificateOrderAction DeserializeCertificateOrderAction(JsonEle { return null; } - string kind = default; - ResourceIdentifier id = default; - string name = default; - ResourceType type = default; - SystemData systemData = default; CertificateOrderActionType? actionType = default; DateTimeOffset? createdAt = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("kind"u8)) - { - kind = property.Value.GetString(); - continue; - } - if (property.NameEquals("id"u8)) - { - id = new ResourceIdentifier(property.Value.GetString()); - continue; - } - if (property.NameEquals("name"u8)) - { - name = property.Value.GetString(); - continue; - } - if (property.NameEquals("type"u8)) - { - type = new ResourceType(property.Value.GetString()); - continue; - } - if (property.NameEquals("systemData"u8)) + if (property.NameEquals("actionType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { continue; } - systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + actionType = property.Value.GetString().ToCertificateOrderActionType(); continue; } - if (property.NameEquals("properties"u8)) + if (property.NameEquals("createdAt"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) { - property.ThrowNonNullablePropertyIsNull(); continue; } - foreach (var property0 in property.Value.EnumerateObject()) - { - if (property0.NameEquals("actionType"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - actionType = property0.Value.GetString().ToCertificateOrderActionType(); - continue; - } - if (property0.NameEquals("createdAt"u8)) - { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - createdAt = property0.Value.GetDateTimeOffset("O"); - continue; - } - } + createdAt = property.Value.GetDateTimeOffset("O"); continue; } if (options.Format != "W") @@ -180,15 +105,7 @@ internal static CertificateOrderAction DeserializeCertificateOrderAction(JsonEle } } serializedAdditionalRawData = rawDataDictionary; - return new CertificateOrderAction( - id, - name, - type, - systemData, - actionType, - createdAt, - kind, - serializedAdditionalRawData); + return new CertificateOrderAction(actionType, createdAt, serializedAdditionalRawData); } private BinaryData SerializeBicep(ModelReaderWriterOptions options) @@ -202,95 +119,17 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) builder.AppendLine("{"); - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" name: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Name)) - { - builder.Append(" name: "); - if (Name.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Name}'''"); - } - else - { - builder.AppendLine($"'{Name}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" kind: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Kind)) - { - builder.Append(" kind: "); - if (Kind.Contains(Environment.NewLine)) - { - builder.AppendLine("'''"); - builder.AppendLine($"{Kind}'''"); - } - else - { - builder.AppendLine($"'{Kind}'"); - } - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" id: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(Id)) - { - builder.Append(" id: "); - builder.AppendLine($"'{Id.ToString()}'"); - } - } - - hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); - if (hasPropertyOverride) - { - builder.Append(" systemData: "); - builder.AppendLine(propertyOverride); - } - else - { - if (Optional.IsDefined(SystemData)) - { - builder.Append(" systemData: "); - builder.AppendLine($"'{SystemData.ToString()}'"); - } - } - - builder.Append(" properties:"); - builder.AppendLine(" {"); hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActionType), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" actionType: "); + builder.Append(" actionType: "); builder.AppendLine(propertyOverride); } else { if (Optional.IsDefined(ActionType)) { - builder.Append(" actionType: "); + builder.Append(" actionType: "); builder.AppendLine($"'{ActionType.Value.ToSerialString()}'"); } } @@ -298,20 +137,19 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreatedOn), out propertyOverride); if (hasPropertyOverride) { - builder.Append(" createdAt: "); + builder.Append(" createdAt: "); builder.AppendLine(propertyOverride); } else { if (Optional.IsDefined(CreatedOn)) { - builder.Append(" createdAt: "); + builder.Append(" createdAt: "); var formattedDateTimeString = TypeFormatters.ToString(CreatedOn.Value, "o"); builder.AppendLine($"'{formattedDateTimeString}'"); } } - builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CertificateOrderAction.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CertificateOrderAction.cs index 9d50465b51b08..9d834b6863062 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CertificateOrderAction.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CertificateOrderAction.cs @@ -7,13 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; -using Azure.ResourceManager.Models; namespace Azure.ResourceManager.AppService.Models { /// Certificate order action. - public partial class CertificateOrderAction : ResourceData + public partial class CertificateOrderAction { /// /// Keeps track of any properties unknown to the library. @@ -48,35 +46,26 @@ public partial class CertificateOrderAction : ResourceData private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - public CertificateOrderAction() + internal CertificateOrderAction() { } /// Initializes a new instance of . - /// The id. - /// The name. - /// The resourceType. - /// The systemData. /// Action type. /// Time at which the certificate action was performed. - /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal CertificateOrderAction(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, CertificateOrderActionType? actionType, DateTimeOffset? createdOn, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal CertificateOrderAction(CertificateOrderActionType? actionType, DateTimeOffset? createdOn, IDictionary serializedAdditionalRawData) { ActionType = actionType; CreatedOn = createdOn; - Kind = kind; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Action type. - [WirePath("properties.actionType")] + [WirePath("actionType")] public CertificateOrderActionType? ActionType { get; } /// Time at which the certificate action was performed. - [WirePath("properties.createdAt")] + [WirePath("createdAt")] public DateTimeOffset? CreatedOn { get; } - /// Kind of resource. - [WirePath("kind")] - public string Kind { get; set; } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Configuration.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Configuration.Serialization.cs new file mode 100644 index 0000000000000..9682e24cc0cdc --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Configuration.Serialization.cs @@ -0,0 +1,286 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class Configuration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Configuration)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Secrets)) + { + writer.WritePropertyName("secrets"u8); + writer.WriteStartArray(); + foreach (var item in Secrets) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ActiveRevisionsMode)) + { + writer.WritePropertyName("activeRevisionsMode"u8); + writer.WriteStringValue(ActiveRevisionsMode.Value.ToString()); + } + if (Optional.IsDefined(Ingress)) + { + writer.WritePropertyName("ingress"u8); + writer.WriteObjectValue(Ingress, options); + } + if (Optional.IsCollectionDefined(Registries)) + { + writer.WritePropertyName("registries"u8); + writer.WriteStartArray(); + foreach (var item in Registries) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Configuration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Configuration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConfiguration(document.RootElement, options); + } + + internal static Configuration DeserializeConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList secrets = default; + ActiveRevisionsMode? activeRevisionsMode = default; + Ingress ingress = default; + IList registries = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secrets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Secret.DeserializeSecret(item, options)); + } + secrets = array; + continue; + } + if (property.NameEquals("activeRevisionsMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + activeRevisionsMode = new ActiveRevisionsMode(property.Value.GetString()); + continue; + } + if (property.NameEquals("ingress"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ingress = Ingress.DeserializeIngress(property.Value, options); + continue; + } + if (property.NameEquals("registries"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RegistryCredentials.DeserializeRegistryCredentials(item, options)); + } + registries = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Configuration(secrets ?? new ChangeTrackingList(), activeRevisionsMode, ingress, registries ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Secrets), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" secrets: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Secrets)) + { + if (Secrets.Any()) + { + builder.Append(" secrets: "); + builder.AppendLine("["); + foreach (var item in Secrets) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " secrets: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActiveRevisionsMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" activeRevisionsMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ActiveRevisionsMode)) + { + builder.Append(" activeRevisionsMode: "); + builder.AppendLine($"'{ActiveRevisionsMode.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Ingress), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ingress: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Ingress)) + { + builder.Append(" ingress: "); + BicepSerializationHelpers.AppendChildObject(builder, Ingress, options, 2, false, " ingress: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Registries), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" registries: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Registries)) + { + if (Registries.Any()) + { + builder.Append(" registries: "); + builder.AppendLine("["); + foreach (var item in Registries) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " registries: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Configuration)} does not support writing '{options.Format}' format."); + } + } + + Configuration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Configuration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Configuration.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Configuration.cs new file mode 100644 index 0000000000000..bdfa75b25586b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Configuration.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Non versioned Container App configuration properties that define the mutable settings of a Container app. + public partial class Configuration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Configuration() + { + Secrets = new ChangeTrackingList(); + Registries = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Collection of secrets used by a Container app. + /// + /// ActiveRevisionsMode controls how active revisions are handled for the Container app: + /// <list><item>Multiple: multiple revisions can be active. If no value if provided, this is the default</item><item>Single: Only one revision can be active at a time. Revision weights can not be used in this mode</item></list> + /// + /// Ingress configurations. + /// Collection of private container registry credentials for containers used by the Container app. + /// Keeps track of any properties unknown to the library. + internal Configuration(IList secrets, ActiveRevisionsMode? activeRevisionsMode, Ingress ingress, IList registries, IDictionary serializedAdditionalRawData) + { + Secrets = secrets; + ActiveRevisionsMode = activeRevisionsMode; + Ingress = ingress; + Registries = registries; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Collection of secrets used by a Container app. + [WirePath("secrets")] + public IList Secrets { get; } + /// + /// ActiveRevisionsMode controls how active revisions are handled for the Container app: + /// <list><item>Multiple: multiple revisions can be active. If no value if provided, this is the default</item><item>Single: Only one revision can be active at a time. Revision weights can not be used in this mode</item></list> + /// + [WirePath("activeRevisionsMode")] + public ActiveRevisionsMode? ActiveRevisionsMode { get; set; } + /// Ingress configurations. + [WirePath("ingress")] + public Ingress Ingress { get; set; } + /// Collection of private container registry credentials for containers used by the Container app. + [WirePath("registries")] + public IList Registries { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Container.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Container.Serialization.cs new file mode 100644 index 0000000000000..285479b32bb7a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Container.Serialization.cs @@ -0,0 +1,405 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class Container : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Container)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Image)) + { + writer.WritePropertyName("image"u8); + writer.WriteStringValue(Image); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsCollectionDefined(Command)) + { + writer.WritePropertyName("command"u8); + writer.WriteStartArray(); + foreach (var item in Command) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Args)) + { + writer.WritePropertyName("args"u8); + writer.WriteStartArray(); + foreach (var item in Args) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Env)) + { + writer.WritePropertyName("env"u8); + writer.WriteStartArray(); + foreach (var item in Env) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Resources)) + { + writer.WritePropertyName("resources"u8); + writer.WriteObjectValue(Resources, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Container IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Container)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContainer(document.RootElement, options); + } + + internal static Container DeserializeContainer(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string image = default; + string name = default; + IList command = default; + IList args = default; + IList env = default; + ContainerResources resources = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("image"u8)) + { + image = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("command"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + command = array; + continue; + } + if (property.NameEquals("args"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + args = array; + continue; + } + if (property.NameEquals("env"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EnvironmentVar.DeserializeEnvironmentVar(item, options)); + } + env = array; + continue; + } + if (property.NameEquals("resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + resources = ContainerResources.DeserializeContainerResources(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Container( + image, + name, + command ?? new ChangeTrackingList(), + args ?? new ChangeTrackingList(), + env ?? new ChangeTrackingList(), + resources, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Image), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" image: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Image)) + { + builder.Append(" image: "); + if (Image.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Image}'''"); + } + else + { + builder.AppendLine($"'{Image}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Command), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" command: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Command)) + { + if (Command.Any()) + { + builder.Append(" command: "); + builder.AppendLine("["); + foreach (var item in Command) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Args), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" args: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Args)) + { + if (Args.Any()) + { + builder.Append(" args: "); + builder.AppendLine("["); + foreach (var item in Args) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Env), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" env: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Env)) + { + if (Env.Any()) + { + builder.Append(" env: "); + builder.AppendLine("["); + foreach (var item in Env) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " env: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Resources), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resources: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Resources)) + { + builder.Append(" resources: "); + BicepSerializationHelpers.AppendChildObject(builder, Resources, options, 2, false, " resources: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Container)} does not support writing '{options.Format}' format."); + } + } + + Container IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeContainer(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Container)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Container.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Container.cs new file mode 100644 index 0000000000000..e2c8ca5b715d9 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Container.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App container definition. + public partial class Container + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Container() + { + Command = new ChangeTrackingList(); + Args = new ChangeTrackingList(); + Env = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Container image tag. + /// Custom container name. + /// Container start command. + /// Container start command arguments. + /// Container environment variables. + /// Container resource requirements. + /// Keeps track of any properties unknown to the library. + internal Container(string image, string name, IList command, IList args, IList env, ContainerResources resources, IDictionary serializedAdditionalRawData) + { + Image = image; + Name = name; + Command = command; + Args = args; + Env = env; + Resources = resources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Container image tag. + [WirePath("image")] + public string Image { get; set; } + /// Custom container name. + [WirePath("name")] + public string Name { get; set; } + /// Container start command. + [WirePath("command")] + public IList Command { get; } + /// Container start command arguments. + [WirePath("args")] + public IList Args { get; } + /// Container environment variables. + [WirePath("env")] + public IList Env { get; } + /// Container resource requirements. + [WirePath("resources")] + public ContainerResources Resources { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppCollection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppCollection.Serialization.cs new file mode 100644 index 0000000000000..a5623dbcd092b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppCollection.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class ContainerAppCollection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerAppCollection)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ContainerAppCollection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerAppCollection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppCollection(document.RootElement, options); + } + + internal static ContainerAppCollection DeserializeContainerAppCollection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ContainerAppData.DeserializeContainerAppData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ContainerAppCollection(value, nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ContainerAppCollection)} does not support writing '{options.Format}' format."); + } + } + + ContainerAppCollection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeContainerAppCollection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ContainerAppCollection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppCollection.cs new file mode 100644 index 0000000000000..f75c2e7eac577 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppCollection.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App collection ARM resource. + internal partial class ContainerAppCollection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Collection of resources. + /// is null. + internal ContainerAppCollection(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// Collection of resources. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal ContainerAppCollection(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ContainerAppCollection() + { + } + + /// Collection of resources. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppProvisioningState.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppProvisioningState.cs new file mode 100644 index 0000000000000..fd8caba08151e --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppProvisioningState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Provisioning state of the Container App. + public readonly partial struct ContainerAppProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ContainerAppProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InProgressValue = "InProgress"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// InProgress. + public static ContainerAppProvisioningState InProgress { get; } = new ContainerAppProvisioningState(InProgressValue); + /// Succeeded. + public static ContainerAppProvisioningState Succeeded { get; } = new ContainerAppProvisioningState(SucceededValue); + /// Failed. + public static ContainerAppProvisioningState Failed { get; } = new ContainerAppProvisioningState(FailedValue); + /// Canceled. + public static ContainerAppProvisioningState Canceled { get; } = new ContainerAppProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ContainerAppProvisioningState left, ContainerAppProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ContainerAppProvisioningState left, ContainerAppProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ContainerAppProvisioningState(string value) => new ContainerAppProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ContainerAppProvisioningState other && Equals(other); + /// + public bool Equals(ContainerAppProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppSecret.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppSecret.Serialization.cs new file mode 100644 index 0000000000000..9773cdfe50552 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppSecret.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ContainerAppSecret : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerAppSecret)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ContainerAppSecret IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerAppSecret)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppSecret(document.RootElement, options); + } + + internal static ContainerAppSecret DeserializeContainerAppSecret(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ContainerAppSecret(name, value, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ContainerAppSecret)} does not support writing '{options.Format}' format."); + } + } + + ContainerAppSecret IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeContainerAppSecret(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ContainerAppSecret)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppSecret.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppSecret.cs new file mode 100644 index 0000000000000..a9720704b04ac --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppSecret.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App Secret. + public partial class ContainerAppSecret + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ContainerAppSecret() + { + } + + /// Initializes a new instance of . + /// Secret Name. + /// Secret Value. + /// Keeps track of any properties unknown to the library. + internal ContainerAppSecret(string name, string value, IDictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Secret Name. + [WirePath("name")] + public string Name { get; } + /// Secret Value. + [WirePath("value")] + public string Value { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppsConfiguration.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppsConfiguration.Serialization.cs new file mode 100644 index 0000000000000..4b5738584bbbc --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppsConfiguration.Serialization.cs @@ -0,0 +1,340 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ContainerAppsConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerAppsConfiguration)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(DaprAIInstrumentationKey)) + { + writer.WritePropertyName("daprAIInstrumentationKey"u8); + writer.WriteStringValue(DaprAIInstrumentationKey); + } + if (Optional.IsDefined(PlatformReservedCidr)) + { + writer.WritePropertyName("platformReservedCidr"u8); + writer.WriteStringValue(PlatformReservedCidr); + } + if (Optional.IsDefined(PlatformReservedDnsIP)) + { + writer.WritePropertyName("platformReservedDnsIP"u8); + writer.WriteStringValue(PlatformReservedDnsIP); + } + if (Optional.IsDefined(ControlPlaneSubnetResourceId)) + { + writer.WritePropertyName("controlPlaneSubnetResourceId"u8); + writer.WriteStringValue(ControlPlaneSubnetResourceId); + } + if (Optional.IsDefined(AppSubnetResourceId)) + { + writer.WritePropertyName("appSubnetResourceId"u8); + writer.WriteStringValue(AppSubnetResourceId); + } + if (Optional.IsDefined(DockerBridgeCidr)) + { + writer.WritePropertyName("dockerBridgeCidr"u8); + writer.WriteStringValue(DockerBridgeCidr); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ContainerAppsConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerAppsConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContainerAppsConfiguration(document.RootElement, options); + } + + internal static ContainerAppsConfiguration DeserializeContainerAppsConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string daprAIInstrumentationKey = default; + string platformReservedCidr = default; + string platformReservedDnsIP = default; + string controlPlaneSubnetResourceId = default; + string appSubnetResourceId = default; + string dockerBridgeCidr = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("daprAIInstrumentationKey"u8)) + { + daprAIInstrumentationKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("platformReservedCidr"u8)) + { + platformReservedCidr = property.Value.GetString(); + continue; + } + if (property.NameEquals("platformReservedDnsIP"u8)) + { + platformReservedDnsIP = property.Value.GetString(); + continue; + } + if (property.NameEquals("controlPlaneSubnetResourceId"u8)) + { + controlPlaneSubnetResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("appSubnetResourceId"u8)) + { + appSubnetResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("dockerBridgeCidr"u8)) + { + dockerBridgeCidr = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ContainerAppsConfiguration( + daprAIInstrumentationKey, + platformReservedCidr, + platformReservedDnsIP, + controlPlaneSubnetResourceId, + appSubnetResourceId, + dockerBridgeCidr, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DaprAIInstrumentationKey), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" daprAIInstrumentationKey: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DaprAIInstrumentationKey)) + { + builder.Append(" daprAIInstrumentationKey: "); + if (DaprAIInstrumentationKey.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DaprAIInstrumentationKey}'''"); + } + else + { + builder.AppendLine($"'{DaprAIInstrumentationKey}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PlatformReservedCidr), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" platformReservedCidr: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PlatformReservedCidr)) + { + builder.Append(" platformReservedCidr: "); + if (PlatformReservedCidr.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PlatformReservedCidr}'''"); + } + else + { + builder.AppendLine($"'{PlatformReservedCidr}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PlatformReservedDnsIP), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" platformReservedDnsIP: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PlatformReservedDnsIP)) + { + builder.Append(" platformReservedDnsIP: "); + if (PlatformReservedDnsIP.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PlatformReservedDnsIP}'''"); + } + else + { + builder.AppendLine($"'{PlatformReservedDnsIP}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ControlPlaneSubnetResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" controlPlaneSubnetResourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ControlPlaneSubnetResourceId)) + { + builder.Append(" controlPlaneSubnetResourceId: "); + if (ControlPlaneSubnetResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ControlPlaneSubnetResourceId}'''"); + } + else + { + builder.AppendLine($"'{ControlPlaneSubnetResourceId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AppSubnetResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" appSubnetResourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AppSubnetResourceId)) + { + builder.Append(" appSubnetResourceId: "); + if (AppSubnetResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AppSubnetResourceId}'''"); + } + else + { + builder.AppendLine($"'{AppSubnetResourceId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DockerBridgeCidr), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dockerBridgeCidr: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DockerBridgeCidr)) + { + builder.Append(" dockerBridgeCidr: "); + if (DockerBridgeCidr.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DockerBridgeCidr}'''"); + } + else + { + builder.AppendLine($"'{DockerBridgeCidr}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ContainerAppsConfiguration)} does not support writing '{options.Format}' format."); + } + } + + ContainerAppsConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeContainerAppsConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ContainerAppsConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppsConfiguration.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppsConfiguration.cs new file mode 100644 index 0000000000000..670f50ccdef55 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerAppsConfiguration.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The ContainerAppsConfiguration. + public partial class ContainerAppsConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ContainerAppsConfiguration() + { + } + + /// Initializes a new instance of . + /// Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry. + /// IP range in CIDR notation that can be reserved for environment infrastructure IP addresses. It must not overlap with any other Subnet IP ranges. + /// An IP address from the IP range defined by platformReservedCidr that will be reserved for the internal DNS server. + /// Resource ID of a subnet for control plane infrastructure components. This subnet must be in the same VNET as the subnet defined in appSubnetResourceId. Must not overlap with the IP range defined in platformReservedCidr, if defined. + /// Resource ID of a subnet for control plane infrastructure components. This subnet must be in the same VNET as the subnet defined in appSubnetResourceId. Must not overlap with the IP range defined in platformReservedCidr, if defined. + /// CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the IP range defined in platformReservedCidr, if defined. + /// Keeps track of any properties unknown to the library. + internal ContainerAppsConfiguration(string daprAIInstrumentationKey, string platformReservedCidr, string platformReservedDnsIP, string controlPlaneSubnetResourceId, string appSubnetResourceId, string dockerBridgeCidr, IDictionary serializedAdditionalRawData) + { + DaprAIInstrumentationKey = daprAIInstrumentationKey; + PlatformReservedCidr = platformReservedCidr; + PlatformReservedDnsIP = platformReservedDnsIP; + ControlPlaneSubnetResourceId = controlPlaneSubnetResourceId; + AppSubnetResourceId = appSubnetResourceId; + DockerBridgeCidr = dockerBridgeCidr; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Azure Monitor instrumentation key used by Dapr to export Service to Service communication telemetry. + [WirePath("daprAIInstrumentationKey")] + public string DaprAIInstrumentationKey { get; set; } + /// IP range in CIDR notation that can be reserved for environment infrastructure IP addresses. It must not overlap with any other Subnet IP ranges. + [WirePath("platformReservedCidr")] + public string PlatformReservedCidr { get; set; } + /// An IP address from the IP range defined by platformReservedCidr that will be reserved for the internal DNS server. + [WirePath("platformReservedDnsIP")] + public string PlatformReservedDnsIP { get; set; } + /// Resource ID of a subnet for control plane infrastructure components. This subnet must be in the same VNET as the subnet defined in appSubnetResourceId. Must not overlap with the IP range defined in platformReservedCidr, if defined. + [WirePath("controlPlaneSubnetResourceId")] + public string ControlPlaneSubnetResourceId { get; set; } + /// Resource ID of a subnet for control plane infrastructure components. This subnet must be in the same VNET as the subnet defined in appSubnetResourceId. Must not overlap with the IP range defined in platformReservedCidr, if defined. + [WirePath("appSubnetResourceId")] + public string AppSubnetResourceId { get; set; } + /// CIDR notation IP range assigned to the Docker bridge network. It must not overlap with any Subnet IP ranges or the IP range defined in platformReservedCidr, if defined. + [WirePath("dockerBridgeCidr")] + public string DockerBridgeCidr { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerResources.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerResources.Serialization.cs new file mode 100644 index 0000000000000..70e42cbe23939 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerResources.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ContainerResources : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerResources)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Cpu)) + { + writer.WritePropertyName("cpu"u8); + writer.WriteNumberValue(Cpu.Value); + } + if (Optional.IsDefined(Memory)) + { + writer.WritePropertyName("memory"u8); + writer.WriteStringValue(Memory); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ContainerResources IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContainerResources)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContainerResources(document.RootElement, options); + } + + internal static ContainerResources DeserializeContainerResources(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double? cpu = default; + string memory = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("cpu"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cpu = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("memory"u8)) + { + memory = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ContainerResources(cpu, memory, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Cpu), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" cpu: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Cpu)) + { + builder.Append(" cpu: "); + builder.AppendLine($"'{Cpu.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Memory), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" memory: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Memory)) + { + builder.Append(" memory: "); + if (Memory.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Memory}'''"); + } + else + { + builder.AppendLine($"'{Memory}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ContainerResources)} does not support writing '{options.Format}' format."); + } + } + + ContainerResources IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeContainerResources(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ContainerResources)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerResources.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerResources.cs new file mode 100644 index 0000000000000..3864b5f15da0c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContainerResources.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App container resource requirements. + public partial class ContainerResources + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ContainerResources() + { + } + + /// Initializes a new instance of . + /// Required CPU in cores, e.g. 0.5. + /// Required memory, e.g. "250Mb". + /// Keeps track of any properties unknown to the library. + internal ContainerResources(double? cpu, string memory, IDictionary serializedAdditionalRawData) + { + Cpu = cpu; + Memory = memory; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Required CPU in cores, e.g. 0.5. + [WirePath("cpu")] + public double? Cpu { get; set; } + /// Required memory, e.g. "250Mb". + [WirePath("memory")] + public string Memory { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentHash.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentHash.Serialization.cs new file mode 100644 index 0000000000000..259e29cdd9c2c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentHash.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ContentHash : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContentHash)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Algorithm)) + { + writer.WritePropertyName("algorithm"u8); + writer.WriteStringValue(Algorithm); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ContentHash IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContentHash)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContentHash(document.RootElement, options); + } + + internal static ContentHash DeserializeContentHash(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string algorithm = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("algorithm"u8)) + { + algorithm = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ContentHash(algorithm, value, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Algorithm), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" algorithm: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Algorithm)) + { + builder.Append(" algorithm: "); + if (Algorithm.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Algorithm}'''"); + } + else + { + builder.AppendLine($"'{Algorithm}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ContentHash)} does not support writing '{options.Format}' format."); + } + } + + ContentHash IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeContentHash(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ContentHash)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentHash.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentHash.cs new file mode 100644 index 0000000000000..5554c0916a6bb --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentHash.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The content hash. + public partial class ContentHash + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ContentHash() + { + } + + /// Initializes a new instance of . + /// The algorithm of the content hash. + /// The value of the content hash. + /// Keeps track of any properties unknown to the library. + internal ContentHash(string algorithm, string value, IDictionary serializedAdditionalRawData) + { + Algorithm = algorithm; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The algorithm of the content hash. + [WirePath("algorithm")] + public string Algorithm { get; } + /// The value of the content hash. + [WirePath("value")] + public string Value { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentLink.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentLink.Serialization.cs new file mode 100644 index 0000000000000..6f53f70b8fb5f --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentLink.Serialization.cs @@ -0,0 +1,296 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ContentLink : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContentLink)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Uri)) + { + writer.WritePropertyName("uri"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (options.Format != "W" && Optional.IsDefined(ContentVersion)) + { + writer.WritePropertyName("contentVersion"u8); + writer.WriteStringValue(ContentVersion); + } + if (options.Format != "W" && Optional.IsDefined(ContentSize)) + { + writer.WritePropertyName("contentSize"u8); + writer.WriteNumberValue(ContentSize.Value); + } + if (options.Format != "W" && Optional.IsDefined(ContentHash)) + { + writer.WritePropertyName("contentHash"u8); + writer.WriteObjectValue(ContentHash, options); + } + if (options.Format != "W" && Optional.IsDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Metadata); +#else + using (JsonDocument document = JsonDocument.Parse(Metadata)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ContentLink IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ContentLink)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContentLink(document.RootElement, options); + } + + internal static ContentLink DeserializeContentLink(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri uri = default; + string contentVersion = default; + long? contentSize = default; + ContentHash contentHash = default; + BinaryData metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("uri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("contentVersion"u8)) + { + contentVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("contentSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contentSize = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("contentHash"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contentHash = ContentHash.DeserializeContentHash(property.Value, options); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metadata = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ContentLink( + uri, + contentVersion, + contentSize, + contentHash, + metadata, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Uri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" uri: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Uri)) + { + builder.Append(" uri: "); + builder.AppendLine($"'{Uri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentVersion), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contentVersion: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContentVersion)) + { + builder.Append(" contentVersion: "); + if (ContentVersion.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ContentVersion}'''"); + } + else + { + builder.AppendLine($"'{ContentVersion}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentSize), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contentSize: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContentSize)) + { + builder.Append(" contentSize: "); + builder.AppendLine($"'{ContentSize.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentHash), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contentHash: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContentHash)) + { + builder.Append(" contentHash: "); + BicepSerializationHelpers.AppendChildObject(builder, ContentHash, options, 2, false, " contentHash: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Metadata), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" metadata: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Metadata)) + { + builder.Append(" metadata: "); + builder.AppendLine($"'{Metadata.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ContentLink)} does not support writing '{options.Format}' format."); + } + } + + ContentLink IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeContentLink(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ContentLink)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentLink.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentLink.cs new file mode 100644 index 0000000000000..4510ce7b3e963 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ContentLink.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The content link. + public partial class ContentLink + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ContentLink() + { + } + + /// Initializes a new instance of . + /// The content link URI. + /// The content version. + /// The content size. + /// The content hash. + /// The metadata. + /// Keeps track of any properties unknown to the library. + internal ContentLink(Uri uri, string contentVersion, long? contentSize, ContentHash contentHash, BinaryData metadata, IDictionary serializedAdditionalRawData) + { + Uri = uri; + ContentVersion = contentVersion; + ContentSize = contentSize; + ContentHash = contentHash; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The content link URI. + [WirePath("uri")] + public Uri Uri { get; set; } + /// The content version. + [WirePath("contentVersion")] + public string ContentVersion { get; } + /// The content size. + [WirePath("contentSize")] + public long? ContentSize { get; } + /// The content hash. + [WirePath("contentHash")] + public ContentHash ContentHash { get; } + /// + /// The metadata. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("metadata")] + public BinaryData Metadata { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Correlation.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Correlation.Serialization.cs new file mode 100644 index 0000000000000..01ebb784e5c2b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Correlation.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class Correlation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Correlation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ClientTrackingId)) + { + writer.WritePropertyName("clientTrackingId"u8); + writer.WriteStringValue(ClientTrackingId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Correlation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Correlation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCorrelation(document.RootElement, options); + } + + internal static Correlation DeserializeCorrelation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientTrackingId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientTrackingId"u8)) + { + clientTrackingId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Correlation(clientTrackingId, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClientTrackingId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" clientTrackingId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ClientTrackingId)) + { + builder.Append(" clientTrackingId: "); + if (ClientTrackingId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ClientTrackingId}'''"); + } + else + { + builder.AppendLine($"'{ClientTrackingId}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Correlation)} does not support writing '{options.Format}' format."); + } + } + + Correlation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCorrelation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Correlation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Correlation.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Correlation.cs new file mode 100644 index 0000000000000..d85797096aaa9 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Correlation.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The correlation property. + internal partial class Correlation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal Correlation() + { + } + + /// Initializes a new instance of . + /// The client tracking id. + /// Keeps track of any properties unknown to the library. + internal Correlation(string clientTrackingId, IDictionary serializedAdditionalRawData) + { + ClientTrackingId = clientTrackingId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The client tracking id. + [WirePath("clientTrackingId")] + public string ClientTrackingId { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CsmDeploymentStatusCollection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CsmDeploymentStatusCollection.Serialization.cs new file mode 100644 index 0000000000000..4d9bc1fd18860 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CsmDeploymentStatusCollection.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class CsmDeploymentStatusCollection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CsmDeploymentStatusCollection)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CsmDeploymentStatusCollection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CsmDeploymentStatusCollection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCsmDeploymentStatusCollection(document.RootElement, options); + } + + internal static CsmDeploymentStatusCollection DeserializeCsmDeploymentStatusCollection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CsmDeploymentStatusData.DeserializeCsmDeploymentStatusData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CsmDeploymentStatusCollection(value, nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CsmDeploymentStatusCollection)} does not support writing '{options.Format}' format."); + } + } + + CsmDeploymentStatusCollection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCsmDeploymentStatusCollection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CsmDeploymentStatusCollection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CsmDeploymentStatusCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CsmDeploymentStatusCollection.cs new file mode 100644 index 0000000000000..7512fbeae2578 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CsmDeploymentStatusCollection.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Deployment status collection ARM resource. + internal partial class CsmDeploymentStatusCollection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Collection of resources. + /// is null. + internal CsmDeploymentStatusCollection(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// Collection of resources. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal CsmDeploymentStatusCollection(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CsmDeploymentStatusCollection() + { + } + + /// Collection of resources. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomDnsSuffixProvisioningState.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomDnsSuffixProvisioningState.Serialization.cs new file mode 100644 index 0000000000000..c13df5de71968 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomDnsSuffixProvisioningState.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.AppService.Models +{ + internal static partial class CustomDnsSuffixProvisioningStateExtensions + { + public static string ToSerialString(this CustomDnsSuffixProvisioningState value) => value switch + { + CustomDnsSuffixProvisioningState.Succeeded => "Succeeded", + CustomDnsSuffixProvisioningState.Failed => "Failed", + CustomDnsSuffixProvisioningState.Degraded => "Degraded", + CustomDnsSuffixProvisioningState.InProgress => "InProgress", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown CustomDnsSuffixProvisioningState value.") + }; + + public static CustomDnsSuffixProvisioningState ToCustomDnsSuffixProvisioningState(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Succeeded")) return CustomDnsSuffixProvisioningState.Succeeded; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Failed")) return CustomDnsSuffixProvisioningState.Failed; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Degraded")) return CustomDnsSuffixProvisioningState.Degraded; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "InProgress")) return CustomDnsSuffixProvisioningState.InProgress; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown CustomDnsSuffixProvisioningState value."); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomDnsSuffixProvisioningState.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomDnsSuffixProvisioningState.cs new file mode 100644 index 0000000000000..4dcdd4d073232 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomDnsSuffixProvisioningState.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.AppService.Models +{ + /// The CustomDnsSuffixProvisioningState. + public enum CustomDnsSuffixProvisioningState + { + /// Succeeded. + Succeeded, + /// Failed. + Failed, + /// Degraded. + Degraded, + /// InProgress. + InProgress + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomDomainStatus.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomDomainStatus.cs index f37c1318dcb12..6cdde79a4c6e4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomDomainStatus.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomDomainStatus.cs @@ -28,6 +28,7 @@ public CustomDomainStatus(string value) private const string ReadyValue = "Ready"; private const string FailedValue = "Failed"; private const string DeletingValue = "Deleting"; + private const string UnhealthyValue = "Unhealthy"; /// RetrievingValidationToken. public static CustomDomainStatus RetrievingValidationToken { get; } = new CustomDomainStatus(RetrievingValidationTokenValue); @@ -41,6 +42,8 @@ public CustomDomainStatus(string value) public static CustomDomainStatus Failed { get; } = new CustomDomainStatus(FailedValue); /// Deleting. public static CustomDomainStatus Deleting { get; } = new CustomDomainStatus(DeletingValue); + /// Unhealthy. + public static CustomDomainStatus Unhealthy { get; } = new CustomDomainStatus(UnhealthyValue); /// Determines if two values are the same. public static bool operator ==(CustomDomainStatus left, CustomDomainStatus right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameAnalysisResult.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameAnalysisResult.Serialization.cs index fa141b4b97ad0..bd38f82b6760c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameAnalysisResult.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameAnalysisResult.Serialization.cs @@ -69,7 +69,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model if (options.Format != "W" && Optional.IsDefined(CustomDomainVerificationFailureInfo)) { writer.WritePropertyName("customDomainVerificationFailureInfo"u8); - JsonSerializer.Serialize(writer, CustomDomainVerificationFailureInfo); + writer.WriteObjectValue(CustomDomainVerificationFailureInfo, options); } if (options.Format != "W" && Optional.IsDefined(HasConflictOnScaleUnit)) { @@ -182,7 +182,7 @@ internal static CustomHostnameAnalysisResult DeserializeCustomHostnameAnalysisRe SystemData systemData = default; bool? isHostnameAlreadyVerified = default; DnsVerificationTestResult? customDomainVerificationTest = default; - ResponseError customDomainVerificationFailureInfo = default; + ErrorEntity customDomainVerificationFailureInfo = default; bool? hasConflictOnScaleUnit = default; bool? hasConflictAcrossSubscription = default; string conflictingAppResourceId = default; @@ -257,7 +257,7 @@ internal static CustomHostnameAnalysisResult DeserializeCustomHostnameAnalysisRe { continue; } - customDomainVerificationFailureInfo = JsonSerializer.Deserialize(property0.Value.GetRawText()); + customDomainVerificationFailureInfo = ErrorEntity.DeserializeErrorEntity(property0.Value, options); continue; } if (property0.NameEquals("hasConflictOnScaleUnit"u8)) diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameAnalysisResult.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameAnalysisResult.cs index c8587a6012e65..fa55e2b2b2aab 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameAnalysisResult.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameAnalysisResult.cs @@ -75,7 +75,7 @@ public CustomHostnameAnalysisResult() /// Alternate TXT records controller can see for this hostname. /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal CustomHostnameAnalysisResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isHostnameAlreadyVerified, DnsVerificationTestResult? customDomainVerificationTest, ResponseError customDomainVerificationFailureInfo, bool? hasConflictOnScaleUnit, bool? hasConflictAcrossSubscription, string conflictingAppResourceId, IList cNameRecords, IList txtRecords, IList aRecords, IList alternateCNameRecords, IList alternateTxtRecords, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal CustomHostnameAnalysisResult(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, bool? isHostnameAlreadyVerified, DnsVerificationTestResult? customDomainVerificationTest, ErrorEntity customDomainVerificationFailureInfo, bool? hasConflictOnScaleUnit, bool? hasConflictAcrossSubscription, string conflictingAppResourceId, IList cNameRecords, IList txtRecords, IList aRecords, IList alternateCNameRecords, IList alternateTxtRecords, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { IsHostnameAlreadyVerified = isHostnameAlreadyVerified; CustomDomainVerificationTest = customDomainVerificationTest; @@ -100,7 +100,7 @@ internal CustomHostnameAnalysisResult(ResourceIdentifier id, string name, Resour public DnsVerificationTestResult? CustomDomainVerificationTest { get; } /// Raw failure information if DNS verification fails. [WirePath("properties.customDomainVerificationFailureInfo")] - public ResponseError CustomDomainVerificationFailureInfo { get; } + public ErrorEntity CustomDomainVerificationFailureInfo { get; } /// <code>true</code> if there is a conflict on a scale unit; otherwise, <code>false</code>. [WirePath("properties.hasConflictOnScaleUnit")] public bool? HasConflictOnScaleUnit { get; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSites.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSites.Serialization.cs new file mode 100644 index 0000000000000..88b06e94172a5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSites.Serialization.cs @@ -0,0 +1,409 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class CustomHostnameSites : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHostnameSites)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + } + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(CustomHostname)) + { + writer.WritePropertyName("customHostname"u8); + writer.WriteStringValue(CustomHostname); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (Optional.IsCollectionDefined(SiteResourceIds)) + { + writer.WritePropertyName("siteResourceIds"u8); + writer.WriteStartArray(); + foreach (var item in SiteResourceIds) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomHostnameSites IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHostnameSites)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHostnameSites(document.RootElement, options); + } + + internal static CustomHostnameSites DeserializeCustomHostnameSites(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + string customHostname = default; + string region = default; + IList siteResourceIds = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("customHostname"u8)) + { + customHostname = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("region"u8)) + { + region = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("siteResourceIds"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(AppServiceIdentifierData.DeserializeAppServiceIdentifierData(item, options)); + } + siteResourceIds = array; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHostnameSites( + id, + name, + type, + systemData, + customHostname, + region, + siteResourceIds ?? new ChangeTrackingList(), + kind, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kind: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Kind)) + { + builder.Append(" kind: "); + if (Kind.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Kind}'''"); + } + else + { + builder.AppendLine($"'{Kind}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + builder.AppendLine($"'{SystemData.ToString()}'"); + } + } + + builder.Append(" properties:"); + builder.AppendLine(" {"); + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomHostname), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" customHostname: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CustomHostname)) + { + builder.Append(" customHostname: "); + if (CustomHostname.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CustomHostname}'''"); + } + else + { + builder.AppendLine($"'{CustomHostname}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Region), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" region: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Region)) + { + builder.Append(" region: "); + if (Region.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Region}'''"); + } + else + { + builder.AppendLine($"'{Region}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SiteResourceIds), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" siteResourceIds: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(SiteResourceIds)) + { + if (SiteResourceIds.Any()) + { + builder.Append(" siteResourceIds: "); + builder.AppendLine("["); + foreach (var item in SiteResourceIds) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " siteResourceIds: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine(" }"); + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CustomHostnameSites)} does not support writing '{options.Format}' format."); + } + } + + CustomHostnameSites IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHostnameSites(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHostnameSites)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/PrivateLinkConnectionApprovalRequestInfo.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSites.cs similarity index 60% rename from sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/PrivateLinkConnectionApprovalRequestInfo.cs rename to sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSites.cs index 0f288c0273859..4c9342791aa30 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/PrivateLinkConnectionApprovalRequestInfo.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSites.cs @@ -12,8 +12,8 @@ namespace Azure.ResourceManager.AppService.Models { - /// Private Endpoint Connection Approval ARM resource. - public partial class PrivateLinkConnectionApprovalRequestInfo : ResourceData + /// A hostname and its assigned sites. + public partial class CustomHostnameSites : ResourceData { /// /// Keeps track of any properties unknown to the library. @@ -47,29 +47,40 @@ public partial class PrivateLinkConnectionApprovalRequestInfo : ResourceData /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public PrivateLinkConnectionApprovalRequestInfo() + /// Initializes a new instance of . + public CustomHostnameSites() { + SiteResourceIds = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The id. /// The name. /// The resourceType. /// The systemData. - /// The state of a private link connection. + /// + /// + /// /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal PrivateLinkConnectionApprovalRequestInfo(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, PrivateLinkConnectionState privateLinkServiceConnectionState, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal CustomHostnameSites(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string customHostname, string region, IList siteResourceIds, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { - PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; + CustomHostname = customHostname; + Region = region; + SiteResourceIds = siteResourceIds; Kind = kind; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The state of a private link connection. - [WirePath("properties.privateLinkServiceConnectionState")] - public PrivateLinkConnectionState PrivateLinkServiceConnectionState { get; set; } + /// Gets or sets the custom hostname. + [WirePath("properties.customHostname")] + public string CustomHostname { get; set; } + /// Gets or sets the region. + [WirePath("properties.region")] + public string Region { get; set; } + /// Gets the site resource ids. + [WirePath("properties.siteResourceIds")] + public IList SiteResourceIds { get; } /// Kind of resource. [WirePath("kind")] public string Kind { get; set; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSitesCollection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSitesCollection.Serialization.cs new file mode 100644 index 0000000000000..33736c6e94355 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSitesCollection.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class CustomHostnameSitesCollection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHostnameSitesCollection)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomHostnameSitesCollection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomHostnameSitesCollection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomHostnameSitesCollection(document.RootElement, options); + } + + internal static CustomHostnameSitesCollection DeserializeCustomHostnameSitesCollection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CustomHostnameSites.DeserializeCustomHostnameSites(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomHostnameSitesCollection(value, nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CustomHostnameSitesCollection)} does not support writing '{options.Format}' format."); + } + } + + CustomHostnameSitesCollection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomHostnameSitesCollection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomHostnameSitesCollection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSitesCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSitesCollection.cs new file mode 100644 index 0000000000000..5273527cf415a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomHostnameSitesCollection.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Collection of custom hostname sites. + internal partial class CustomHostnameSitesCollection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Collection of resources. + /// is null. + internal CustomHostnameSitesCollection(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// Collection of resources. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal CustomHostnameSitesCollection(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CustomHostnameSitesCollection() + { + } + + /// Collection of resources. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomScaleRule.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomScaleRule.Serialization.cs new file mode 100644 index 0000000000000..63d2192e849b8 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomScaleRule.Serialization.cs @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class CustomScaleRule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomScaleRule)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(CustomScaleRuleType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(CustomScaleRuleType); + } + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(Auth)) + { + writer.WritePropertyName("auth"u8); + writer.WriteStartArray(); + foreach (var item in Auth) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CustomScaleRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomScaleRule)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomScaleRule(document.RootElement, options); + } + + internal static CustomScaleRule DeserializeCustomScaleRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string type = default; + IDictionary metadata = default; + IList auth = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (property.NameEquals("auth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScaleRuleAuth.DeserializeScaleRuleAuth(item, options)); + } + auth = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomScaleRule(type, metadata ?? new ChangeTrackingDictionary(), auth ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CustomScaleRuleType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CustomScaleRuleType)) + { + builder.Append(" type: "); + if (CustomScaleRuleType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{CustomScaleRuleType}'''"); + } + else + { + builder.AppendLine($"'{CustomScaleRuleType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Metadata), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" metadata: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata.Any()) + { + builder.Append(" metadata: "); + builder.AppendLine("{"); + foreach (var item in Metadata) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Auth), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" auth: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Auth)) + { + if (Auth.Any()) + { + builder.Append(" auth: "); + builder.AppendLine("["); + foreach (var item in Auth) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " auth: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(CustomScaleRule)} does not support writing '{options.Format}' format."); + } + } + + CustomScaleRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCustomScaleRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomScaleRule)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomScaleRule.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomScaleRule.cs new file mode 100644 index 0000000000000..51b1b8870789e --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/CustomScaleRule.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App container Custom scaling rule. + public partial class CustomScaleRule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CustomScaleRule() + { + Metadata = new ChangeTrackingDictionary(); + Auth = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// Type of the custom scale rule + /// eg: azure-servicebus, redis etc. + /// + /// Metadata properties to describe custom scale rule. + /// Authentication secrets for the custom scale rule. + /// Keeps track of any properties unknown to the library. + internal CustomScaleRule(string customScaleRuleType, IDictionary metadata, IList auth, IDictionary serializedAdditionalRawData) + { + CustomScaleRuleType = customScaleRuleType; + Metadata = metadata; + Auth = auth; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// Type of the custom scale rule + /// eg: azure-servicebus, redis etc. + /// + [WirePath("type")] + public string CustomScaleRuleType { get; set; } + /// Metadata properties to describe custom scale rule. + [WirePath("metadata")] + public IDictionary Metadata { get; } + /// Authentication secrets for the custom scale rule. + [WirePath("auth")] + public IList Auth { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Dapr.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Dapr.Serialization.cs new file mode 100644 index 0000000000000..e21452c0f370a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Dapr.Serialization.cs @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class Dapr : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Dapr)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(AppId)) + { + writer.WritePropertyName("appId"u8); + writer.WriteStringValue(AppId); + } + if (Optional.IsDefined(AppPort)) + { + writer.WritePropertyName("appPort"u8); + writer.WriteNumberValue(AppPort.Value); + } + if (Optional.IsCollectionDefined(Components)) + { + writer.WritePropertyName("components"u8); + writer.WriteStartArray(); + foreach (var item in Components) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Dapr IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Dapr)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDapr(document.RootElement, options); + } + + internal static Dapr DeserializeDapr(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + string appId = default; + int? appPort = default; + IList components = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("appId"u8)) + { + appId = property.Value.GetString(); + continue; + } + if (property.NameEquals("appPort"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + appPort = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("components"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DaprComponent.DeserializeDaprComponent(item, options)); + } + components = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Dapr(enabled, appId, appPort, components ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AppId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" appId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AppId)) + { + builder.Append(" appId: "); + if (AppId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AppId}'''"); + } + else + { + builder.AppendLine($"'{AppId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AppPort), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" appPort: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AppPort)) + { + builder.Append(" appPort: "); + builder.AppendLine($"{AppPort.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Components), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" components: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Components)) + { + if (Components.Any()) + { + builder.Append(" components: "); + builder.AppendLine("["); + foreach (var item in Components) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " components: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Dapr)} does not support writing '{options.Format}' format."); + } + } + + Dapr IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDapr(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Dapr)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Dapr.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Dapr.cs new file mode 100644 index 0000000000000..53502f734a6ec --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Dapr.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App Dapr configuration. + public partial class Dapr + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Dapr() + { + Components = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Boolean indicating if the Dapr side car is enabled. + /// Dapr application identifier. + /// Port on which the Dapr side car. + /// Collection of Dapr components. + /// Keeps track of any properties unknown to the library. + internal Dapr(bool? enabled, string appId, int? appPort, IList components, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + AppId = appId; + AppPort = appPort; + Components = components; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Boolean indicating if the Dapr side car is enabled. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Dapr application identifier. + [WirePath("appId")] + public string AppId { get; set; } + /// Port on which the Dapr side car. + [WirePath("appPort")] + public int? AppPort { get; set; } + /// Collection of Dapr components. + [WirePath("components")] + public IList Components { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprComponent.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprComponent.Serialization.cs new file mode 100644 index 0000000000000..1226ca2a38ce0 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprComponent.Serialization.cs @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class DaprComponent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprComponent)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DaprComponentType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(DaprComponentType); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartArray(); + foreach (var item in Metadata) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DaprComponent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprComponent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDaprComponent(document.RootElement, options); + } + + internal static DaprComponent DeserializeDaprComponent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string type = default; + string version = default; + IList metadata = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DaprMetadata.DeserializeDaprMetadata(item, options)); + } + metadata = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DaprComponent(name, type, version, metadata ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DaprComponentType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DaprComponentType)) + { + builder.Append(" type: "); + if (DaprComponentType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DaprComponentType}'''"); + } + else + { + builder.AppendLine($"'{DaprComponentType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + if (Version.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Version}'''"); + } + else + { + builder.AppendLine($"'{Version}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Metadata), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" metadata: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata.Any()) + { + builder.Append(" metadata: "); + builder.AppendLine("["); + foreach (var item in Metadata) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " metadata: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DaprComponent)} does not support writing '{options.Format}' format."); + } + } + + DaprComponent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDaprComponent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DaprComponent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprComponent.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprComponent.cs new file mode 100644 index 0000000000000..64f0c3729c931 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprComponent.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Dapr component configuration. + public partial class DaprComponent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DaprComponent() + { + Metadata = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Component name. + /// Component type. + /// Component version. + /// Component metadata. + /// Keeps track of any properties unknown to the library. + internal DaprComponent(string name, string daprComponentType, string version, IList metadata, IDictionary serializedAdditionalRawData) + { + Name = name; + DaprComponentType = daprComponentType; + Version = version; + Metadata = metadata; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Component name. + [WirePath("name")] + public string Name { get; set; } + /// Component type. + [WirePath("type")] + public string DaprComponentType { get; set; } + /// Component version. + [WirePath("version")] + public string Version { get; set; } + /// Component metadata. + [WirePath("metadata")] + public IList Metadata { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprConfig.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprConfig.Serialization.cs new file mode 100644 index 0000000000000..5f3b1c8f47f66 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprConfig.Serialization.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class DaprConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(AppId)) + { + writer.WritePropertyName("appId"u8); + writer.WriteStringValue(AppId); + } + if (Optional.IsDefined(AppPort)) + { + writer.WritePropertyName("appPort"u8); + writer.WriteNumberValue(AppPort.Value); + } + if (Optional.IsDefined(HttpReadBufferSize)) + { + writer.WritePropertyName("httpReadBufferSize"u8); + writer.WriteNumberValue(HttpReadBufferSize.Value); + } + if (Optional.IsDefined(HttpMaxRequestSize)) + { + writer.WritePropertyName("httpMaxRequestSize"u8); + writer.WriteNumberValue(HttpMaxRequestSize.Value); + } + if (Optional.IsDefined(LogLevel)) + { + writer.WritePropertyName("logLevel"u8); + writer.WriteStringValue(LogLevel.Value.ToString()); + } + if (Optional.IsDefined(EnableApiLogging)) + { + writer.WritePropertyName("enableApiLogging"u8); + writer.WriteBooleanValue(EnableApiLogging.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DaprConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDaprConfig(document.RootElement, options); + } + + internal static DaprConfig DeserializeDaprConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + bool? enabled = default; + string appId = default; + int? appPort = default; + int? httpReadBufferSize = default; + int? httpMaxRequestSize = default; + DaprLogLevel? logLevel = default; + bool? enableApiLogging = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("appId"u8)) + { + appId = property.Value.GetString(); + continue; + } + if (property.NameEquals("appPort"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + appPort = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("httpReadBufferSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + httpReadBufferSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("httpMaxRequestSize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + httpMaxRequestSize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("logLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + logLevel = new DaprLogLevel(property.Value.GetString()); + continue; + } + if (property.NameEquals("enableApiLogging"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enableApiLogging = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DaprConfig( + enabled, + appId, + appPort, + httpReadBufferSize, + httpMaxRequestSize, + logLevel, + enableApiLogging, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Enabled), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enabled: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Enabled)) + { + builder.Append(" enabled: "); + var boolValue = Enabled.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AppId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" appId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AppId)) + { + builder.Append(" appId: "); + if (AppId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AppId}'''"); + } + else + { + builder.AppendLine($"'{AppId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AppPort), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" appPort: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AppPort)) + { + builder.Append(" appPort: "); + builder.AppendLine($"{AppPort.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HttpReadBufferSize), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" httpReadBufferSize: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(HttpReadBufferSize)) + { + builder.Append(" httpReadBufferSize: "); + builder.AppendLine($"{HttpReadBufferSize.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HttpMaxRequestSize), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" httpMaxRequestSize: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(HttpMaxRequestSize)) + { + builder.Append(" httpMaxRequestSize: "); + builder.AppendLine($"{HttpMaxRequestSize.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LogLevel), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" logLevel: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LogLevel)) + { + builder.Append(" logLevel: "); + builder.AppendLine($"'{LogLevel.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnableApiLogging), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enableApiLogging: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnableApiLogging)) + { + builder.Append(" enableApiLogging: "); + var boolValue = EnableApiLogging.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DaprConfig)} does not support writing '{options.Format}' format."); + } + } + + DaprConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDaprConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DaprConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprConfig.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprConfig.cs new file mode 100644 index 0000000000000..ff2f1b3851b16 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprConfig.cs @@ -0,0 +1,96 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// App Dapr configuration. + public partial class DaprConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DaprConfig() + { + } + + /// Initializes a new instance of . + /// Boolean indicating if the Dapr side car is enabled. + /// Dapr application identifier. + /// Tells Dapr which port your application is listening on. + /// Dapr max size of http header read buffer in KB to handle when sending multi-KB headers. Default is 65KB. + /// Increasing max size of request body http servers parameter in MB to handle uploading of big files. Default is 4 MB. + /// Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. + /// Enables API logging for the Dapr sidecar. + /// Keeps track of any properties unknown to the library. + internal DaprConfig(bool? enabled, string appId, int? appPort, int? httpReadBufferSize, int? httpMaxRequestSize, DaprLogLevel? logLevel, bool? enableApiLogging, IDictionary serializedAdditionalRawData) + { + Enabled = enabled; + AppId = appId; + AppPort = appPort; + HttpReadBufferSize = httpReadBufferSize; + HttpMaxRequestSize = httpMaxRequestSize; + LogLevel = logLevel; + EnableApiLogging = enableApiLogging; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Boolean indicating if the Dapr side car is enabled. + [WirePath("enabled")] + public bool? Enabled { get; set; } + /// Dapr application identifier. + [WirePath("appId")] + public string AppId { get; set; } + /// Tells Dapr which port your application is listening on. + [WirePath("appPort")] + public int? AppPort { get; set; } + /// Dapr max size of http header read buffer in KB to handle when sending multi-KB headers. Default is 65KB. + [WirePath("httpReadBufferSize")] + public int? HttpReadBufferSize { get; set; } + /// Increasing max size of request body http servers parameter in MB to handle uploading of big files. Default is 4 MB. + [WirePath("httpMaxRequestSize")] + public int? HttpMaxRequestSize { get; set; } + /// Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. + [WirePath("logLevel")] + public DaprLogLevel? LogLevel { get; set; } + /// Enables API logging for the Dapr sidecar. + [WirePath("enableApiLogging")] + public bool? EnableApiLogging { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprLogLevel.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprLogLevel.cs new file mode 100644 index 0000000000000..bc26259932ab3 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprLogLevel.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Sets the log level for the Dapr sidecar. Allowed values are debug, info, warn, error. Default is info. + public readonly partial struct DaprLogLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DaprLogLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InfoValue = "info"; + private const string DebugValue = "debug"; + private const string WarnValue = "warn"; + private const string ErrorValue = "error"; + + /// info. + public static DaprLogLevel Info { get; } = new DaprLogLevel(InfoValue); + /// debug. + public static DaprLogLevel Debug { get; } = new DaprLogLevel(DebugValue); + /// warn. + public static DaprLogLevel Warn { get; } = new DaprLogLevel(WarnValue); + /// error. + public static DaprLogLevel Error { get; } = new DaprLogLevel(ErrorValue); + /// Determines if two values are the same. + public static bool operator ==(DaprLogLevel left, DaprLogLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DaprLogLevel left, DaprLogLevel right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DaprLogLevel(string value) => new DaprLogLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DaprLogLevel other && Equals(other); + /// + public bool Equals(DaprLogLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprMetadata.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprMetadata.Serialization.cs new file mode 100644 index 0000000000000..c2f18784e7ee7 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprMetadata.Serialization.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class DaprMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(SecretRef)) + { + writer.WritePropertyName("secretRef"u8); + writer.WriteStringValue(SecretRef); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DaprMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDaprMetadata(document.RootElement, options); + } + + internal static DaprMetadata DeserializeDaprMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string value = default; + string secretRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("secretRef"u8)) + { + secretRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DaprMetadata(name, value, secretRef, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecretRef), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" secretRef: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecretRef)) + { + builder.Append(" secretRef: "); + if (SecretRef.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SecretRef}'''"); + } + else + { + builder.AppendLine($"'{SecretRef}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DaprMetadata)} does not support writing '{options.Format}' format."); + } + } + + DaprMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDaprMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DaprMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprMetadata.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprMetadata.cs new file mode 100644 index 0000000000000..69c3091a38073 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaprMetadata.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App Dapr component metadata. + public partial class DaprMetadata + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DaprMetadata() + { + } + + /// Initializes a new instance of . + /// Metadata property name. + /// Metadata property value. + /// Name of the Container App secret from which to pull the metadata property value. + /// Keeps track of any properties unknown to the library. + internal DaprMetadata(string name, string value, string secretRef, IDictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + SecretRef = secretRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Metadata property name. + [WirePath("name")] + public string Name { get; set; } + /// Metadata property value. + [WirePath("value")] + public string Value { get; set; } + /// Name of the Container App secret from which to pull the metadata property value. + [WirePath("secretRef")] + public string SecretRef { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionCollection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionCollection.Serialization.cs new file mode 100644 index 0000000000000..965c13d898b84 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionCollection.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class DatabaseConnectionCollection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DatabaseConnectionCollection)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DatabaseConnectionCollection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DatabaseConnectionCollection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseConnectionCollection(document.RootElement, options); + } + + internal static DatabaseConnectionCollection DeserializeDatabaseConnectionCollection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DatabaseConnectionData.DeserializeDatabaseConnectionData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseConnectionCollection(value, nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DatabaseConnectionCollection)} does not support writing '{options.Format}' format."); + } + } + + DatabaseConnectionCollection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDatabaseConnectionCollection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseConnectionCollection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionCollection.cs new file mode 100644 index 0000000000000..fb3e358b7cbf7 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionCollection.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Collection of static site database connections. + internal partial class DatabaseConnectionCollection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Collection of resources. + /// is null. + internal DatabaseConnectionCollection(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// Collection of resources. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal DatabaseConnectionCollection(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DatabaseConnectionCollection() + { + } + + /// Collection of resources. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionOverview.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionOverview.Serialization.cs new file mode 100644 index 0000000000000..8169d8428e14e --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionOverview.Serialization.cs @@ -0,0 +1,320 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class DatabaseConnectionOverview : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DatabaseConnectionOverview)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (options.Format != "W" && Optional.IsDefined(ConnectionIdentity)) + { + writer.WritePropertyName("connectionIdentity"u8); + writer.WriteStringValue(ConnectionIdentity); + } + if (options.Format != "W" && Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (options.Format != "W" && Optional.IsCollectionDefined(ConfigurationFiles)) + { + writer.WritePropertyName("configurationFiles"u8); + writer.WriteStartArray(); + foreach (var item in ConfigurationFiles) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DatabaseConnectionOverview IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DatabaseConnectionOverview)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseConnectionOverview(document.RootElement, options); + } + + internal static DatabaseConnectionOverview DeserializeDatabaseConnectionOverview(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string resourceId = default; + string connectionIdentity = default; + string region = default; + IReadOnlyList configurationFiles = default; + string name = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceId"u8)) + { + resourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("connectionIdentity"u8)) + { + connectionIdentity = property.Value.GetString(); + continue; + } + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("configurationFiles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StaticSiteDatabaseConnectionConfigurationFileOverview.DeserializeStaticSiteDatabaseConnectionConfigurationFileOverview(item, options)); + } + configurationFiles = array; + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseConnectionOverview( + resourceId, + connectionIdentity, + region, + configurationFiles ?? new ChangeTrackingList(), + name, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceId)) + { + builder.Append(" resourceId: "); + if (ResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceId}'''"); + } + else + { + builder.AppendLine($"'{ResourceId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectionIdentity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" connectionIdentity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ConnectionIdentity)) + { + builder.Append(" connectionIdentity: "); + if (ConnectionIdentity.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ConnectionIdentity}'''"); + } + else + { + builder.AppendLine($"'{ConnectionIdentity}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Region), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" region: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Region)) + { + builder.Append(" region: "); + if (Region.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Region}'''"); + } + else + { + builder.AppendLine($"'{Region}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConfigurationFiles), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" configurationFiles: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ConfigurationFiles)) + { + if (ConfigurationFiles.Any()) + { + builder.Append(" configurationFiles: "); + builder.AppendLine("["); + foreach (var item in ConfigurationFiles) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " configurationFiles: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(DatabaseConnectionOverview)} does not support writing '{options.Format}' format."); + } + } + + DatabaseConnectionOverview IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDatabaseConnectionOverview(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseConnectionOverview)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionOverview.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionOverview.cs new file mode 100644 index 0000000000000..3f9408c74e58f --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionOverview.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Static Site Database Connection overview. + public partial class DatabaseConnectionOverview + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DatabaseConnectionOverview() + { + ConfigurationFiles = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The resource id of the database. + /// If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. + /// The region of the database resource. + /// A list of configuration files associated with this database connection. + /// If present, the name of this database connection resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseConnectionOverview(string resourceId, string connectionIdentity, string region, IReadOnlyList configurationFiles, string name, IDictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + ConnectionIdentity = connectionIdentity; + Region = region; + ConfigurationFiles = configurationFiles; + Name = name; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource id of the database. + [WirePath("resourceId")] + public string ResourceId { get; } + /// If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. + [WirePath("connectionIdentity")] + public string ConnectionIdentity { get; } + /// The region of the database resource. + [WirePath("region")] + public string Region { get; } + /// A list of configuration files associated with this database connection. + [WirePath("configurationFiles")] + public IReadOnlyList ConfigurationFiles { get; } + /// If present, the name of this database connection resource. + [WirePath("name")] + public string Name { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionPatchRequest.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionPatchRequest.Serialization.cs new file mode 100644 index 0000000000000..346613a9c62e2 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionPatchRequest.Serialization.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class DatabaseConnectionPatchRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DatabaseConnectionPatchRequest)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(ResourceId)) + { + writer.WritePropertyName("resourceId"u8); + writer.WriteStringValue(ResourceId); + } + if (Optional.IsDefined(ConnectionIdentity)) + { + writer.WritePropertyName("connectionIdentity"u8); + writer.WriteStringValue(ConnectionIdentity); + } + if (Optional.IsDefined(ConnectionString)) + { + writer.WritePropertyName("connectionString"u8); + writer.WriteStringValue(ConnectionString); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DatabaseConnectionPatchRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DatabaseConnectionPatchRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDatabaseConnectionPatchRequest(document.RootElement, options); + } + + internal static DatabaseConnectionPatchRequest DeserializeDatabaseConnectionPatchRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string resourceId = default; + string connectionIdentity = default; + string connectionString = default; + string region = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("resourceId"u8)) + { + resourceId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("connectionIdentity"u8)) + { + connectionIdentity = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("connectionString"u8)) + { + connectionString = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("region"u8)) + { + region = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DatabaseConnectionPatchRequest(resourceId, connectionIdentity, connectionString, region, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DatabaseConnectionPatchRequest)} does not support writing '{options.Format}' format."); + } + } + + DatabaseConnectionPatchRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDatabaseConnectionPatchRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DatabaseConnectionPatchRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionPatchRequest.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionPatchRequest.cs new file mode 100644 index 0000000000000..8e100e94ea69d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DatabaseConnectionPatchRequest.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Static Site Database Connection Request Properties resource when patching. + public partial class DatabaseConnectionPatchRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DatabaseConnectionPatchRequest() + { + } + + /// Initializes a new instance of . + /// The resource id of the database. + /// If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. + /// The connection string to use to connect to the database. + /// The region of the database resource. + /// Keeps track of any properties unknown to the library. + internal DatabaseConnectionPatchRequest(string resourceId, string connectionIdentity, string connectionString, string region, IDictionary serializedAdditionalRawData) + { + ResourceId = resourceId; + ConnectionIdentity = connectionIdentity; + ConnectionString = connectionString; + Region = region; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource id of the database. + [WirePath("properties.resourceId")] + public string ResourceId { get; set; } + /// If present, the identity is used in conjunction with connection string to connect to the database. Use of the system-assigned managed identity is indicated with the string 'SystemAssigned', while use of a user-assigned managed identity is indicated with the resource id of the managed identity resource. + [WirePath("properties.connectionIdentity")] + public string ConnectionIdentity { get; set; } + /// The connection string to use to connect to the database. + [WirePath("properties.connectionString")] + public string ConnectionString { get; set; } + /// The region of the database resource. + [WirePath("properties.region")] + public string Region { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DayOfWeek.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DayOfWeek.Serialization.cs new file mode 100644 index 0000000000000..20c9fc6e53eeb --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DayOfWeek.Serialization.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.AppService.Models +{ + internal static partial class DayOfWeekExtensions + { + public static string ToSerialString(this DayOfWeek value) => value switch + { + DayOfWeek.Sunday => "Sunday", + DayOfWeek.Monday => "Monday", + DayOfWeek.Tuesday => "Tuesday", + DayOfWeek.Wednesday => "Wednesday", + DayOfWeek.Thursday => "Thursday", + DayOfWeek.Friday => "Friday", + DayOfWeek.Saturday => "Saturday", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DayOfWeek value.") + }; + + public static DayOfWeek ToDayOfWeek(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Sunday")) return DayOfWeek.Sunday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Monday")) return DayOfWeek.Monday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Tuesday")) return DayOfWeek.Tuesday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Wednesday")) return DayOfWeek.Wednesday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Thursday")) return DayOfWeek.Thursday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Friday")) return DayOfWeek.Friday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Saturday")) return DayOfWeek.Saturday; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DayOfWeek value."); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DayOfWeek.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DayOfWeek.cs new file mode 100644 index 0000000000000..a953a1ec87e73 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DayOfWeek.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.AppService.Models +{ + /// The day of the week. + public enum DayOfWeek + { + /// Sunday. + Sunday, + /// Monday. + Monday, + /// Tuesday. + Tuesday, + /// Wednesday. + Wednesday, + /// Thursday. + Thursday, + /// Friday. + Friday, + /// Saturday. + Saturday + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaysOfWeek.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaysOfWeek.Serialization.cs new file mode 100644 index 0000000000000..67984f08e1ac2 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaysOfWeek.Serialization.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.AppService.Models +{ + internal static partial class DaysOfWeekExtensions + { + public static string ToSerialString(this DaysOfWeek value) => value switch + { + DaysOfWeek.Sunday => "Sunday", + DaysOfWeek.Monday => "Monday", + DaysOfWeek.Tuesday => "Tuesday", + DaysOfWeek.Wednesday => "Wednesday", + DaysOfWeek.Thursday => "Thursday", + DaysOfWeek.Friday => "Friday", + DaysOfWeek.Saturday => "Saturday", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DaysOfWeek value.") + }; + + public static DaysOfWeek ToDaysOfWeek(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Sunday")) return DaysOfWeek.Sunday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Monday")) return DaysOfWeek.Monday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Tuesday")) return DaysOfWeek.Tuesday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Wednesday")) return DaysOfWeek.Wednesday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Thursday")) return DaysOfWeek.Thursday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Friday")) return DaysOfWeek.Friday; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Saturday")) return DaysOfWeek.Saturday; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown DaysOfWeek value."); + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaysOfWeek.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaysOfWeek.cs new file mode 100644 index 0000000000000..b815710b75b79 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DaysOfWeek.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.AppService.Models +{ + /// The DaysOfWeek. + public enum DaysOfWeek + { + /// Sunday. + Sunday, + /// Monday. + Monday, + /// Tuesday. + Tuesday, + /// Wednesday. + Wednesday, + /// Thursday. + Thursday, + /// Friday. + Friday, + /// Saturday. + Saturday + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DefaultAction.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DefaultAction.cs new file mode 100644 index 0000000000000..0aa0703ccb60d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DefaultAction.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Default action for main access restriction if no rules are matched. + public readonly partial struct DefaultAction : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DefaultAction(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AllowValue = "Allow"; + private const string DenyValue = "Deny"; + + /// Allow. + public static DefaultAction Allow { get; } = new DefaultAction(AllowValue); + /// Deny. + public static DefaultAction Deny { get; } = new DefaultAction(DenyValue); + /// Determines if two values are the same. + public static bool operator ==(DefaultAction left, DefaultAction right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DefaultAction left, DefaultAction right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DefaultAction(string value) => new DefaultAction(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DefaultAction other && Equals(other); + /// + public bool Equals(DefaultAction other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DeploymentBuildStatus.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DeploymentBuildStatus.cs new file mode 100644 index 0000000000000..5d2735293ba21 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/DeploymentBuildStatus.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Deployment build status. + public readonly partial struct DeploymentBuildStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeploymentBuildStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TimedOutValue = "TimedOut"; + private const string RuntimeFailedValue = "RuntimeFailed"; + private const string BuildAbortedValue = "BuildAborted"; + private const string BuildFailedValue = "BuildFailed"; + private const string BuildRequestReceivedValue = "BuildRequestReceived"; + private const string BuildPendingValue = "BuildPending"; + private const string BuildInProgressValue = "BuildInProgress"; + private const string BuildSuccessfulValue = "BuildSuccessful"; + private const string PostBuildRestartRequiredValue = "PostBuildRestartRequired"; + private const string StartPollingValue = "StartPolling"; + private const string StartPollingWithRestartValue = "StartPollingWithRestart"; + private const string RuntimeStartingValue = "RuntimeStarting"; + private const string RuntimeSuccessfulValue = "RuntimeSuccessful"; + + /// TimedOut. + public static DeploymentBuildStatus TimedOut { get; } = new DeploymentBuildStatus(TimedOutValue); + /// RuntimeFailed. + public static DeploymentBuildStatus RuntimeFailed { get; } = new DeploymentBuildStatus(RuntimeFailedValue); + /// BuildAborted. + public static DeploymentBuildStatus BuildAborted { get; } = new DeploymentBuildStatus(BuildAbortedValue); + /// BuildFailed. + public static DeploymentBuildStatus BuildFailed { get; } = new DeploymentBuildStatus(BuildFailedValue); + /// BuildRequestReceived. + public static DeploymentBuildStatus BuildRequestReceived { get; } = new DeploymentBuildStatus(BuildRequestReceivedValue); + /// BuildPending. + public static DeploymentBuildStatus BuildPending { get; } = new DeploymentBuildStatus(BuildPendingValue); + /// BuildInProgress. + public static DeploymentBuildStatus BuildInProgress { get; } = new DeploymentBuildStatus(BuildInProgressValue); + /// BuildSuccessful. + public static DeploymentBuildStatus BuildSuccessful { get; } = new DeploymentBuildStatus(BuildSuccessfulValue); + /// PostBuildRestartRequired. + public static DeploymentBuildStatus PostBuildRestartRequired { get; } = new DeploymentBuildStatus(PostBuildRestartRequiredValue); + /// StartPolling. + public static DeploymentBuildStatus StartPolling { get; } = new DeploymentBuildStatus(StartPollingValue); + /// StartPollingWithRestart. + public static DeploymentBuildStatus StartPollingWithRestart { get; } = new DeploymentBuildStatus(StartPollingWithRestartValue); + /// RuntimeStarting. + public static DeploymentBuildStatus RuntimeStarting { get; } = new DeploymentBuildStatus(RuntimeStartingValue); + /// RuntimeSuccessful. + public static DeploymentBuildStatus RuntimeSuccessful { get; } = new DeploymentBuildStatus(RuntimeSuccessfulValue); + /// Determines if two values are the same. + public static bool operator ==(DeploymentBuildStatus left, DeploymentBuildStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeploymentBuildStatus left, DeploymentBuildStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DeploymentBuildStatus(string value) => new DeploymentBuildStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeploymentBuildStatus other && Equals(other); + /// + public bool Equals(DeploymentBuildStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnterpriseGradeCdnStatus.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnterpriseGradeCdnStatus.cs new file mode 100644 index 0000000000000..34475b2d12901 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnterpriseGradeCdnStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// State indicating the status of the enterprise grade CDN serving traffic to the static web app. + public readonly partial struct EnterpriseGradeCdnStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EnterpriseGradeCdnStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string EnablingValue = "Enabling"; + private const string DisabledValue = "Disabled"; + private const string DisablingValue = "Disabling"; + + /// Enabled. + public static EnterpriseGradeCdnStatus Enabled { get; } = new EnterpriseGradeCdnStatus(EnabledValue); + /// Enabling. + public static EnterpriseGradeCdnStatus Enabling { get; } = new EnterpriseGradeCdnStatus(EnablingValue); + /// Disabled. + public static EnterpriseGradeCdnStatus Disabled { get; } = new EnterpriseGradeCdnStatus(DisabledValue); + /// Disabling. + public static EnterpriseGradeCdnStatus Disabling { get; } = new EnterpriseGradeCdnStatus(DisablingValue); + /// Determines if two values are the same. + public static bool operator ==(EnterpriseGradeCdnStatus left, EnterpriseGradeCdnStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EnterpriseGradeCdnStatus left, EnterpriseGradeCdnStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EnterpriseGradeCdnStatus(string value) => new EnterpriseGradeCdnStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EnterpriseGradeCdnStatus other && Equals(other); + /// + public bool Equals(EnterpriseGradeCdnStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVar.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVar.Serialization.cs new file mode 100644 index 0000000000000..0a608b56b0e30 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVar.Serialization.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class EnvironmentVar : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EnvironmentVar)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(SecretRef)) + { + writer.WritePropertyName("secretRef"u8); + writer.WriteStringValue(SecretRef); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EnvironmentVar IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EnvironmentVar)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEnvironmentVar(document.RootElement, options); + } + + internal static EnvironmentVar DeserializeEnvironmentVar(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string value = default; + string secretRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("secretRef"u8)) + { + secretRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EnvironmentVar(name, value, secretRef, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecretRef), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" secretRef: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecretRef)) + { + builder.Append(" secretRef: "); + if (SecretRef.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SecretRef}'''"); + } + else + { + builder.AppendLine($"'{SecretRef}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(EnvironmentVar)} does not support writing '{options.Format}' format."); + } + } + + EnvironmentVar IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEnvironmentVar(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EnvironmentVar)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVar.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVar.cs new file mode 100644 index 0000000000000..0b2eb67642ba2 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVar.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App container environment variable. + public partial class EnvironmentVar + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public EnvironmentVar() + { + } + + /// Initializes a new instance of . + /// Environment variable name. + /// Non-secret environment variable value. + /// Name of the Container App secret from which to pull the environment variable value. + /// Keeps track of any properties unknown to the library. + internal EnvironmentVar(string name, string value, string secretRef, IDictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + SecretRef = secretRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Environment variable name. + [WirePath("name")] + public string Name { get; set; } + /// Non-secret environment variable value. + [WirePath("value")] + public string Value { get; set; } + /// Name of the Container App secret from which to pull the environment variable value. + [WirePath("secretRef")] + public string SecretRef { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVariable.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVariable.Serialization.cs new file mode 100644 index 0000000000000..ec3aafb7327ef --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVariable.Serialization.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class EnvironmentVariable : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EnvironmentVariable)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EnvironmentVariable IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EnvironmentVariable)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEnvironmentVariable(document.RootElement, options); + } + + internal static EnvironmentVariable DeserializeEnvironmentVariable(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EnvironmentVariable(name, value, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(EnvironmentVariable)} does not support writing '{options.Format}' format."); + } + } + + EnvironmentVariable IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEnvironmentVariable(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EnvironmentVariable)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVariable.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVariable.cs new file mode 100644 index 0000000000000..855056df4dbca --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/EnvironmentVariable.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The EnvironmentVariable. + public partial class EnvironmentVariable + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Environment variable name. + /// Environment variable value. + /// or is null. + public EnvironmentVariable(string name, string value) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(value, nameof(value)); + + Name = name; + Value = value; + } + + /// Initializes a new instance of . + /// Environment variable name. + /// Environment variable value. + /// Keeps track of any properties unknown to the library. + internal EnvironmentVariable(string name, string value, IDictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal EnvironmentVariable() + { + } + + /// Environment variable name. + [WirePath("name")] + public string Name { get; set; } + /// Environment variable value. + [WirePath("value")] + public string Value { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorEntity.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorEntity.Serialization.cs new file mode 100644 index 0000000000000..9f96505f2618f --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorEntity.Serialization.cs @@ -0,0 +1,466 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ErrorEntity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorEntity)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ExtendedCode)) + { + writer.WritePropertyName("extendedCode"u8); + writer.WriteStringValue(ExtendedCode); + } + if (Optional.IsDefined(MessageTemplate)) + { + writer.WritePropertyName("messageTemplate"u8); + writer.WriteStringValue(MessageTemplate); + } + if (Optional.IsCollectionDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteStartArray(); + foreach (var item in Parameters) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(InnerErrors)) + { + writer.WritePropertyName("innerErrors"u8); + writer.WriteStartArray(); + foreach (var item in InnerErrors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Details)) + { + writer.WritePropertyName("details"u8); + writer.WriteStartArray(); + foreach (var item in Details) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteStringValue(Target); + } + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ErrorEntity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorEntity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorEntity(document.RootElement, options); + } + + internal static ErrorEntity DeserializeErrorEntity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string extendedCode = default; + string messageTemplate = default; + IList parameters = default; + IList innerErrors = default; + IList details = default; + string target = default; + string code = default; + string message = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("extendedCode"u8)) + { + extendedCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("messageTemplate"u8)) + { + messageTemplate = property.Value.GetString(); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + parameters = array; + continue; + } + if (property.NameEquals("innerErrors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeErrorEntity(item, options)); + } + innerErrors = array; + continue; + } + if (property.NameEquals("details"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeErrorEntity(item, options)); + } + details = array; + continue; + } + if (property.NameEquals("target"u8)) + { + target = property.Value.GetString(); + continue; + } + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorEntity( + extendedCode, + messageTemplate, + parameters ?? new ChangeTrackingList(), + innerErrors ?? new ChangeTrackingList(), + details ?? new ChangeTrackingList(), + target, + code, + message, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ExtendedCode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" extendedCode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ExtendedCode)) + { + builder.Append(" extendedCode: "); + if (ExtendedCode.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ExtendedCode}'''"); + } + else + { + builder.AppendLine($"'{ExtendedCode}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MessageTemplate), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" messageTemplate: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MessageTemplate)) + { + builder.Append(" messageTemplate: "); + if (MessageTemplate.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{MessageTemplate}'''"); + } + else + { + builder.AppendLine($"'{MessageTemplate}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Parameters), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" parameters: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Parameters)) + { + if (Parameters.Any()) + { + builder.Append(" parameters: "); + builder.AppendLine("["); + foreach (var item in Parameters) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InnerErrors), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" innerErrors: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(InnerErrors)) + { + if (InnerErrors.Any()) + { + builder.Append(" innerErrors: "); + builder.AppendLine("["); + foreach (var item in InnerErrors) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " innerErrors: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Details), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" details: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Details)) + { + if (Details.Any()) + { + builder.Append(" details: "); + builder.AppendLine("["); + foreach (var item in Details) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " details: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Target), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" target: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Target)) + { + builder.Append(" target: "); + if (Target.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Target}'''"); + } + else + { + builder.AppendLine($"'{Target}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Code), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" code: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Code)) + { + builder.Append(" code: "); + if (Code.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Code}'''"); + } + else + { + builder.AppendLine($"'{Code}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" message: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Message)) + { + builder.Append(" message: "); + if (Message.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Message}'''"); + } + else + { + builder.AppendLine($"'{Message}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ErrorEntity)} does not support writing '{options.Format}' format."); + } + } + + ErrorEntity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeErrorEntity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorEntity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorEntity.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorEntity.cs new file mode 100644 index 0000000000000..da866ab660e97 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorEntity.cs @@ -0,0 +1,104 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Body of the error response returned from the API. + public partial class ErrorEntity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ErrorEntity() + { + Parameters = new ChangeTrackingList(); + InnerErrors = new ChangeTrackingList(); + Details = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Type of error. + /// Message template. + /// Parameters for the template. + /// Inner errors. + /// Error Details. + /// The error target. + /// Basic error code. + /// Any details of the error. + /// Keeps track of any properties unknown to the library. + internal ErrorEntity(string extendedCode, string messageTemplate, IList parameters, IList innerErrors, IList details, string target, string code, string message, IDictionary serializedAdditionalRawData) + { + ExtendedCode = extendedCode; + MessageTemplate = messageTemplate; + Parameters = parameters; + InnerErrors = innerErrors; + Details = details; + Target = target; + Code = code; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Type of error. + [WirePath("extendedCode")] + public string ExtendedCode { get; set; } + /// Message template. + [WirePath("messageTemplate")] + public string MessageTemplate { get; set; } + /// Parameters for the template. + [WirePath("parameters")] + public IList Parameters { get; } + /// Inner errors. + [WirePath("innerErrors")] + public IList InnerErrors { get; } + /// Error Details. + [WirePath("details")] + public IList Details { get; } + /// The error target. + [WirePath("target")] + public string Target { get; set; } + /// Basic error code. + [WirePath("code")] + public string Code { get; set; } + /// Any details of the error. + [WirePath("message")] + public string Message { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorInfo.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorInfo.Serialization.cs new file mode 100644 index 0000000000000..1269c6e4f77c9 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorInfo.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ErrorInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorInfo)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ErrorInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorInfo(document.RootElement, options); + } + + internal static ErrorInfo DeserializeErrorInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string code = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorInfo(code, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Code), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" code: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Code)) + { + builder.Append(" code: "); + if (Code.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Code}'''"); + } + else + { + builder.AppendLine($"'{Code}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ErrorInfo)} does not support writing '{options.Format}' format."); + } + } + + ErrorInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeErrorInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorInfo.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorInfo.cs new file mode 100644 index 0000000000000..5baf386fc7118 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorInfo.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The error info. + public partial class ErrorInfo + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The error code. + /// is null. + internal ErrorInfo(string code) + { + Argument.AssertNotNull(code, nameof(code)); + + Code = code; + } + + /// Initializes a new instance of . + /// The error code. + /// Keeps track of any properties unknown to the library. + internal ErrorInfo(string code, IDictionary serializedAdditionalRawData) + { + Code = code; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ErrorInfo() + { + } + + /// The error code. + [WirePath("code")] + public string Code { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorProperties.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorProperties.Serialization.cs new file mode 100644 index 0000000000000..81fadd3e64cae --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorProperties.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ErrorProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ErrorProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorProperties(document.RootElement, options); + } + + internal static ErrorProperties DeserializeErrorProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string code = default; + string message = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorProperties(code, message, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Code), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" code: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Code)) + { + builder.Append(" code: "); + if (Code.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Code}'''"); + } + else + { + builder.AppendLine($"'{Code}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Message), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" message: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Message)) + { + builder.Append(" message: "); + if (Message.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Message}'''"); + } + else + { + builder.AppendLine($"'{Message}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ErrorProperties)} does not support writing '{options.Format}' format."); + } + } + + ErrorProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeErrorProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorProperties.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorProperties.cs new file mode 100644 index 0000000000000..321808397c95e --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorProperties.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Error properties indicate why the Logic service was not able to process the incoming request. The reason is provided in the error message. + public partial class ErrorProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ErrorProperties() + { + } + + /// Initializes a new instance of . + /// Error code. + /// Error message indicating why the operation failed. + /// Keeps track of any properties unknown to the library. + internal ErrorProperties(string code, string message, IDictionary serializedAdditionalRawData) + { + Code = code; + Message = message; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Error code. + [WirePath("code")] + public string Code { get; set; } + /// Error message indicating why the operation failed. + [WirePath("message")] + public string Message { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorResponse.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorResponse.Serialization.cs new file mode 100644 index 0000000000000..8d3eab4dfda68 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorResponse.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class ErrorResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorResponse)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ErrorResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorResponse(document.RootElement, options); + } + + internal static ErrorResponse DeserializeErrorResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ErrorProperties error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorProperties.DeserializeErrorProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorResponse(error, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ErrorResponse)} does not support writing '{options.Format}' format."); + } + } + + ErrorResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeErrorResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorResponse.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorResponse.cs new file mode 100644 index 0000000000000..c3833883a4b6c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ErrorResponse.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Error response indicates Logic service is not able to process the incoming request. The error property contains the error details. + internal partial class ErrorResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ErrorResponse() + { + } + + /// Initializes a new instance of . + /// The error properties. + /// Keeps track of any properties unknown to the library. + internal ErrorResponse(ErrorProperties error, IDictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The error properties. + [WirePath("error")] + public ErrorProperties Error { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Expression.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Expression.Serialization.cs new file mode 100644 index 0000000000000..d7bc441ee5865 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Expression.Serialization.cs @@ -0,0 +1,279 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class Expression : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Expression)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Text)) + { + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Value); +#else + using (JsonDocument document = JsonDocument.Parse(Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsCollectionDefined(Subexpressions)) + { + writer.WritePropertyName("subexpressions"u8); + writer.WriteStartArray(); + foreach (var item in Subexpressions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Expression IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Expression)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExpression(document.RootElement, options); + } + + internal static Expression DeserializeExpression(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string text = default; + BinaryData value = default; + IReadOnlyList subexpressions = default; + AzureResourceErrorInfo error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("subexpressions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeExpression(item, options)); + } + subexpressions = array; + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = AzureResourceErrorInfo.DeserializeAzureResourceErrorInfo(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Expression(text, value, subexpressions ?? new ChangeTrackingList(), error, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Text), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" text: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Text)) + { + builder.Append(" text: "); + if (Text.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Text}'''"); + } + else + { + builder.AppendLine($"'{Text}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + builder.AppendLine($"'{Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Subexpressions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" subexpressions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Subexpressions)) + { + if (Subexpressions.Any()) + { + builder.Append(" subexpressions: "); + builder.AppendLine("["); + foreach (var item in Subexpressions) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " subexpressions: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Expression)} does not support writing '{options.Format}' format."); + } + } + + Expression IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExpression(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Expression)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Expression.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Expression.cs new file mode 100644 index 0000000000000..56e3ec91f6da3 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Expression.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The expression. + public partial class Expression + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal Expression() + { + Subexpressions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The text. + /// Anything. + /// The sub expressions. + /// The azure resource error info. + /// Keeps track of any properties unknown to the library. + internal Expression(string text, BinaryData value, IReadOnlyList subexpressions, AzureResourceErrorInfo error, IDictionary serializedAdditionalRawData) + { + Text = text; + Value = value; + Subexpressions = subexpressions; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The text. + [WirePath("text")] + public string Text { get; } + /// + /// Anything + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("value")] + public BinaryData Value { get; } + /// The sub expressions. + [WirePath("subexpressions")] + public IReadOnlyList Subexpressions { get; } + /// The azure resource error info. + [WirePath("error")] + public AzureResourceErrorInfo Error { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionRoot.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionRoot.Serialization.cs new file mode 100644 index 0000000000000..6914720ce131d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionRoot.Serialization.cs @@ -0,0 +1,319 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ExpressionRoot : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExpressionRoot)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Path)) + { + writer.WritePropertyName("path"u8); + writer.WriteStringValue(Path); + } + if (Optional.IsDefined(Text)) + { + writer.WritePropertyName("text"u8); + writer.WriteStringValue(Text); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Value); +#else + using (JsonDocument document = JsonDocument.Parse(Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsCollectionDefined(Subexpressions)) + { + writer.WritePropertyName("subexpressions"u8); + writer.WriteStartArray(); + foreach (var item in Subexpressions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ExpressionRoot IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExpressionRoot)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExpressionRoot(document.RootElement, options); + } + + internal static ExpressionRoot DeserializeExpressionRoot(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string path = default; + string text = default; + BinaryData value = default; + IReadOnlyList subexpressions = default; + AzureResourceErrorInfo error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("path"u8)) + { + path = property.Value.GetString(); + continue; + } + if (property.NameEquals("text"u8)) + { + text = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("subexpressions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeExpression(item, options)); + } + subexpressions = array; + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = AzureResourceErrorInfo.DeserializeAzureResourceErrorInfo(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExpressionRoot( + text, + value, + subexpressions ?? new ChangeTrackingList(), + error, + serializedAdditionalRawData, + path); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Path), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" path: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Path)) + { + builder.Append(" path: "); + if (Path.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Path}'''"); + } + else + { + builder.AppendLine($"'{Path}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Text), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" text: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Text)) + { + builder.Append(" text: "); + if (Text.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Text}'''"); + } + else + { + builder.AppendLine($"'{Text}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + builder.AppendLine($"'{Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Subexpressions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" subexpressions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Subexpressions)) + { + if (Subexpressions.Any()) + { + builder.Append(" subexpressions: "); + builder.AppendLine("["); + foreach (var item in Subexpressions) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " subexpressions: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Error), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ExpressionRoot)} does not support writing '{options.Format}' format."); + } + } + + ExpressionRoot IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExpressionRoot(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExpressionRoot)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionRoot.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionRoot.cs new file mode 100644 index 0000000000000..08b5a62912ee0 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionRoot.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The expression root. + public partial class ExpressionRoot : Expression + { + /// Initializes a new instance of . + internal ExpressionRoot() + { + } + + /// Initializes a new instance of . + /// The text. + /// Anything. + /// The sub expressions. + /// The azure resource error info. + /// Keeps track of any properties unknown to the library. + /// The path. + internal ExpressionRoot(string text, BinaryData value, IReadOnlyList subexpressions, AzureResourceErrorInfo error, IDictionary serializedAdditionalRawData, string path) : base(text, value, subexpressions, error, serializedAdditionalRawData) + { + Path = path; + } + + /// The path. + [WirePath("path")] + public string Path { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionTraces.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionTraces.Serialization.cs new file mode 100644 index 0000000000000..a9fe8087b14db --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionTraces.Serialization.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class ExpressionTraces : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExpressionTraces)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Value); +#else + using (JsonDocument document = JsonDocument.Parse(Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsCollectionDefined(Inputs)) + { + writer.WritePropertyName("inputs"u8); + writer.WriteStartArray(); + foreach (var item in Inputs) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ExpressionTraces IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExpressionTraces)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExpressionTraces(document.RootElement, options); + } + + internal static ExpressionTraces DeserializeExpressionTraces(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BinaryData value = default; + IReadOnlyList inputs = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("inputs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ExpressionRoot.DeserializeExpressionRoot(item, options)); + } + inputs = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExpressionTraces(value, inputs ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + builder.AppendLine($"'{Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Inputs), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" inputs: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Inputs)) + { + if (Inputs.Any()) + { + builder.Append(" inputs: "); + builder.AppendLine("["); + foreach (var item in Inputs) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " inputs: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ExpressionTraces)} does not support writing '{options.Format}' format."); + } + } + + ExpressionTraces IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExpressionTraces(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExpressionTraces)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionTraces.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionTraces.cs new file mode 100644 index 0000000000000..02354dbbb85e7 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ExpressionTraces.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The expression traces. + internal partial class ExpressionTraces + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ExpressionTraces() + { + Inputs = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Anything. + /// + /// The link used to get the next page of recommendations. + /// Keeps track of any properties unknown to the library. + internal ExpressionTraces(BinaryData value, IReadOnlyList inputs, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + Inputs = inputs; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// Anything + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + public BinaryData Value { get; } + /// Gets the inputs. + public IReadOnlyList Inputs { get; } + /// The link used to get the next page of recommendations. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfiguration.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfiguration.Serialization.cs new file mode 100644 index 0000000000000..0d24cef279d3a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfiguration.Serialization.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class FlowAccessControlConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FlowAccessControlConfiguration)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Triggers)) + { + writer.WritePropertyName("triggers"u8); + writer.WriteObjectValue(Triggers, options); + } + if (Optional.IsDefined(Contents)) + { + writer.WritePropertyName("contents"u8); + writer.WriteObjectValue(Contents, options); + } + if (Optional.IsDefined(Actions)) + { + writer.WritePropertyName("actions"u8); + writer.WriteObjectValue(Actions, options); + } + if (Optional.IsDefined(WorkflowManagement)) + { + writer.WritePropertyName("workflowManagement"u8); + writer.WriteObjectValue(WorkflowManagement, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FlowAccessControlConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FlowAccessControlConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFlowAccessControlConfiguration(document.RootElement, options); + } + + internal static FlowAccessControlConfiguration DeserializeFlowAccessControlConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FlowAccessControlConfigurationPolicy triggers = default; + FlowAccessControlConfigurationPolicy contents = default; + FlowAccessControlConfigurationPolicy actions = default; + FlowAccessControlConfigurationPolicy workflowManagement = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("triggers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + triggers = FlowAccessControlConfigurationPolicy.DeserializeFlowAccessControlConfigurationPolicy(property.Value, options); + continue; + } + if (property.NameEquals("contents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + contents = FlowAccessControlConfigurationPolicy.DeserializeFlowAccessControlConfigurationPolicy(property.Value, options); + continue; + } + if (property.NameEquals("actions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + actions = FlowAccessControlConfigurationPolicy.DeserializeFlowAccessControlConfigurationPolicy(property.Value, options); + continue; + } + if (property.NameEquals("workflowManagement"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + workflowManagement = FlowAccessControlConfigurationPolicy.DeserializeFlowAccessControlConfigurationPolicy(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FlowAccessControlConfiguration(triggers, contents, actions, workflowManagement, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Triggers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" triggers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Triggers)) + { + builder.Append(" triggers: "); + BicepSerializationHelpers.AppendChildObject(builder, Triggers, options, 2, false, " triggers: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Contents), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contents: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Contents)) + { + builder.Append(" contents: "); + BicepSerializationHelpers.AppendChildObject(builder, Contents, options, 2, false, " contents: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Actions), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" actions: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Actions)) + { + builder.Append(" actions: "); + BicepSerializationHelpers.AppendChildObject(builder, Actions, options, 2, false, " actions: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WorkflowManagement), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" workflowManagement: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(WorkflowManagement)) + { + builder.Append(" workflowManagement: "); + BicepSerializationHelpers.AppendChildObject(builder, WorkflowManagement, options, 2, false, " workflowManagement: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FlowAccessControlConfiguration)} does not support writing '{options.Format}' format."); + } + } + + FlowAccessControlConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFlowAccessControlConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FlowAccessControlConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfiguration.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfiguration.cs new file mode 100644 index 0000000000000..183eb5e7c1556 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfiguration.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The access control configuration. + public partial class FlowAccessControlConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FlowAccessControlConfiguration() + { + } + + /// Initializes a new instance of . + /// The access control configuration for invoking workflow triggers. + /// The access control configuration for accessing workflow run contents. + /// The access control configuration for workflow actions. + /// The access control configuration for workflow management. + /// Keeps track of any properties unknown to the library. + internal FlowAccessControlConfiguration(FlowAccessControlConfigurationPolicy triggers, FlowAccessControlConfigurationPolicy contents, FlowAccessControlConfigurationPolicy actions, FlowAccessControlConfigurationPolicy workflowManagement, IDictionary serializedAdditionalRawData) + { + Triggers = triggers; + Contents = contents; + Actions = actions; + WorkflowManagement = workflowManagement; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The access control configuration for invoking workflow triggers. + [WirePath("triggers")] + public FlowAccessControlConfigurationPolicy Triggers { get; set; } + /// The access control configuration for accessing workflow run contents. + [WirePath("contents")] + public FlowAccessControlConfigurationPolicy Contents { get; set; } + /// The access control configuration for workflow actions. + [WirePath("actions")] + public FlowAccessControlConfigurationPolicy Actions { get; set; } + /// The access control configuration for workflow management. + [WirePath("workflowManagement")] + public FlowAccessControlConfigurationPolicy WorkflowManagement { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfigurationPolicy.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfigurationPolicy.Serialization.cs new file mode 100644 index 0000000000000..63dadaf314b3d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfigurationPolicy.Serialization.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class FlowAccessControlConfigurationPolicy : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FlowAccessControlConfigurationPolicy)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AllowedCallerIPAddresses)) + { + writer.WritePropertyName("allowedCallerIpAddresses"u8); + writer.WriteStartArray(); + foreach (var item in AllowedCallerIPAddresses) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(OpenAuthenticationPolicies)) + { + writer.WritePropertyName("openAuthenticationPolicies"u8); + writer.WriteObjectValue(OpenAuthenticationPolicies, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FlowAccessControlConfigurationPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FlowAccessControlConfigurationPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFlowAccessControlConfigurationPolicy(document.RootElement, options); + } + + internal static FlowAccessControlConfigurationPolicy DeserializeFlowAccessControlConfigurationPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList allowedCallerIPAddresses = default; + OpenAuthenticationAccessPolicies openAuthenticationPolicies = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("allowedCallerIpAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IPAddressRange.DeserializeIPAddressRange(item, options)); + } + allowedCallerIPAddresses = array; + continue; + } + if (property.NameEquals("openAuthenticationPolicies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + openAuthenticationPolicies = OpenAuthenticationAccessPolicies.DeserializeOpenAuthenticationAccessPolicies(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FlowAccessControlConfigurationPolicy(allowedCallerIPAddresses ?? new ChangeTrackingList(), openAuthenticationPolicies, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowedCallerIPAddresses), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" allowedCallerIpAddresses: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AllowedCallerIPAddresses)) + { + if (AllowedCallerIPAddresses.Any()) + { + builder.Append(" allowedCallerIpAddresses: "); + builder.AppendLine("["); + foreach (var item in AllowedCallerIPAddresses) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " allowedCallerIpAddresses: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("OpenAuthenticationPolicies", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" openAuthenticationPolicies: "); + builder.AppendLine("{"); + builder.Append(" policies: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(OpenAuthenticationPolicies)) + { + builder.Append(" openAuthenticationPolicies: "); + BicepSerializationHelpers.AppendChildObject(builder, OpenAuthenticationPolicies, options, 2, false, " openAuthenticationPolicies: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FlowAccessControlConfigurationPolicy)} does not support writing '{options.Format}' format."); + } + } + + FlowAccessControlConfigurationPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFlowAccessControlConfigurationPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FlowAccessControlConfigurationPolicy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfigurationPolicy.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfigurationPolicy.cs new file mode 100644 index 0000000000000..2e5e0f8c983a4 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowAccessControlConfigurationPolicy.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The access control configuration policy. + public partial class FlowAccessControlConfigurationPolicy + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FlowAccessControlConfigurationPolicy() + { + AllowedCallerIPAddresses = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The allowed caller IP address ranges. + /// The authentication policies for workflow. + /// Keeps track of any properties unknown to the library. + internal FlowAccessControlConfigurationPolicy(IList allowedCallerIPAddresses, OpenAuthenticationAccessPolicies openAuthenticationPolicies, IDictionary serializedAdditionalRawData) + { + AllowedCallerIPAddresses = allowedCallerIPAddresses; + OpenAuthenticationPolicies = openAuthenticationPolicies; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The allowed caller IP address ranges. + [WirePath("allowedCallerIpAddresses")] + public IList AllowedCallerIPAddresses { get; } + /// The authentication policies for workflow. + internal OpenAuthenticationAccessPolicies OpenAuthenticationPolicies { get; set; } + /// Open authentication policies. + [WirePath("openAuthenticationPolicies.policies")] + public IDictionary OpenAuthenticationPolicies + { + get + { + if (OpenAuthenticationPolicies is null) + OpenAuthenticationPolicies = new OpenAuthenticationAccessPolicies(); + return OpenAuthenticationPolicies.Policies; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpoints.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpoints.Serialization.cs new file mode 100644 index 0000000000000..3b327e63c2045 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpoints.Serialization.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class FlowEndpoints : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FlowEndpoints)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(OutgoingIPAddresses)) + { + writer.WritePropertyName("outgoingIpAddresses"u8); + writer.WriteStartArray(); + foreach (var item in OutgoingIPAddresses) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AccessEndpointIPAddresses)) + { + writer.WritePropertyName("accessEndpointIpAddresses"u8); + writer.WriteStartArray(); + foreach (var item in AccessEndpointIPAddresses) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FlowEndpoints IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FlowEndpoints)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFlowEndpoints(document.RootElement, options); + } + + internal static FlowEndpoints DeserializeFlowEndpoints(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList outgoingIPAddresses = default; + IList accessEndpointIPAddresses = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("outgoingIpAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IPAddress.DeserializeIPAddress(item, options)); + } + outgoingIPAddresses = array; + continue; + } + if (property.NameEquals("accessEndpointIpAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IPAddress.DeserializeIPAddress(item, options)); + } + accessEndpointIPAddresses = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FlowEndpoints(outgoingIPAddresses ?? new ChangeTrackingList(), accessEndpointIPAddresses ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OutgoingIPAddresses), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" outgoingIpAddresses: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(OutgoingIPAddresses)) + { + if (OutgoingIPAddresses.Any()) + { + builder.Append(" outgoingIpAddresses: "); + builder.AppendLine("["); + foreach (var item in OutgoingIPAddresses) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " outgoingIpAddresses: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AccessEndpointIPAddresses), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" accessEndpointIpAddresses: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AccessEndpointIPAddresses)) + { + if (AccessEndpointIPAddresses.Any()) + { + builder.Append(" accessEndpointIpAddresses: "); + builder.AppendLine("["); + foreach (var item in AccessEndpointIPAddresses) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " accessEndpointIpAddresses: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FlowEndpoints)} does not support writing '{options.Format}' format."); + } + } + + FlowEndpoints IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFlowEndpoints(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FlowEndpoints)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpoints.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpoints.cs new file mode 100644 index 0000000000000..d157eb6181d38 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpoints.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The flow endpoints configuration. + public partial class FlowEndpoints + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FlowEndpoints() + { + OutgoingIPAddresses = new ChangeTrackingList(); + AccessEndpointIPAddresses = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The outgoing ip address. + /// The access endpoint ip address. + /// Keeps track of any properties unknown to the library. + internal FlowEndpoints(IList outgoingIPAddresses, IList accessEndpointIPAddresses, IDictionary serializedAdditionalRawData) + { + OutgoingIPAddresses = outgoingIPAddresses; + AccessEndpointIPAddresses = accessEndpointIPAddresses; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The outgoing ip address. + [WirePath("outgoingIpAddresses")] + public IList OutgoingIPAddresses { get; } + /// The access endpoint ip address. + [WirePath("accessEndpointIpAddresses")] + public IList AccessEndpointIPAddresses { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpointsConfiguration.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpointsConfiguration.Serialization.cs new file mode 100644 index 0000000000000..34ed980e3e06d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpointsConfiguration.Serialization.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class FlowEndpointsConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FlowEndpointsConfiguration)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Workflow)) + { + writer.WritePropertyName("workflow"u8); + writer.WriteObjectValue(Workflow, options); + } + if (Optional.IsDefined(Connector)) + { + writer.WritePropertyName("connector"u8); + writer.WriteObjectValue(Connector, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FlowEndpointsConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FlowEndpointsConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFlowEndpointsConfiguration(document.RootElement, options); + } + + internal static FlowEndpointsConfiguration DeserializeFlowEndpointsConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FlowEndpoints workflow = default; + FlowEndpoints connector = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("workflow"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + workflow = FlowEndpoints.DeserializeFlowEndpoints(property.Value, options); + continue; + } + if (property.NameEquals("connector"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connector = FlowEndpoints.DeserializeFlowEndpoints(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FlowEndpointsConfiguration(workflow, connector, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Workflow), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" workflow: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Workflow)) + { + builder.Append(" workflow: "); + BicepSerializationHelpers.AppendChildObject(builder, Workflow, options, 2, false, " workflow: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Connector), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" connector: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Connector)) + { + builder.Append(" connector: "); + BicepSerializationHelpers.AppendChildObject(builder, Connector, options, 2, false, " connector: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FlowEndpointsConfiguration)} does not support writing '{options.Format}' format."); + } + } + + FlowEndpointsConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFlowEndpointsConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FlowEndpointsConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpointsConfiguration.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpointsConfiguration.cs new file mode 100644 index 0000000000000..723b65a645e39 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FlowEndpointsConfiguration.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The endpoints configuration. + public partial class FlowEndpointsConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FlowEndpointsConfiguration() + { + } + + /// Initializes a new instance of . + /// The workflow endpoints. + /// The connector endpoints. + /// Keeps track of any properties unknown to the library. + internal FlowEndpointsConfiguration(FlowEndpoints workflow, FlowEndpoints connector, IDictionary serializedAdditionalRawData) + { + Workflow = workflow; + Connector = connector; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The workflow endpoints. + [WirePath("workflow")] + public FlowEndpoints Workflow { get; set; } + /// The connector endpoints. + [WirePath("connector")] + public FlowEndpoints Connector { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionAppConfig.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionAppConfig.Serialization.cs new file mode 100644 index 0000000000000..4159104eefa4a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionAppConfig.Serialization.cs @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class FunctionAppConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionAppConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Deployment)) + { + writer.WritePropertyName("deployment"u8); + writer.WriteObjectValue(Deployment, options); + } + if (Optional.IsDefined(Runtime)) + { + writer.WritePropertyName("runtime"u8); + writer.WriteObjectValue(Runtime, options); + } + if (Optional.IsDefined(ScaleAndConcurrency)) + { + writer.WritePropertyName("scaleAndConcurrency"u8); + writer.WriteObjectValue(ScaleAndConcurrency, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FunctionAppConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionAppConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionAppConfig(document.RootElement, options); + } + + internal static FunctionAppConfig DeserializeFunctionAppConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FunctionsDeployment deployment = default; + FunctionsRuntime runtime = default; + FunctionsScaleAndConcurrency scaleAndConcurrency = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deployment"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deployment = FunctionsDeployment.DeserializeFunctionsDeployment(property.Value, options); + continue; + } + if (property.NameEquals("runtime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + runtime = FunctionsRuntime.DeserializeFunctionsRuntime(property.Value, options); + continue; + } + if (property.NameEquals("scaleAndConcurrency"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scaleAndConcurrency = FunctionsScaleAndConcurrency.DeserializeFunctionsScaleAndConcurrency(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionAppConfig(deployment, runtime, scaleAndConcurrency, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("DeploymentStorage", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" deployment: "); + builder.AppendLine("{"); + builder.Append(" storage: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Deployment)) + { + builder.Append(" deployment: "); + BicepSerializationHelpers.AppendChildObject(builder, Deployment, options, 2, false, " deployment: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Runtime), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" runtime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Runtime)) + { + builder.Append(" runtime: "); + BicepSerializationHelpers.AppendChildObject(builder, Runtime, options, 2, false, " runtime: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScaleAndConcurrency), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scaleAndConcurrency: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ScaleAndConcurrency)) + { + builder.Append(" scaleAndConcurrency: "); + BicepSerializationHelpers.AppendChildObject(builder, ScaleAndConcurrency, options, 2, false, " scaleAndConcurrency: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FunctionAppConfig)} does not support writing '{options.Format}' format."); + } + } + + FunctionAppConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFunctionAppConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionAppConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionAppConfig.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionAppConfig.cs new file mode 100644 index 0000000000000..367d4013cccaa --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionAppConfig.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Function app configuration. + public partial class FunctionAppConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FunctionAppConfig() + { + } + + /// Initializes a new instance of . + /// Function app deployment configuration. + /// Function app runtime settings. + /// Function app scale and concurrency settings. + /// Keeps track of any properties unknown to the library. + internal FunctionAppConfig(FunctionsDeployment deployment, FunctionsRuntime runtime, FunctionsScaleAndConcurrency scaleAndConcurrency, IDictionary serializedAdditionalRawData) + { + Deployment = deployment; + Runtime = runtime; + ScaleAndConcurrency = scaleAndConcurrency; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Function app deployment configuration. + internal FunctionsDeployment Deployment { get; set; } + /// Storage for deployed package used by the function app. + [WirePath("deployment.storage")] + public FunctionsDeploymentStorage DeploymentStorage + { + get => Deployment is null ? default : Deployment.Storage; + set + { + if (Deployment is null) + Deployment = new FunctionsDeployment(); + Deployment.Storage = value; + } + } + + /// Function app runtime settings. + [WirePath("runtime")] + public FunctionsRuntime Runtime { get; set; } + /// Function app scale and concurrency settings. + [WirePath("scaleAndConcurrency")] + public FunctionsScaleAndConcurrency ScaleAndConcurrency { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsAlwaysReadyConfig.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsAlwaysReadyConfig.Serialization.cs new file mode 100644 index 0000000000000..1a3c79dd40b37 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsAlwaysReadyConfig.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class FunctionsAlwaysReadyConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsAlwaysReadyConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(InstanceCount)) + { + writer.WritePropertyName("instanceCount"u8); + writer.WriteNumberValue(InstanceCount.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FunctionsAlwaysReadyConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsAlwaysReadyConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionsAlwaysReadyConfig(document.RootElement, options); + } + + internal static FunctionsAlwaysReadyConfig DeserializeFunctionsAlwaysReadyConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + float? instanceCount = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("instanceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceCount = property.Value.GetSingle(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionsAlwaysReadyConfig(name, instanceCount, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InstanceCount), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" instanceCount: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(InstanceCount)) + { + builder.Append(" instanceCount: "); + builder.AppendLine($"'{InstanceCount.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FunctionsAlwaysReadyConfig)} does not support writing '{options.Format}' format."); + } + } + + FunctionsAlwaysReadyConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFunctionsAlwaysReadyConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionsAlwaysReadyConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsAlwaysReadyConfig.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsAlwaysReadyConfig.cs new file mode 100644 index 0000000000000..f547aac4eebf5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsAlwaysReadyConfig.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Sets the number of 'Always Ready' instances for a function group or a specific function. + public partial class FunctionsAlwaysReadyConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FunctionsAlwaysReadyConfig() + { + } + + /// Initializes a new instance of . + /// Either a function group or a function name is required. For additional information see https://aka.ms/flexconsumption/alwaysready. + /// Sets the number of 'Always Ready' instances for a given function group or a specific function. For additional information see https://aka.ms/flexconsumption/alwaysready. + /// Keeps track of any properties unknown to the library. + internal FunctionsAlwaysReadyConfig(string name, float? instanceCount, IDictionary serializedAdditionalRawData) + { + Name = name; + InstanceCount = instanceCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Either a function group or a function name is required. For additional information see https://aka.ms/flexconsumption/alwaysready. + [WirePath("name")] + public string Name { get; set; } + /// Sets the number of 'Always Ready' instances for a given function group or a specific function. For additional information see https://aka.ms/flexconsumption/alwaysready. + [WirePath("instanceCount")] + public float? InstanceCount { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeployment.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeployment.Serialization.cs new file mode 100644 index 0000000000000..e64593a49ffc1 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeployment.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class FunctionsDeployment : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsDeployment)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Storage)) + { + writer.WritePropertyName("storage"u8); + writer.WriteObjectValue(Storage, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FunctionsDeployment IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsDeployment)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionsDeployment(document.RootElement, options); + } + + internal static FunctionsDeployment DeserializeFunctionsDeployment(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FunctionsDeploymentStorage storage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("storage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storage = FunctionsDeploymentStorage.DeserializeFunctionsDeploymentStorage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionsDeployment(storage, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Storage), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" storage: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Storage)) + { + builder.Append(" storage: "); + BicepSerializationHelpers.AppendChildObject(builder, Storage, options, 2, false, " storage: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FunctionsDeployment)} does not support writing '{options.Format}' format."); + } + } + + FunctionsDeployment IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFunctionsDeployment(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionsDeployment)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeployment.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeployment.cs new file mode 100644 index 0000000000000..3108d1b5b314a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeployment.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Configuration section for the function app deployment. + internal partial class FunctionsDeployment + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FunctionsDeployment() + { + } + + /// Initializes a new instance of . + /// Storage for deployed package used by the function app. + /// Keeps track of any properties unknown to the library. + internal FunctionsDeployment(FunctionsDeploymentStorage storage, IDictionary serializedAdditionalRawData) + { + Storage = storage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Storage for deployed package used by the function app. + [WirePath("storage")] + public FunctionsDeploymentStorage Storage { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorage.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorage.Serialization.cs new file mode 100644 index 0000000000000..a5d23b855db79 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorage.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class FunctionsDeploymentStorage : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsDeploymentStorage)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(StorageType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(StorageType.Value.ToString()); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value.AbsoluteUri); + } + if (Optional.IsDefined(Authentication)) + { + writer.WritePropertyName("authentication"u8); + writer.WriteObjectValue(Authentication, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FunctionsDeploymentStorage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsDeploymentStorage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionsDeploymentStorage(document.RootElement, options); + } + + internal static FunctionsDeploymentStorage DeserializeFunctionsDeploymentStorage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FunctionsDeploymentStorageType? type = default; + Uri value = default; + FunctionsDeploymentStorageAuthentication authentication = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new FunctionsDeploymentStorageType(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("authentication"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authentication = FunctionsDeploymentStorageAuthentication.DeserializeFunctionsDeploymentStorageAuthentication(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionsDeploymentStorage(type, value, authentication, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StorageType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{StorageType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + builder.AppendLine($"'{Value.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Authentication), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" authentication: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Authentication)) + { + builder.Append(" authentication: "); + BicepSerializationHelpers.AppendChildObject(builder, Authentication, options, 2, false, " authentication: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FunctionsDeploymentStorage)} does not support writing '{options.Format}' format."); + } + } + + FunctionsDeploymentStorage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFunctionsDeploymentStorage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionsDeploymentStorage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorage.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorage.cs new file mode 100644 index 0000000000000..095ac1d706441 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorage.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Storage for deployed package used by the function app. + public partial class FunctionsDeploymentStorage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FunctionsDeploymentStorage() + { + } + + /// Initializes a new instance of . + /// Property to select Azure Storage type. Available options: blobContainer. + /// Property to set the URL for the selected Azure Storage type. Example: For blobContainer, the value could be https://<storageAccountName>.blob.core.windows.net/<containerName>. + /// Authentication method to access the storage account for deployment. + /// Keeps track of any properties unknown to the library. + internal FunctionsDeploymentStorage(FunctionsDeploymentStorageType? storageType, Uri value, FunctionsDeploymentStorageAuthentication authentication, IDictionary serializedAdditionalRawData) + { + StorageType = storageType; + Value = value; + Authentication = authentication; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Property to select Azure Storage type. Available options: blobContainer. + [WirePath("type")] + public FunctionsDeploymentStorageType? StorageType { get; set; } + /// Property to set the URL for the selected Azure Storage type. Example: For blobContainer, the value could be https://<storageAccountName>.blob.core.windows.net/<containerName>. + [WirePath("value")] + public Uri Value { get; set; } + /// Authentication method to access the storage account for deployment. + [WirePath("authentication")] + public FunctionsDeploymentStorageAuthentication Authentication { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorageAuthentication.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorageAuthentication.Serialization.cs new file mode 100644 index 0000000000000..a1febddb6403d --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorageAuthentication.Serialization.cs @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class FunctionsDeploymentStorageAuthentication : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsDeploymentStorageAuthentication)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(AuthenticationType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(AuthenticationType.Value.ToString()); + } + if (Optional.IsDefined(UserAssignedIdentityResourceId)) + { + writer.WritePropertyName("userAssignedIdentityResourceId"u8); + writer.WriteStringValue(UserAssignedIdentityResourceId); + } + if (Optional.IsDefined(StorageAccountConnectionStringName)) + { + writer.WritePropertyName("storageAccountConnectionStringName"u8); + writer.WriteStringValue(StorageAccountConnectionStringName); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FunctionsDeploymentStorageAuthentication IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsDeploymentStorageAuthentication)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionsDeploymentStorageAuthentication(document.RootElement, options); + } + + internal static FunctionsDeploymentStorageAuthentication DeserializeFunctionsDeploymentStorageAuthentication(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AuthenticationType? type = default; + string userAssignedIdentityResourceId = default; + string storageAccountConnectionStringName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new AuthenticationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("userAssignedIdentityResourceId"u8)) + { + userAssignedIdentityResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("storageAccountConnectionStringName"u8)) + { + storageAccountConnectionStringName = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionsDeploymentStorageAuthentication(type, userAssignedIdentityResourceId, storageAccountConnectionStringName, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AuthenticationType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AuthenticationType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{AuthenticationType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(UserAssignedIdentityResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" userAssignedIdentityResourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(UserAssignedIdentityResourceId)) + { + builder.Append(" userAssignedIdentityResourceId: "); + if (UserAssignedIdentityResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{UserAssignedIdentityResourceId}'''"); + } + else + { + builder.AppendLine($"'{UserAssignedIdentityResourceId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StorageAccountConnectionStringName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" storageAccountConnectionStringName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StorageAccountConnectionStringName)) + { + builder.Append(" storageAccountConnectionStringName: "); + if (StorageAccountConnectionStringName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{StorageAccountConnectionStringName}'''"); + } + else + { + builder.AppendLine($"'{StorageAccountConnectionStringName}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FunctionsDeploymentStorageAuthentication)} does not support writing '{options.Format}' format."); + } + } + + FunctionsDeploymentStorageAuthentication IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFunctionsDeploymentStorageAuthentication(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionsDeploymentStorageAuthentication)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorageAuthentication.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorageAuthentication.cs new file mode 100644 index 0000000000000..a4f70c959a9cb --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorageAuthentication.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Authentication method to access the storage account for deployment. + public partial class FunctionsDeploymentStorageAuthentication + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FunctionsDeploymentStorageAuthentication() + { + } + + /// Initializes a new instance of . + /// Property to select authentication type to access the selected storage account. Available options: SystemAssignedIdentity, UserAssignedIdentity, StorageAccountConnectionString. + /// Use this property for UserAssignedIdentity. Set the resource ID of the identity. Do not set a value for this property when using other authentication type. + /// Use this property for StorageAccountConnectionString. Set the name of the app setting that has the storage account connection string. Do not set a value for this property when using other authentication type. + /// Keeps track of any properties unknown to the library. + internal FunctionsDeploymentStorageAuthentication(AuthenticationType? authenticationType, string userAssignedIdentityResourceId, string storageAccountConnectionStringName, IDictionary serializedAdditionalRawData) + { + AuthenticationType = authenticationType; + UserAssignedIdentityResourceId = userAssignedIdentityResourceId; + StorageAccountConnectionStringName = storageAccountConnectionStringName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Property to select authentication type to access the selected storage account. Available options: SystemAssignedIdentity, UserAssignedIdentity, StorageAccountConnectionString. + [WirePath("type")] + public AuthenticationType? AuthenticationType { get; set; } + /// Use this property for UserAssignedIdentity. Set the resource ID of the identity. Do not set a value for this property when using other authentication type. + [WirePath("userAssignedIdentityResourceId")] + public string UserAssignedIdentityResourceId { get; set; } + /// Use this property for StorageAccountConnectionString. Set the name of the app setting that has the storage account connection string. Do not set a value for this property when using other authentication type. + [WirePath("storageAccountConnectionStringName")] + public string StorageAccountConnectionStringName { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorageType.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorageType.cs new file mode 100644 index 0000000000000..462d807a1b46a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsDeploymentStorageType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Property to select Azure Storage type. Available options: blobContainer. + public readonly partial struct FunctionsDeploymentStorageType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public FunctionsDeploymentStorageType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BlobContainerValue = "blobContainer"; + + /// blobContainer. + public static FunctionsDeploymentStorageType BlobContainer { get; } = new FunctionsDeploymentStorageType(BlobContainerValue); + /// Determines if two values are the same. + public static bool operator ==(FunctionsDeploymentStorageType left, FunctionsDeploymentStorageType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(FunctionsDeploymentStorageType left, FunctionsDeploymentStorageType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator FunctionsDeploymentStorageType(string value) => new FunctionsDeploymentStorageType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is FunctionsDeploymentStorageType other && Equals(other); + /// + public bool Equals(FunctionsDeploymentStorageType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsRuntime.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsRuntime.Serialization.cs new file mode 100644 index 0000000000000..85725ec1c9fc6 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsRuntime.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class FunctionsRuntime : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsRuntime)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.Value.ToString()); + } + if (Optional.IsDefined(Version)) + { + if (Version != null) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + else + { + writer.WriteNull("version"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FunctionsRuntime IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsRuntime)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionsRuntime(document.RootElement, options); + } + + internal static FunctionsRuntime DeserializeFunctionsRuntime(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + RuntimeName? name = default; + string version = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + name = new RuntimeName(property.Value.GetString()); + continue; + } + if (property.NameEquals("version"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + version = null; + continue; + } + version = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionsRuntime(name, version, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + builder.AppendLine($"'{Name.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + if (Version.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Version}'''"); + } + else + { + builder.AppendLine($"'{Version}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FunctionsRuntime)} does not support writing '{options.Format}' format."); + } + } + + FunctionsRuntime IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFunctionsRuntime(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionsRuntime)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsRuntime.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsRuntime.cs new file mode 100644 index 0000000000000..4de1f888eb4c0 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsRuntime.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Function app runtime name and version. + public partial class FunctionsRuntime + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FunctionsRuntime() + { + } + + /// Initializes a new instance of . + /// Function app runtime name. Available options: dotnet-isolated, node, java, powershell, python, custom. + /// Function app runtime version. Example: 8 (for dotnet-isolated). + /// Keeps track of any properties unknown to the library. + internal FunctionsRuntime(RuntimeName? name, string version, IDictionary serializedAdditionalRawData) + { + Name = name; + Version = version; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Function app runtime name. Available options: dotnet-isolated, node, java, powershell, python, custom. + [WirePath("name")] + public RuntimeName? Name { get; set; } + /// Function app runtime version. Example: 8 (for dotnet-isolated). + [WirePath("version")] + public string Version { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrency.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrency.Serialization.cs new file mode 100644 index 0000000000000..1d5cbc992b1d5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrency.Serialization.cs @@ -0,0 +1,273 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class FunctionsScaleAndConcurrency : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrency)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AlwaysReady)) + { + writer.WritePropertyName("alwaysReady"u8); + writer.WriteStartArray(); + foreach (var item in AlwaysReady) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(MaximumInstanceCount)) + { + writer.WritePropertyName("maximumInstanceCount"u8); + writer.WriteNumberValue(MaximumInstanceCount.Value); + } + if (Optional.IsDefined(InstanceMemoryMB)) + { + writer.WritePropertyName("instanceMemoryMB"u8); + writer.WriteNumberValue(InstanceMemoryMB.Value); + } + if (Optional.IsDefined(Triggers)) + { + writer.WritePropertyName("triggers"u8); + writer.WriteObjectValue(Triggers, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FunctionsScaleAndConcurrency IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrency)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionsScaleAndConcurrency(document.RootElement, options); + } + + internal static FunctionsScaleAndConcurrency DeserializeFunctionsScaleAndConcurrency(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList alwaysReady = default; + float? maximumInstanceCount = default; + float? instanceMemoryMB = default; + FunctionsScaleAndConcurrencyTriggers triggers = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("alwaysReady"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(FunctionsAlwaysReadyConfig.DeserializeFunctionsAlwaysReadyConfig(item, options)); + } + alwaysReady = array; + continue; + } + if (property.NameEquals("maximumInstanceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maximumInstanceCount = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("instanceMemoryMB"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + instanceMemoryMB = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("triggers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + triggers = FunctionsScaleAndConcurrencyTriggers.DeserializeFunctionsScaleAndConcurrencyTriggers(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionsScaleAndConcurrency(alwaysReady ?? new ChangeTrackingList(), maximumInstanceCount, instanceMemoryMB, triggers, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AlwaysReady), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" alwaysReady: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(AlwaysReady)) + { + if (AlwaysReady.Any()) + { + builder.Append(" alwaysReady: "); + builder.AppendLine("["); + foreach (var item in AlwaysReady) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " alwaysReady: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaximumInstanceCount), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maximumInstanceCount: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaximumInstanceCount)) + { + builder.Append(" maximumInstanceCount: "); + builder.AppendLine($"'{MaximumInstanceCount.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(InstanceMemoryMB), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" instanceMemoryMB: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(InstanceMemoryMB)) + { + builder.Append(" instanceMemoryMB: "); + builder.AppendLine($"'{InstanceMemoryMB.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("HttpPerInstanceConcurrency", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" triggers: "); + builder.AppendLine("{"); + builder.AppendLine(" http: {"); + builder.Append(" perInstanceConcurrency: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Triggers)) + { + builder.Append(" triggers: "); + BicepSerializationHelpers.AppendChildObject(builder, Triggers, options, 2, false, " triggers: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrency)} does not support writing '{options.Format}' format."); + } + } + + FunctionsScaleAndConcurrency IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFunctionsScaleAndConcurrency(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrency)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrency.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrency.cs new file mode 100644 index 0000000000000..122f8c5c04fc5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrency.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Scale and concurrency settings for the function app. + public partial class FunctionsScaleAndConcurrency + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FunctionsScaleAndConcurrency() + { + AlwaysReady = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// 'Always Ready' configuration for the function app. + /// The maximum number of instances for the function app. + /// Set the amount of memory allocated to each instance of the function app in MB. CPU and network bandwidth are allocated proportionally. + /// Scale and concurrency settings for the function app triggers. + /// Keeps track of any properties unknown to the library. + internal FunctionsScaleAndConcurrency(IList alwaysReady, float? maximumInstanceCount, float? instanceMemoryMB, FunctionsScaleAndConcurrencyTriggers triggers, IDictionary serializedAdditionalRawData) + { + AlwaysReady = alwaysReady; + MaximumInstanceCount = maximumInstanceCount; + InstanceMemoryMB = instanceMemoryMB; + Triggers = triggers; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// 'Always Ready' configuration for the function app. + [WirePath("alwaysReady")] + public IList AlwaysReady { get; } + /// The maximum number of instances for the function app. + [WirePath("maximumInstanceCount")] + public float? MaximumInstanceCount { get; set; } + /// Set the amount of memory allocated to each instance of the function app in MB. CPU and network bandwidth are allocated proportionally. + [WirePath("instanceMemoryMB")] + public float? InstanceMemoryMB { get; set; } + /// Scale and concurrency settings for the function app triggers. + internal FunctionsScaleAndConcurrencyTriggers Triggers { get; set; } + /// The maximum number of concurrent HTTP trigger invocations per instance. + [WirePath("triggers.http.perInstanceConcurrency")] + public float? HttpPerInstanceConcurrency + { + get => Triggers is null ? default : Triggers.HttpPerInstanceConcurrency; + set + { + if (Triggers is null) + Triggers = new FunctionsScaleAndConcurrencyTriggers(); + Triggers.HttpPerInstanceConcurrency = value; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggers.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggers.Serialization.cs new file mode 100644 index 0000000000000..8b581cbbc4848 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggers.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class FunctionsScaleAndConcurrencyTriggers : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrencyTriggers)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Http)) + { + writer.WritePropertyName("http"u8); + writer.WriteObjectValue(Http, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FunctionsScaleAndConcurrencyTriggers IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrencyTriggers)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionsScaleAndConcurrencyTriggers(document.RootElement, options); + } + + internal static FunctionsScaleAndConcurrencyTriggers DeserializeFunctionsScaleAndConcurrencyTriggers(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + FunctionsScaleAndConcurrencyTriggersHttp http = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("http"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + http = FunctionsScaleAndConcurrencyTriggersHttp.DeserializeFunctionsScaleAndConcurrencyTriggersHttp(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionsScaleAndConcurrencyTriggers(http, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("HttpPerInstanceConcurrency", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" http: "); + builder.AppendLine("{"); + builder.Append(" perInstanceConcurrency: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Http)) + { + builder.Append(" http: "); + BicepSerializationHelpers.AppendChildObject(builder, Http, options, 2, false, " http: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrencyTriggers)} does not support writing '{options.Format}' format."); + } + } + + FunctionsScaleAndConcurrencyTriggers IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFunctionsScaleAndConcurrencyTriggers(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrencyTriggers)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggers.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggers.cs new file mode 100644 index 0000000000000..ff97cda7d66b1 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggers.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Scale and concurrency settings for the function app triggers. + internal partial class FunctionsScaleAndConcurrencyTriggers + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FunctionsScaleAndConcurrencyTriggers() + { + } + + /// Initializes a new instance of . + /// Scale and concurrency settings for the HTTP trigger. + /// Keeps track of any properties unknown to the library. + internal FunctionsScaleAndConcurrencyTriggers(FunctionsScaleAndConcurrencyTriggersHttp http, IDictionary serializedAdditionalRawData) + { + Http = http; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Scale and concurrency settings for the HTTP trigger. + internal FunctionsScaleAndConcurrencyTriggersHttp Http { get; set; } + /// The maximum number of concurrent HTTP trigger invocations per instance. + [WirePath("http.perInstanceConcurrency")] + public float? HttpPerInstanceConcurrency + { + get => Http is null ? default : Http.PerInstanceConcurrency; + set + { + if (Http is null) + Http = new FunctionsScaleAndConcurrencyTriggersHttp(); + Http.PerInstanceConcurrency = value; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggersHttp.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggersHttp.Serialization.cs new file mode 100644 index 0000000000000..4466a5bb90bbe --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggersHttp.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class FunctionsScaleAndConcurrencyTriggersHttp : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrencyTriggersHttp)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(PerInstanceConcurrency)) + { + writer.WritePropertyName("perInstanceConcurrency"u8); + writer.WriteNumberValue(PerInstanceConcurrency.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FunctionsScaleAndConcurrencyTriggersHttp IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrencyTriggersHttp)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFunctionsScaleAndConcurrencyTriggersHttp(document.RootElement, options); + } + + internal static FunctionsScaleAndConcurrencyTriggersHttp DeserializeFunctionsScaleAndConcurrencyTriggersHttp(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + float? perInstanceConcurrency = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("perInstanceConcurrency"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + perInstanceConcurrency = property.Value.GetSingle(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FunctionsScaleAndConcurrencyTriggersHttp(perInstanceConcurrency, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PerInstanceConcurrency), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" perInstanceConcurrency: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PerInstanceConcurrency)) + { + builder.Append(" perInstanceConcurrency: "); + builder.AppendLine($"'{PerInstanceConcurrency.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrencyTriggersHttp)} does not support writing '{options.Format}' format."); + } + } + + FunctionsScaleAndConcurrencyTriggersHttp IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFunctionsScaleAndConcurrencyTriggersHttp(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FunctionsScaleAndConcurrencyTriggersHttp)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggersHttp.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggersHttp.cs new file mode 100644 index 0000000000000..1ea3a501e0f67 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/FunctionsScaleAndConcurrencyTriggersHttp.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Scale and concurrency settings for the HTTP trigger. + internal partial class FunctionsScaleAndConcurrencyTriggersHttp + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FunctionsScaleAndConcurrencyTriggersHttp() + { + } + + /// Initializes a new instance of . + /// The maximum number of concurrent HTTP trigger invocations per instance. + /// Keeps track of any properties unknown to the library. + internal FunctionsScaleAndConcurrencyTriggersHttp(float? perInstanceConcurrency, IDictionary serializedAdditionalRawData) + { + PerInstanceConcurrency = perInstanceConcurrency; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The maximum number of concurrent HTTP trigger invocations per instance. + [WirePath("perInstanceConcurrency")] + public float? PerInstanceConcurrency { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/HttpScaleRule.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/HttpScaleRule.Serialization.cs new file mode 100644 index 0000000000000..6edbee3557dda --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/HttpScaleRule.Serialization.cs @@ -0,0 +1,241 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class HttpScaleRule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HttpScaleRule)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartObject(); + foreach (var item in Metadata) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(Auth)) + { + writer.WritePropertyName("auth"u8); + writer.WriteStartArray(); + foreach (var item in Auth) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + HttpScaleRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(HttpScaleRule)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeHttpScaleRule(document.RootElement, options); + } + + internal static HttpScaleRule DeserializeHttpScaleRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary metadata = default; + IList auth = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + metadata = dictionary; + continue; + } + if (property.NameEquals("auth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScaleRuleAuth.DeserializeScaleRuleAuth(item, options)); + } + auth = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new HttpScaleRule(metadata ?? new ChangeTrackingDictionary(), auth ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Metadata), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" metadata: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata.Any()) + { + builder.Append(" metadata: "); + builder.AppendLine("{"); + foreach (var item in Metadata) + { + builder.Append($" '{item.Key}': "); + if (item.Value == null) + { + builder.Append("null"); + continue; + } + if (item.Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{item.Value}'''"); + } + else + { + builder.AppendLine($"'{item.Value}'"); + } + } + builder.AppendLine(" }"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Auth), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" auth: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Auth)) + { + if (Auth.Any()) + { + builder.Append(" auth: "); + builder.AppendLine("["); + foreach (var item in Auth) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " auth: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(HttpScaleRule)} does not support writing '{options.Format}' format."); + } + } + + HttpScaleRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeHttpScaleRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(HttpScaleRule)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/HttpScaleRule.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/HttpScaleRule.cs new file mode 100644 index 0000000000000..9f83a2908ed5c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/HttpScaleRule.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App container Custom scaling rule. + public partial class HttpScaleRule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public HttpScaleRule() + { + Metadata = new ChangeTrackingDictionary(); + Auth = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Metadata properties to describe http scale rule. + /// Authentication secrets for the custom scale rule. + /// Keeps track of any properties unknown to the library. + internal HttpScaleRule(IDictionary metadata, IList auth, IDictionary serializedAdditionalRawData) + { + Metadata = metadata; + Auth = auth; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Metadata properties to describe http scale rule. + [WirePath("metadata")] + public IDictionary Metadata { get; } + /// Authentication secrets for the custom scale rule. + [WirePath("auth")] + public IList Auth { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddress.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddress.Serialization.cs new file mode 100644 index 0000000000000..37f47f4e03652 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddress.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class IPAddress : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IPAddress)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Address)) + { + writer.WritePropertyName("address"u8); + writer.WriteStringValue(Address); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + IPAddress IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IPAddress)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIPAddress(document.RootElement, options); + } + + internal static IPAddress DeserializeIPAddress(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string address = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("address"u8)) + { + address = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new IPAddress(address, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Address), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" address: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Address)) + { + builder.Append(" address: "); + if (Address.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Address}'''"); + } + else + { + builder.AppendLine($"'{Address}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(IPAddress)} does not support writing '{options.Format}' format."); + } + } + + IPAddress IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeIPAddress(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IPAddress)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddress.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddress.cs new file mode 100644 index 0000000000000..e113c7504b63e --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddress.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The ip address. + public partial class IPAddress + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public IPAddress() + { + } + + /// Initializes a new instance of . + /// The address. + /// Keeps track of any properties unknown to the library. + internal IPAddress(string address, IDictionary serializedAdditionalRawData) + { + Address = address; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The address. + [WirePath("address")] + public string Address { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddressRange.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddressRange.Serialization.cs new file mode 100644 index 0000000000000..b34e681dc7d22 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddressRange.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class IPAddressRange : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IPAddressRange)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(AddressRange)) + { + writer.WritePropertyName("addressRange"u8); + writer.WriteStringValue(AddressRange); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + IPAddressRange IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(IPAddressRange)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIPAddressRange(document.RootElement, options); + } + + internal static IPAddressRange DeserializeIPAddressRange(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string addressRange = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("addressRange"u8)) + { + addressRange = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new IPAddressRange(addressRange, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AddressRange), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" addressRange: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AddressRange)) + { + builder.Append(" addressRange: "); + if (AddressRange.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AddressRange}'''"); + } + else + { + builder.AppendLine($"'{AddressRange}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(IPAddressRange)} does not support writing '{options.Format}' format."); + } + } + + IPAddressRange IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeIPAddressRange(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(IPAddressRange)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddressRange.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddressRange.cs new file mode 100644 index 0000000000000..a3233f41bc01b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IPAddressRange.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The ip address range. + public partial class IPAddressRange + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public IPAddressRange() + { + } + + /// Initializes a new instance of . + /// The IP address range. + /// Keeps track of any properties unknown to the library. + internal IPAddressRange(string addressRange, IDictionary serializedAdditionalRawData) + { + AddressRange = addressRange; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The IP address range. + [WirePath("addressRange")] + public string AddressRange { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Ingress.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Ingress.Serialization.cs new file mode 100644 index 0000000000000..9440203283548 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Ingress.Serialization.cs @@ -0,0 +1,341 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class Ingress : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Ingress)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Fqdn)) + { + writer.WritePropertyName("fqdn"u8); + writer.WriteStringValue(Fqdn); + } + if (Optional.IsDefined(External)) + { + writer.WritePropertyName("external"u8); + writer.WriteBooleanValue(External.Value); + } + if (Optional.IsDefined(TargetPort)) + { + writer.WritePropertyName("targetPort"u8); + writer.WriteNumberValue(TargetPort.Value); + } + if (Optional.IsDefined(Transport)) + { + writer.WritePropertyName("transport"u8); + writer.WriteStringValue(Transport.Value.ToString()); + } + if (Optional.IsCollectionDefined(Traffic)) + { + writer.WritePropertyName("traffic"u8); + writer.WriteStartArray(); + foreach (var item in Traffic) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AllowInsecure)) + { + writer.WritePropertyName("allowInsecure"u8); + writer.WriteBooleanValue(AllowInsecure.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Ingress IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Ingress)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeIngress(document.RootElement, options); + } + + internal static Ingress DeserializeIngress(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fqdn = default; + bool? external = default; + int? targetPort = default; + IngressTransportMethod? transport = default; + IList traffic = default; + bool? allowInsecure = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("fqdn"u8)) + { + fqdn = property.Value.GetString(); + continue; + } + if (property.NameEquals("external"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + external = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("targetPort"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetPort = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("transport"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + transport = new IngressTransportMethod(property.Value.GetString()); + continue; + } + if (property.NameEquals("traffic"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(TrafficWeight.DeserializeTrafficWeight(item, options)); + } + traffic = array; + continue; + } + if (property.NameEquals("allowInsecure"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + allowInsecure = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Ingress( + fqdn, + external, + targetPort, + transport, + traffic ?? new ChangeTrackingList(), + allowInsecure, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Fqdn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" fqdn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Fqdn)) + { + builder.Append(" fqdn: "); + if (Fqdn.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Fqdn}'''"); + } + else + { + builder.AppendLine($"'{Fqdn}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(External), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" external: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(External)) + { + builder.Append(" external: "); + var boolValue = External.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TargetPort), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" targetPort: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TargetPort)) + { + builder.Append(" targetPort: "); + builder.AppendLine($"{TargetPort.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Transport), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" transport: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Transport)) + { + builder.Append(" transport: "); + builder.AppendLine($"'{Transport.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Traffic), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" traffic: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Traffic)) + { + if (Traffic.Any()) + { + builder.Append(" traffic: "); + builder.AppendLine("["); + foreach (var item in Traffic) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " traffic: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowInsecure), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" allowInsecure: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AllowInsecure)) + { + builder.Append(" allowInsecure: "); + var boolValue = AllowInsecure.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Ingress)} does not support writing '{options.Format}' format."); + } + } + + Ingress IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeIngress(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Ingress)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Ingress.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Ingress.cs new file mode 100644 index 0000000000000..ccd0ae2ccc235 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Ingress.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App Ingress configuration. + public partial class Ingress + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Ingress() + { + Traffic = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Hostname. + /// Bool indicating if app exposes an external http endpoint. + /// Target Port in containers for traffic from ingress. + /// Ingress transport protocol. + /// + /// Bool indicating if HTTP connections to is allowed. If set to false HTTP connections are automatically redirected to HTTPS connections. + /// Keeps track of any properties unknown to the library. + internal Ingress(string fqdn, bool? external, int? targetPort, IngressTransportMethod? transport, IList traffic, bool? allowInsecure, IDictionary serializedAdditionalRawData) + { + Fqdn = fqdn; + External = external; + TargetPort = targetPort; + Transport = transport; + Traffic = traffic; + AllowInsecure = allowInsecure; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Hostname. + [WirePath("fqdn")] + public string Fqdn { get; } + /// Bool indicating if app exposes an external http endpoint. + [WirePath("external")] + public bool? External { get; set; } + /// Target Port in containers for traffic from ingress. + [WirePath("targetPort")] + public int? TargetPort { get; set; } + /// Ingress transport protocol. + [WirePath("transport")] + public IngressTransportMethod? Transport { get; set; } + /// Gets the traffic. + [WirePath("traffic")] + public IList Traffic { get; } + /// Bool indicating if HTTP connections to is allowed. If set to false HTTP connections are automatically redirected to HTTPS connections. + [WirePath("allowInsecure")] + public bool? AllowInsecure { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IngressTransportMethod.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IngressTransportMethod.cs new file mode 100644 index 0000000000000..a0fb047ea1332 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/IngressTransportMethod.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Ingress transport protocol. + public readonly partial struct IngressTransportMethod : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IngressTransportMethod(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AutoValue = "auto"; + private const string HttpValue = "http"; + private const string Http2Value = "http2"; + + /// auto. + public static IngressTransportMethod Auto { get; } = new IngressTransportMethod(AutoValue); + /// http. + public static IngressTransportMethod Http { get; } = new IngressTransportMethod(HttpValue); + /// http2. + public static IngressTransportMethod Http2 { get; } = new IngressTransportMethod(Http2Value); + /// Determines if two values are the same. + public static bool operator ==(IngressTransportMethod left, IngressTransportMethod right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IngressTransportMethod left, IngressTransportMethod right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator IngressTransportMethod(string value) => new IngressTransportMethod(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IngressTransportMethod other && Equals(other); + /// + public bool Equals(IngressTransportMethod other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/JsonSchema.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/JsonSchema.Serialization.cs new file mode 100644 index 0000000000000..d7878be17249f --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/JsonSchema.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class JsonSchema : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(JsonSchema)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Title)) + { + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + JsonSchema IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(JsonSchema)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeJsonSchema(document.RootElement, options); + } + + internal static JsonSchema DeserializeJsonSchema(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string title = default; + string content = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("content"u8)) + { + content = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new JsonSchema(title, content, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Title), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" title: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Title)) + { + builder.Append(" title: "); + if (Title.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Title}'''"); + } + else + { + builder.AppendLine($"'{Title}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Content), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" content: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Content)) + { + builder.Append(" content: "); + if (Content.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Content}'''"); + } + else + { + builder.AppendLine($"'{Content}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(JsonSchema)} does not support writing '{options.Format}' format."); + } + } + + JsonSchema IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeJsonSchema(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(JsonSchema)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/JsonSchema.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/JsonSchema.cs new file mode 100644 index 0000000000000..40212673c91ac --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/JsonSchema.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The JSON schema. + public partial class JsonSchema + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal JsonSchema() + { + } + + /// Initializes a new instance of . + /// The JSON title. + /// The JSON content. + /// Keeps track of any properties unknown to the library. + internal JsonSchema(string title, string content, IDictionary serializedAdditionalRawData) + { + Title = title; + Content = content; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The JSON title. + [WirePath("title")] + public string Title { get; } + /// The JSON content. + [WirePath("content")] + public string Content { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KeyType.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KeyType.cs new file mode 100644 index 0000000000000..1e67b72aa043c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KeyType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The key type. + public readonly partial struct KeyType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public KeyType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSpecifiedValue = "NotSpecified"; + private const string PrimaryValue = "Primary"; + private const string SecondaryValue = "Secondary"; + + /// NotSpecified. + public static KeyType NotSpecified { get; } = new KeyType(NotSpecifiedValue); + /// Primary. + public static KeyType Primary { get; } = new KeyType(PrimaryValue); + /// Secondary. + public static KeyType Secondary { get; } = new KeyType(SecondaryValue); + /// Determines if two values are the same. + public static bool operator ==(KeyType left, KeyType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(KeyType left, KeyType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator KeyType(string value) => new KeyType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KeyType other && Equals(other); + /// + public bool Equals(KeyType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KubeEnvironmentPatch.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KubeEnvironmentPatch.Serialization.cs index b0b647b9c1c28..f9a4c55cc225c 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KubeEnvironmentPatch.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KubeEnvironmentPatch.Serialization.cs @@ -90,6 +90,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr writer.WritePropertyName("appLogsConfiguration"u8); writer.WriteObjectValue(AppLogsConfiguration, options); } + if (Optional.IsDefined(ContainerAppsConfiguration)) + { + writer.WritePropertyName("containerAppsConfiguration"u8); + writer.WriteObjectValue(ContainerAppsConfiguration, options); + } if (Optional.IsDefined(AksResourceId)) { writer.WritePropertyName("aksResourceID"u8); @@ -146,6 +151,7 @@ internal static KubeEnvironmentPatch DeserializeKubeEnvironmentPatch(JsonElement string staticIP = default; ArcConfiguration arcConfiguration = default; AppLogsConfiguration appLogsConfiguration = default; + ContainerAppsConfiguration containerAppsConfiguration = default; ResourceIdentifier aksResourceId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); @@ -240,6 +246,15 @@ internal static KubeEnvironmentPatch DeserializeKubeEnvironmentPatch(JsonElement appLogsConfiguration = AppLogsConfiguration.DeserializeAppLogsConfiguration(property0.Value, options); continue; } + if (property0.NameEquals("containerAppsConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + containerAppsConfiguration = ContainerAppsConfiguration.DeserializeContainerAppsConfiguration(property0.Value, options); + continue; + } if (property0.NameEquals("aksResourceID"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -270,6 +285,7 @@ internal static KubeEnvironmentPatch DeserializeKubeEnvironmentPatch(JsonElement staticIP, arcConfiguration, appLogsConfiguration, + containerAppsConfiguration, aksResourceId, kind, serializedAdditionalRawData); @@ -494,6 +510,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContainerAppsConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" containerAppsConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContainerAppsConfiguration)) + { + builder.Append(" containerAppsConfiguration: "); + BicepSerializationHelpers.AppendChildObject(builder, ContainerAppsConfiguration, options, 4, false, " containerAppsConfiguration: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AksResourceId), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KubeEnvironmentPatch.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KubeEnvironmentPatch.cs index 0d97e15f9587d..4da93740195ac 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KubeEnvironmentPatch.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/KubeEnvironmentPatch.cs @@ -72,10 +72,11 @@ public KubeEnvironmentPatch() /// app logs to a destination. Currently only "log-analytics" is /// supported /// + /// Cluster configuration for Container Apps Environments to configure Dapr Instrumentation Key and VNET Configuration. /// /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal KubeEnvironmentPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, KubeEnvironmentProvisioningState? provisioningState, string deploymentErrors, bool? isInternalLoadBalancerEnabled, string defaultDomain, string staticIP, ArcConfiguration arcConfiguration, AppLogsConfiguration appLogsConfiguration, ResourceIdentifier aksResourceId, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal KubeEnvironmentPatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, KubeEnvironmentProvisioningState? provisioningState, string deploymentErrors, bool? isInternalLoadBalancerEnabled, string defaultDomain, string staticIP, ArcConfiguration arcConfiguration, AppLogsConfiguration appLogsConfiguration, ContainerAppsConfiguration containerAppsConfiguration, ResourceIdentifier aksResourceId, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; DeploymentErrors = deploymentErrors; @@ -84,6 +85,7 @@ internal KubeEnvironmentPatch(ResourceIdentifier id, string name, ResourceType r StaticIP = staticIP; ArcConfiguration = arcConfiguration; AppLogsConfiguration = appLogsConfiguration; + ContainerAppsConfiguration = containerAppsConfiguration; AksResourceId = aksResourceId; Kind = kind; _serializedAdditionalRawData = serializedAdditionalRawData; @@ -118,6 +120,9 @@ internal KubeEnvironmentPatch(ResourceIdentifier id, string name, ResourceType r /// [WirePath("properties.appLogsConfiguration")] public AppLogsConfiguration AppLogsConfiguration { get; set; } + /// Cluster configuration for Container Apps Environments to configure Dapr Instrumentation Key and VNET Configuration. + [WirePath("properties.containerAppsConfiguration")] + public ContainerAppsConfiguration ContainerAppsConfiguration { get; set; } /// Gets or sets the aks resource id. [WirePath("properties.aksResourceID")] public ResourceIdentifier AksResourceId { get; set; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicies.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicies.Serialization.cs new file mode 100644 index 0000000000000..2143960e865b6 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicies.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class OpenAuthenticationAccessPolicies : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAuthenticationAccessPolicies)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Policies)) + { + writer.WritePropertyName("policies"u8); + writer.WriteStartObject(); + foreach (var item in Policies) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value, options); + } + writer.WriteEndObject(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + OpenAuthenticationAccessPolicies IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAuthenticationAccessPolicies)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenAuthenticationAccessPolicies(document.RootElement, options); + } + + internal static OpenAuthenticationAccessPolicies DeserializeOpenAuthenticationAccessPolicies(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary policies = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, OpenAuthenticationAccessPolicy.DeserializeOpenAuthenticationAccessPolicy(property0.Value, options)); + } + policies = dictionary; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenAuthenticationAccessPolicies(policies ?? new ChangeTrackingDictionary(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Policies), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" policies: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Policies)) + { + if (Policies.Any()) + { + builder.Append(" policies: "); + builder.AppendLine("{"); + foreach (var item in Policies) + { + builder.Append($" '{item.Key}': "); + BicepSerializationHelpers.AppendChildObject(builder, item.Value, options, 4, false, " policies: "); + } + builder.AppendLine(" }"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(OpenAuthenticationAccessPolicies)} does not support writing '{options.Format}' format."); + } + } + + OpenAuthenticationAccessPolicies IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenAuthenticationAccessPolicies(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenAuthenticationAccessPolicies)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicies.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicies.cs new file mode 100644 index 0000000000000..508e5a717c4a1 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicies.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// AuthenticationPolicy of type Open. + internal partial class OpenAuthenticationAccessPolicies + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public OpenAuthenticationAccessPolicies() + { + Policies = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Open authentication policies. + /// Keeps track of any properties unknown to the library. + internal OpenAuthenticationAccessPolicies(IDictionary policies, IDictionary serializedAdditionalRawData) + { + Policies = policies; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Open authentication policies. + [WirePath("policies")] + public IDictionary Policies { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicy.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicy.Serialization.cs new file mode 100644 index 0000000000000..390a25a69d445 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicy.Serialization.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class OpenAuthenticationAccessPolicy : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAuthenticationAccessPolicy)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ProviderType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ProviderType.Value.ToString()); + } + if (Optional.IsCollectionDefined(Claims)) + { + writer.WritePropertyName("claims"u8); + writer.WriteStartArray(); + foreach (var item in Claims) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + OpenAuthenticationAccessPolicy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAuthenticationAccessPolicy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenAuthenticationAccessPolicy(document.RootElement, options); + } + + internal static OpenAuthenticationAccessPolicy DeserializeOpenAuthenticationAccessPolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OpenAuthenticationProviderType? type = default; + IList claims = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + type = new OpenAuthenticationProviderType(property.Value.GetString()); + continue; + } + if (property.NameEquals("claims"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OpenAuthenticationPolicyClaim.DeserializeOpenAuthenticationPolicyClaim(item, options)); + } + claims = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenAuthenticationAccessPolicy(type, claims ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProviderType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProviderType)) + { + builder.Append(" type: "); + builder.AppendLine($"'{ProviderType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Claims), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" claims: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Claims)) + { + if (Claims.Any()) + { + builder.Append(" claims: "); + builder.AppendLine("["); + foreach (var item in Claims) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " claims: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(OpenAuthenticationAccessPolicy)} does not support writing '{options.Format}' format."); + } + } + + OpenAuthenticationAccessPolicy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenAuthenticationAccessPolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenAuthenticationAccessPolicy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicy.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicy.cs new file mode 100644 index 0000000000000..0b2fc6b015898 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationAccessPolicy.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Open authentication access policy defined by user. + public partial class OpenAuthenticationAccessPolicy + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public OpenAuthenticationAccessPolicy() + { + Claims = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Type of provider for OAuth. + /// The access policy claims. + /// Keeps track of any properties unknown to the library. + internal OpenAuthenticationAccessPolicy(OpenAuthenticationProviderType? providerType, IList claims, IDictionary serializedAdditionalRawData) + { + ProviderType = providerType; + Claims = claims; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Type of provider for OAuth. + [WirePath("type")] + public OpenAuthenticationProviderType? ProviderType { get; set; } + /// The access policy claims. + [WirePath("claims")] + public IList Claims { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationPolicyClaim.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationPolicyClaim.Serialization.cs new file mode 100644 index 0000000000000..a4520e9a2071f --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationPolicyClaim.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class OpenAuthenticationPolicyClaim : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAuthenticationPolicyClaim)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + OpenAuthenticationPolicyClaim IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OpenAuthenticationPolicyClaim)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOpenAuthenticationPolicyClaim(document.RootElement, options); + } + + internal static OpenAuthenticationPolicyClaim DeserializeOpenAuthenticationPolicyClaim(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OpenAuthenticationPolicyClaim(name, value, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(OpenAuthenticationPolicyClaim)} does not support writing '{options.Format}' format."); + } + } + + OpenAuthenticationPolicyClaim IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeOpenAuthenticationPolicyClaim(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OpenAuthenticationPolicyClaim)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationPolicyClaim.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationPolicyClaim.cs new file mode 100644 index 0000000000000..ebd32ac6add08 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationPolicyClaim.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Open authentication policy claim. + public partial class OpenAuthenticationPolicyClaim + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public OpenAuthenticationPolicyClaim() + { + } + + /// Initializes a new instance of . + /// The name of the claim. + /// The value of the claim. + /// Keeps track of any properties unknown to the library. + internal OpenAuthenticationPolicyClaim(string name, string value, IDictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the claim. + [WirePath("name")] + public string Name { get; set; } + /// The value of the claim. + [WirePath("value")] + public string Value { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationProviderType.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationProviderType.cs new file mode 100644 index 0000000000000..33ca4da368601 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/OpenAuthenticationProviderType.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Open authentication policy provider type. + public readonly partial struct OpenAuthenticationProviderType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OpenAuthenticationProviderType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AADValue = "AAD"; + + /// AAD. + public static OpenAuthenticationProviderType AAD { get; } = new OpenAuthenticationProviderType(AADValue); + /// Determines if two values are the same. + public static bool operator ==(OpenAuthenticationProviderType left, OpenAuthenticationProviderType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OpenAuthenticationProviderType left, OpenAuthenticationProviderType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator OpenAuthenticationProviderType(string value) => new OpenAuthenticationProviderType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OpenAuthenticationProviderType other && Equals(other); + /// + public bool Equals(OpenAuthenticationProviderType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ParameterType.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ParameterType.cs new file mode 100644 index 0000000000000..405da46f7e919 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ParameterType.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The parameter type. + public readonly partial struct ParameterType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ParameterType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSpecifiedValue = "NotSpecified"; + private const string StringValue = "String"; + private const string SecureStringValue = "SecureString"; + private const string IntValue = "Int"; + private const string FloatValue = "Float"; + private const string BoolValue = "Bool"; + private const string ArrayValue = "Array"; + private const string ObjectValue = "Object"; + private const string SecureObjectValue = "SecureObject"; + + /// NotSpecified. + public static ParameterType NotSpecified { get; } = new ParameterType(NotSpecifiedValue); + /// String. + public static ParameterType String { get; } = new ParameterType(StringValue); + /// SecureString. + public static ParameterType SecureString { get; } = new ParameterType(SecureStringValue); + /// Int. + public static ParameterType Int { get; } = new ParameterType(IntValue); + /// Float. + public static ParameterType Float { get; } = new ParameterType(FloatValue); + /// Bool. + public static ParameterType Bool { get; } = new ParameterType(BoolValue); + /// Array. + public static ParameterType Array { get; } = new ParameterType(ArrayValue); + /// Object. + public static ParameterType Object { get; } = new ParameterType(ObjectValue); + /// SecureObject. + public static ParameterType SecureObject { get; } = new ParameterType(SecureObjectValue); + /// Determines if two values are the same. + public static bool operator ==(ParameterType left, ParameterType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ParameterType left, ParameterType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ParameterType(string value) => new ParameterType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ParameterType other && Equals(other); + /// + public bool Equals(ParameterType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/QueueScaleRule.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/QueueScaleRule.Serialization.cs new file mode 100644 index 0000000000000..fbdbdb1434f88 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/QueueScaleRule.Serialization.cs @@ -0,0 +1,242 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class QueueScaleRule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QueueScaleRule)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(QueueName)) + { + writer.WritePropertyName("queueName"u8); + writer.WriteStringValue(QueueName); + } + if (Optional.IsDefined(QueueLength)) + { + writer.WritePropertyName("queueLength"u8); + writer.WriteNumberValue(QueueLength.Value); + } + if (Optional.IsCollectionDefined(Auth)) + { + writer.WritePropertyName("auth"u8); + writer.WriteStartArray(); + foreach (var item in Auth) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + QueueScaleRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(QueueScaleRule)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeQueueScaleRule(document.RootElement, options); + } + + internal static QueueScaleRule DeserializeQueueScaleRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string queueName = default; + int? queueLength = default; + IList auth = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("queueName"u8)) + { + queueName = property.Value.GetString(); + continue; + } + if (property.NameEquals("queueLength"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + queueLength = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("auth"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScaleRuleAuth.DeserializeScaleRuleAuth(item, options)); + } + auth = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new QueueScaleRule(queueName, queueLength, auth ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QueueName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" queueName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(QueueName)) + { + builder.Append(" queueName: "); + if (QueueName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{QueueName}'''"); + } + else + { + builder.AppendLine($"'{QueueName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(QueueLength), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" queueLength: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(QueueLength)) + { + builder.Append(" queueLength: "); + builder.AppendLine($"{QueueLength.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Auth), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" auth: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Auth)) + { + if (Auth.Any()) + { + builder.Append(" auth: "); + builder.AppendLine("["); + foreach (var item in Auth) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " auth: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(QueueScaleRule)} does not support writing '{options.Format}' format."); + } + } + + QueueScaleRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeQueueScaleRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(QueueScaleRule)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/QueueScaleRule.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/QueueScaleRule.cs new file mode 100644 index 0000000000000..01956587469c6 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/QueueScaleRule.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App container Azure Queue based scaling rule. + public partial class QueueScaleRule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public QueueScaleRule() + { + Auth = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Queue name. + /// Queue length. + /// Authentication secrets for the queue scale rule. + /// Keeps track of any properties unknown to the library. + internal QueueScaleRule(string queueName, int? queueLength, IList auth, IDictionary serializedAdditionalRawData) + { + QueueName = queueName; + QueueLength = queueLength; + Auth = auth; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Queue name. + [WirePath("queueName")] + public string QueueName { get; set; } + /// Queue length. + [WirePath("queueLength")] + public int? QueueLength { get; set; } + /// Authentication secrets for the queue scale rule. + [WirePath("auth")] + public IList Auth { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceFrequency.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceFrequency.cs new file mode 100644 index 0000000000000..0f3152b36a86b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceFrequency.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The recurrence frequency. + public readonly partial struct RecurrenceFrequency : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RecurrenceFrequency(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NotSpecifiedValue = "NotSpecified"; + private const string SecondValue = "Second"; + private const string MinuteValue = "Minute"; + private const string HourValue = "Hour"; + private const string DayValue = "Day"; + private const string WeekValue = "Week"; + private const string MonthValue = "Month"; + private const string YearValue = "Year"; + + /// NotSpecified. + public static RecurrenceFrequency NotSpecified { get; } = new RecurrenceFrequency(NotSpecifiedValue); + /// Second. + public static RecurrenceFrequency Second { get; } = new RecurrenceFrequency(SecondValue); + /// Minute. + public static RecurrenceFrequency Minute { get; } = new RecurrenceFrequency(MinuteValue); + /// Hour. + public static RecurrenceFrequency Hour { get; } = new RecurrenceFrequency(HourValue); + /// Day. + public static RecurrenceFrequency Day { get; } = new RecurrenceFrequency(DayValue); + /// Week. + public static RecurrenceFrequency Week { get; } = new RecurrenceFrequency(WeekValue); + /// Month. + public static RecurrenceFrequency Month { get; } = new RecurrenceFrequency(MonthValue); + /// Year. + public static RecurrenceFrequency Year { get; } = new RecurrenceFrequency(YearValue); + /// Determines if two values are the same. + public static bool operator ==(RecurrenceFrequency left, RecurrenceFrequency right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RecurrenceFrequency left, RecurrenceFrequency right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RecurrenceFrequency(string value) => new RecurrenceFrequency(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RecurrenceFrequency other && Equals(other); + /// + public bool Equals(RecurrenceFrequency other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceSchedule.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceSchedule.Serialization.cs new file mode 100644 index 0000000000000..adfa4d48a6f05 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceSchedule.Serialization.cs @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class RecurrenceSchedule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RecurrenceSchedule)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Minutes)) + { + writer.WritePropertyName("minutes"u8); + writer.WriteStartArray(); + foreach (var item in Minutes) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Hours)) + { + writer.WritePropertyName("hours"u8); + writer.WriteStartArray(); + foreach (var item in Hours) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(WeekDays)) + { + writer.WritePropertyName("weekDays"u8); + writer.WriteStartArray(); + foreach (var item in WeekDays) + { + writer.WriteStringValue(item.ToSerialString()); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MonthDays)) + { + writer.WritePropertyName("monthDays"u8); + writer.WriteStartArray(); + foreach (var item in MonthDays) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MonthlyOccurrences)) + { + writer.WritePropertyName("monthlyOccurrences"u8); + writer.WriteStartArray(); + foreach (var item in MonthlyOccurrences) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RecurrenceSchedule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RecurrenceSchedule)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRecurrenceSchedule(document.RootElement, options); + } + + internal static RecurrenceSchedule DeserializeRecurrenceSchedule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList minutes = default; + IReadOnlyList hours = default; + IReadOnlyList weekDays = default; + IReadOnlyList monthDays = default; + IReadOnlyList monthlyOccurrences = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("minutes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + minutes = array; + continue; + } + if (property.NameEquals("hours"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + hours = array; + continue; + } + if (property.NameEquals("weekDays"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString().ToDaysOfWeek()); + } + weekDays = array; + continue; + } + if (property.NameEquals("monthDays"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + monthDays = array; + continue; + } + if (property.NameEquals("monthlyOccurrences"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RecurrenceScheduleOccurrence.DeserializeRecurrenceScheduleOccurrence(item, options)); + } + monthlyOccurrences = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RecurrenceSchedule( + minutes ?? new ChangeTrackingList(), + hours ?? new ChangeTrackingList(), + weekDays ?? new ChangeTrackingList(), + monthDays ?? new ChangeTrackingList(), + monthlyOccurrences ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Minutes), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" minutes: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Minutes)) + { + if (Minutes.Any()) + { + builder.Append(" minutes: "); + builder.AppendLine("["); + foreach (var item in Minutes) + { + builder.AppendLine($" {item}"); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Hours), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" hours: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Hours)) + { + if (Hours.Any()) + { + builder.Append(" hours: "); + builder.AppendLine("["); + foreach (var item in Hours) + { + builder.AppendLine($" {item}"); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(WeekDays), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" weekDays: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(WeekDays)) + { + if (WeekDays.Any()) + { + builder.Append(" weekDays: "); + builder.AppendLine("["); + foreach (var item in WeekDays) + { + builder.AppendLine($" '{item.ToSerialString()}'"); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MonthDays), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" monthDays: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(MonthDays)) + { + if (MonthDays.Any()) + { + builder.Append(" monthDays: "); + builder.AppendLine("["); + foreach (var item in MonthDays) + { + builder.AppendLine($" {item}"); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MonthlyOccurrences), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" monthlyOccurrences: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(MonthlyOccurrences)) + { + if (MonthlyOccurrences.Any()) + { + builder.Append(" monthlyOccurrences: "); + builder.AppendLine("["); + foreach (var item in MonthlyOccurrences) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " monthlyOccurrences: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RecurrenceSchedule)} does not support writing '{options.Format}' format."); + } + } + + RecurrenceSchedule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRecurrenceSchedule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RecurrenceSchedule)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceSchedule.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceSchedule.cs new file mode 100644 index 0000000000000..cef6583192545 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceSchedule.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The recurrence schedule. + public partial class RecurrenceSchedule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RecurrenceSchedule() + { + Minutes = new ChangeTrackingList(); + Hours = new ChangeTrackingList(); + WeekDays = new ChangeTrackingList(); + MonthDays = new ChangeTrackingList(); + MonthlyOccurrences = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The minutes. + /// The hours. + /// The days of the week. + /// The month days. + /// The monthly occurrences. + /// Keeps track of any properties unknown to the library. + internal RecurrenceSchedule(IReadOnlyList minutes, IReadOnlyList hours, IReadOnlyList weekDays, IReadOnlyList monthDays, IReadOnlyList monthlyOccurrences, IDictionary serializedAdditionalRawData) + { + Minutes = minutes; + Hours = hours; + WeekDays = weekDays; + MonthDays = monthDays; + MonthlyOccurrences = monthlyOccurrences; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The minutes. + [WirePath("minutes")] + public IReadOnlyList Minutes { get; } + /// The hours. + [WirePath("hours")] + public IReadOnlyList Hours { get; } + /// The days of the week. + [WirePath("weekDays")] + public IReadOnlyList WeekDays { get; } + /// The month days. + [WirePath("monthDays")] + public IReadOnlyList MonthDays { get; } + /// The monthly occurrences. + [WirePath("monthlyOccurrences")] + public IReadOnlyList MonthlyOccurrences { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceScheduleOccurrence.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceScheduleOccurrence.Serialization.cs new file mode 100644 index 0000000000000..bb8735a120908 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceScheduleOccurrence.Serialization.cs @@ -0,0 +1,189 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class RecurrenceScheduleOccurrence : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RecurrenceScheduleOccurrence)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Day)) + { + writer.WritePropertyName("day"u8); + writer.WriteStringValue(Day.Value.ToSerialString()); + } + if (Optional.IsDefined(Occurrence)) + { + writer.WritePropertyName("occurrence"u8); + writer.WriteNumberValue(Occurrence.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RecurrenceScheduleOccurrence IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RecurrenceScheduleOccurrence)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRecurrenceScheduleOccurrence(document.RootElement, options); + } + + internal static RecurrenceScheduleOccurrence DeserializeRecurrenceScheduleOccurrence(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DayOfWeek? day = default; + int? occurrence = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("day"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + day = property.Value.GetString().ToDayOfWeek(); + continue; + } + if (property.NameEquals("occurrence"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + occurrence = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RecurrenceScheduleOccurrence(day, occurrence, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Day), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" day: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Day)) + { + builder.Append(" day: "); + builder.AppendLine($"'{Day.Value.ToSerialString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Occurrence), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" occurrence: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Occurrence)) + { + builder.Append(" occurrence: "); + builder.AppendLine($"{Occurrence.Value}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RecurrenceScheduleOccurrence)} does not support writing '{options.Format}' format."); + } + } + + RecurrenceScheduleOccurrence IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRecurrenceScheduleOccurrence(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RecurrenceScheduleOccurrence)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceScheduleOccurrence.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceScheduleOccurrence.cs new file mode 100644 index 0000000000000..5942a8045eeea --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RecurrenceScheduleOccurrence.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The recurrence schedule occurrence. + public partial class RecurrenceScheduleOccurrence + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RecurrenceScheduleOccurrence() + { + } + + /// Initializes a new instance of . + /// The day of the week. + /// The occurrence. + /// Keeps track of any properties unknown to the library. + internal RecurrenceScheduleOccurrence(DayOfWeek? day, int? occurrence, IDictionary serializedAdditionalRawData) + { + Day = day; + Occurrence = occurrence; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The day of the week. + [WirePath("day")] + public DayOfWeek? Day { get; } + /// The occurrence. + [WirePath("occurrence")] + public int? Occurrence { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegenerateActionParameter.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegenerateActionParameter.Serialization.cs new file mode 100644 index 0000000000000..86d2fc8de0927 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegenerateActionParameter.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class RegenerateActionParameter : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegenerateActionParameter)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(KeyType)) + { + writer.WritePropertyName("keyType"u8); + writer.WriteStringValue(KeyType.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RegenerateActionParameter IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegenerateActionParameter)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRegenerateActionParameter(document.RootElement, options); + } + + internal static RegenerateActionParameter DeserializeRegenerateActionParameter(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyType? keyType = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyType = new KeyType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RegenerateActionParameter(keyType, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RegenerateActionParameter)} does not support writing '{options.Format}' format."); + } + } + + RegenerateActionParameter IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRegenerateActionParameter(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RegenerateActionParameter)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegenerateActionParameter.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegenerateActionParameter.cs new file mode 100644 index 0000000000000..290a83a6c8179 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegenerateActionParameter.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The access key regenerate action content. + public partial class RegenerateActionParameter + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RegenerateActionParameter() + { + } + + /// Initializes a new instance of . + /// The key type. + /// Keeps track of any properties unknown to the library. + internal RegenerateActionParameter(KeyType? keyType, IDictionary serializedAdditionalRawData) + { + KeyType = keyType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The key type. + [WirePath("keyType")] + public KeyType? KeyType { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegistryCredentials.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegistryCredentials.Serialization.cs new file mode 100644 index 0000000000000..e2ef66f00d439 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegistryCredentials.Serialization.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class RegistryCredentials : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegistryCredentials)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Server)) + { + writer.WritePropertyName("server"u8); + writer.WriteStringValue(Server); + } + if (Optional.IsDefined(Username)) + { + writer.WritePropertyName("username"u8); + writer.WriteStringValue(Username); + } + if (Optional.IsDefined(PasswordSecretRef)) + { + writer.WritePropertyName("passwordSecretRef"u8); + writer.WriteStringValue(PasswordSecretRef); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RegistryCredentials IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RegistryCredentials)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRegistryCredentials(document.RootElement, options); + } + + internal static RegistryCredentials DeserializeRegistryCredentials(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string server = default; + string username = default; + string passwordSecretRef = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("server"u8)) + { + server = property.Value.GetString(); + continue; + } + if (property.NameEquals("username"u8)) + { + username = property.Value.GetString(); + continue; + } + if (property.NameEquals("passwordSecretRef"u8)) + { + passwordSecretRef = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RegistryCredentials(server, username, passwordSecretRef, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Server), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" server: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Server)) + { + builder.Append(" server: "); + if (Server.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Server}'''"); + } + else + { + builder.AppendLine($"'{Server}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Username), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" username: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Username)) + { + builder.Append(" username: "); + if (Username.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Username}'''"); + } + else + { + builder.AppendLine($"'{Username}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PasswordSecretRef), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" passwordSecretRef: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PasswordSecretRef)) + { + builder.Append(" passwordSecretRef: "); + if (PasswordSecretRef.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PasswordSecretRef}'''"); + } + else + { + builder.AppendLine($"'{PasswordSecretRef}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RegistryCredentials)} does not support writing '{options.Format}' format."); + } + } + + RegistryCredentials IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRegistryCredentials(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RegistryCredentials)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegistryCredentials.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegistryCredentials.cs new file mode 100644 index 0000000000000..aedcacc1dad66 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RegistryCredentials.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App Private Registry. + public partial class RegistryCredentials + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RegistryCredentials() + { + } + + /// Initializes a new instance of . + /// Container Registry Server. + /// Container Registry Username. + /// The name of the Secret that contains the registry login password. + /// Keeps track of any properties unknown to the library. + internal RegistryCredentials(string server, string username, string passwordSecretRef, IDictionary serializedAdditionalRawData) + { + Server = server; + Username = username; + PasswordSecretRef = passwordSecretRef; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Container Registry Server. + [WirePath("server")] + public string Server { get; set; } + /// Container Registry Username. + [WirePath("username")] + public string Username { get; set; } + /// The name of the Secret that contains the registry login password. + [WirePath("passwordSecretRef")] + public string PasswordSecretRef { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RemotePrivateEndpointConnection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RemotePrivateEndpointConnection.Serialization.cs index a3ea774e413a9..ffa731582b175 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RemotePrivateEndpointConnection.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RemotePrivateEndpointConnection.Serialization.cs @@ -135,7 +135,7 @@ internal static RemotePrivateEndpointConnection DeserializeRemotePrivateEndpoint string provisioningState = default; SubResource privateEndpoint = default; PrivateLinkConnectionState privateLinkServiceConnectionState = default; - IList ipAddresses = default; + IList ipAddresses = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -207,7 +207,7 @@ internal static RemotePrivateEndpointConnection DeserializeRemotePrivateEndpoint { continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { if (item.ValueKind == JsonValueKind.Null) @@ -216,7 +216,7 @@ internal static RemotePrivateEndpointConnection DeserializeRemotePrivateEndpoint } else { - array.Add(IPAddress.Parse(item.GetString())); + array.Add(System.Net.IPAddress.Parse(item.GetString())); } } ipAddresses = array; @@ -239,7 +239,7 @@ internal static RemotePrivateEndpointConnection DeserializeRemotePrivateEndpoint provisioningState, privateEndpoint, privateLinkServiceConnectionState, - ipAddresses ?? new ChangeTrackingList(), + ipAddresses ?? new ChangeTrackingList(), kind, serializedAdditionalRawData); } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RemotePrivateEndpointConnection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RemotePrivateEndpointConnection.cs index 6e2666e583a40..b04210ea279c3 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RemotePrivateEndpointConnection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RemotePrivateEndpointConnection.cs @@ -52,7 +52,7 @@ public partial class RemotePrivateEndpointConnection : ResourceData /// Initializes a new instance of . public RemotePrivateEndpointConnection() { - IPAddresses = new ChangeTrackingList(); + IPAddresses = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -66,7 +66,7 @@ public RemotePrivateEndpointConnection() /// Private IPAddresses mapped to the remote private endpoint. /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal RemotePrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provisioningState, SubResource privateEndpoint, PrivateLinkConnectionState privateLinkServiceConnectionState, IList ipAddresses, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal RemotePrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string provisioningState, SubResource privateEndpoint, PrivateLinkConnectionState privateLinkServiceConnectionState, IList ipAddresses, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { ProvisioningState = provisioningState; PrivateEndpoint = privateEndpoint; @@ -93,7 +93,7 @@ public ResourceIdentifier PrivateEndpointId public PrivateLinkConnectionState PrivateLinkServiceConnectionState { get; set; } /// Private IPAddresses mapped to the remote private endpoint. [WirePath("properties.ipAddresses")] - public IList IPAddresses { get; } + public IList IPAddresses { get; } /// Kind of resource. [WirePath("kind")] public string Kind { get; set; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RepetitionIndex.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RepetitionIndex.Serialization.cs new file mode 100644 index 0000000000000..f32f2051e23f4 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RepetitionIndex.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class RepetitionIndex : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RepetitionIndex)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ScopeName)) + { + writer.WritePropertyName("scopeName"u8); + writer.WriteStringValue(ScopeName); + } + writer.WritePropertyName("itemIndex"u8); + writer.WriteNumberValue(ItemIndex); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RepetitionIndex IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RepetitionIndex)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRepetitionIndex(document.RootElement, options); + } + + internal static RepetitionIndex DeserializeRepetitionIndex(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string scopeName = default; + int itemIndex = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scopeName"u8)) + { + scopeName = property.Value.GetString(); + continue; + } + if (property.NameEquals("itemIndex"u8)) + { + itemIndex = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RepetitionIndex(scopeName, itemIndex, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScopeName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scopeName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ScopeName)) + { + builder.Append(" scopeName: "); + if (ScopeName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ScopeName}'''"); + } + else + { + builder.AppendLine($"'{ScopeName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ItemIndex), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" itemIndex: "); + builder.AppendLine(propertyOverride); + } + else + { + builder.Append(" itemIndex: "); + builder.AppendLine($"{ItemIndex}"); + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RepetitionIndex)} does not support writing '{options.Format}' format."); + } + } + + RepetitionIndex IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRepetitionIndex(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RepetitionIndex)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RepetitionIndex.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RepetitionIndex.cs new file mode 100644 index 0000000000000..6dca84a872b54 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RepetitionIndex.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The workflow run action repetition index. + public partial class RepetitionIndex + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The index. + public RepetitionIndex(int itemIndex) + { + ItemIndex = itemIndex; + } + + /// Initializes a new instance of . + /// The scope. + /// The index. + /// Keeps track of any properties unknown to the library. + internal RepetitionIndex(string scopeName, int itemIndex, IDictionary serializedAdditionalRawData) + { + ScopeName = scopeName; + ItemIndex = itemIndex; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RepetitionIndex() + { + } + + /// The scope. + [WirePath("scopeName")] + public string ScopeName { get; set; } + /// The index. + [WirePath("itemIndex")] + public int ItemIndex { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Request.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Request.Serialization.cs new file mode 100644 index 0000000000000..4b245da6a6218 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Request.Serialization.cs @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class Request : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Request)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Headers)) + { + writer.WritePropertyName("headers"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Headers); +#else + using (JsonDocument document = JsonDocument.Parse(Headers)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsDefined(Uri)) + { + writer.WritePropertyName("uri"u8); + writer.WriteStringValue(Uri.AbsoluteUri); + } + if (Optional.IsDefined(Method)) + { + writer.WritePropertyName("method"u8); + writer.WriteStringValue(Method); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Request IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Request)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequest(document.RootElement, options); + } + + internal static Request DeserializeRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BinaryData headers = default; + Uri uri = default; + string method = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("headers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + headers = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("uri"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("method"u8)) + { + method = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Request(headers, uri, method, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Headers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" headers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Headers)) + { + builder.Append(" headers: "); + builder.AppendLine($"'{Headers.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Uri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" uri: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Uri)) + { + builder.Append(" uri: "); + builder.AppendLine($"'{Uri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Method), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" method: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Method)) + { + builder.Append(" method: "); + if (Method.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Method}'''"); + } + else + { + builder.AppendLine($"'{Method}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Request)} does not support writing '{options.Format}' format."); + } + } + + Request IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Request)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Request.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Request.cs new file mode 100644 index 0000000000000..15d339e4aec80 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Request.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// A request. + public partial class Request + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Request() + { + } + + /// Initializes a new instance of . + /// A list of all the headers attached to the request. + /// The destination for the request. + /// The HTTP method used for the request. + /// Keeps track of any properties unknown to the library. + internal Request(BinaryData headers, Uri uri, string method, IDictionary serializedAdditionalRawData) + { + Headers = headers; + Uri = uri; + Method = method; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// A list of all the headers attached to the request. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("headers")] + public BinaryData Headers { get; set; } + /// The destination for the request. + [WirePath("uri")] + public Uri Uri { get; set; } + /// The HTTP method used for the request. + [WirePath("method")] + public string Method { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryListResult.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryListResult.Serialization.cs new file mode 100644 index 0000000000000..28977ebe2d493 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryListResult.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class RequestHistoryListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequestHistoryListResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RequestHistoryListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequestHistoryListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequestHistoryListResult(document.RootElement, options); + } + + internal static RequestHistoryListResult DeserializeRequestHistoryListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RequestHistoryData.DeserializeRequestHistoryData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RequestHistoryListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RequestHistoryListResult)} does not support writing '{options.Format}' format."); + } + } + + RequestHistoryListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRequestHistoryListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequestHistoryListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryListResult.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryListResult.cs new file mode 100644 index 0000000000000..86f75bd9f5db5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryListResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The list of workflow request histories. + internal partial class RequestHistoryListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal RequestHistoryListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A list of workflow request histories. + /// The URL to get the next set of results. + /// Keeps track of any properties unknown to the library. + internal RequestHistoryListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// A list of workflow request histories. + public IReadOnlyList Value { get; } + /// The URL to get the next set of results. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryProperties.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryProperties.Serialization.cs new file mode 100644 index 0000000000000..ae5d4a970c071 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryProperties.Serialization.cs @@ -0,0 +1,251 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class RequestHistoryProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequestHistoryProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsDefined(Request)) + { + writer.WritePropertyName("request"u8); + writer.WriteObjectValue(Request, options); + } + if (Optional.IsDefined(Response)) + { + writer.WritePropertyName("response"u8); + writer.WriteObjectValue(Response, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RequestHistoryProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequestHistoryProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequestHistoryProperties(document.RootElement, options); + } + + internal static RequestHistoryProperties DeserializeRequestHistoryProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? startTime = default; + DateTimeOffset? endTime = default; + Request request = default; + Response response = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("request"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + request = Request.DeserializeRequest(property.Value, options); + continue; + } + if (property.NameEquals("response"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + response = Response.DeserializeResponse(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RequestHistoryProperties(startTime, endTime, request, response, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartOn)) + { + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndOn)) + { + builder.Append(" endTime: "); + var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Request), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" request: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Request)) + { + builder.Append(" request: "); + BicepSerializationHelpers.AppendChildObject(builder, Request, options, 2, false, " request: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Response), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" response: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Response)) + { + builder.Append(" response: "); + BicepSerializationHelpers.AppendChildObject(builder, Response, options, 2, false, " response: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RequestHistoryProperties)} does not support writing '{options.Format}' format."); + } + } + + RequestHistoryProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRequestHistoryProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequestHistoryProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryProperties.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryProperties.cs new file mode 100644 index 0000000000000..58e9eef8bc781 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RequestHistoryProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The request history. + public partial class RequestHistoryProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RequestHistoryProperties() + { + } + + /// Initializes a new instance of . + /// The time the request started. + /// The time the request ended. + /// The request. + /// The response. + /// Keeps track of any properties unknown to the library. + internal RequestHistoryProperties(DateTimeOffset? startOn, DateTimeOffset? endOn, Request request, Response response, IDictionary serializedAdditionalRawData) + { + StartOn = startOn; + EndOn = endOn; + Request = request; + Response = response; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The time the request started. + [WirePath("startTime")] + public DateTimeOffset? StartOn { get; set; } + /// The time the request ended. + [WirePath("endTime")] + public DateTimeOffset? EndOn { get; set; } + /// The request. + [WirePath("request")] + public Request Request { get; set; } + /// The response. + [WirePath("response")] + public Response Response { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceConfig.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceConfig.Serialization.cs new file mode 100644 index 0000000000000..de7682cd99afd --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceConfig.Serialization.cs @@ -0,0 +1,193 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ResourceConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Cpu)) + { + writer.WritePropertyName("cpu"u8); + writer.WriteNumberValue(Cpu.Value); + } + if (Optional.IsDefined(Memory)) + { + writer.WritePropertyName("memory"u8); + writer.WriteStringValue(Memory); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ResourceConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceConfig(document.RootElement, options); + } + + internal static ResourceConfig DeserializeResourceConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double? cpu = default; + string memory = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("cpu"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cpu = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("memory"u8)) + { + memory = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceConfig(cpu, memory, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Cpu), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" cpu: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Cpu)) + { + builder.Append(" cpu: "); + builder.AppendLine($"'{Cpu.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Memory), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" memory: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Memory)) + { + builder.Append(" memory: "); + if (Memory.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Memory}'''"); + } + else + { + builder.AppendLine($"'{Memory}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ResourceConfig)} does not support writing '{options.Format}' format."); + } + } + + ResourceConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeResourceConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceConfig.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceConfig.cs new file mode 100644 index 0000000000000..e3c33c648bda6 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceConfig.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Function app resource requirements. + public partial class ResourceConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ResourceConfig() + { + } + + /// Initializes a new instance of . + /// Required CPU in cores, e.g. 0.5. + /// Required memory, e.g. "1Gi". + /// Keeps track of any properties unknown to the library. + internal ResourceConfig(double? cpu, string memory, IDictionary serializedAdditionalRawData) + { + Cpu = cpu; + Memory = memory; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Required CPU in cores, e.g. 0.5. + [WirePath("cpu")] + public double? Cpu { get; set; } + /// Required memory, e.g. "1Gi". + [WirePath("memory")] + public string Memory { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceNameAvailabilityContent.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceNameAvailabilityContent.Serialization.cs index a3714d6688482..0b5b974e2b759 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceNameAvailabilityContent.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceNameAvailabilityContent.Serialization.cs @@ -35,6 +35,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo writer.WritePropertyName("isFqdn"u8); writer.WriteBooleanValue(IsFqdn.Value); } + if (Optional.IsDefined(EnvironmentId)) + { + writer.WritePropertyName("environmentId"u8); + writer.WriteStringValue(EnvironmentId); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -76,6 +81,7 @@ internal static ResourceNameAvailabilityContent DeserializeResourceNameAvailabil string name = default; CheckNameResourceType type = default; bool? isFqdn = default; + string environmentId = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -99,13 +105,18 @@ internal static ResourceNameAvailabilityContent DeserializeResourceNameAvailabil isFqdn = property.Value.GetBoolean(); continue; } + if (property.NameEquals("environmentId"u8)) + { + environmentId = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ResourceNameAvailabilityContent(name, type, isFqdn, serializedAdditionalRawData); + return new ResourceNameAvailabilityContent(name, type, isFqdn, environmentId, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceNameAvailabilityContent.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceNameAvailabilityContent.cs index 273d646be9be8..2dfe44ed08c32 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceNameAvailabilityContent.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceNameAvailabilityContent.cs @@ -61,12 +61,14 @@ public ResourceNameAvailabilityContent(string name, CheckNameResourceType resour /// Resource name to verify. /// Resource type used for verification. /// Is fully qualified domain name. + /// Azure Resource Manager ID of the customer's selected Container Apps Environment on which to host the Function app. This must be of the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}. /// Keeps track of any properties unknown to the library. - internal ResourceNameAvailabilityContent(string name, CheckNameResourceType resourceType, bool? isFqdn, IDictionary serializedAdditionalRawData) + internal ResourceNameAvailabilityContent(string name, CheckNameResourceType resourceType, bool? isFqdn, string environmentId, IDictionary serializedAdditionalRawData) { Name = name; ResourceType = resourceType; IsFqdn = isFqdn; + EnvironmentId = environmentId; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -84,5 +86,8 @@ internal ResourceNameAvailabilityContent() /// Is fully qualified domain name. [WirePath("isFqdn")] public bool? IsFqdn { get; set; } + /// Azure Resource Manager ID of the customer's selected Container Apps Environment on which to host the Function app. This must be of the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroup}/providers/Microsoft.App/managedEnvironments/{managedEnvironmentName}. + [WirePath("environmentId")] + public string EnvironmentId { get; set; } } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceReference.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceReference.Serialization.cs new file mode 100644 index 0000000000000..ecae5fa0cef7c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceReference.Serialization.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ResourceReference : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceReference)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W" && Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(ResourceType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ResourceReference IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceReference)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceReference(document.RootElement, options); + } + + internal static ResourceReference DeserializeResourceReference(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string name = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceReference(id, name, type, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + if (Id.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Id}'''"); + } + else + { + builder.AppendLine($"'{Id}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ResourceReference)} does not support writing '{options.Format}' format."); + } + } + + ResourceReference IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeResourceReference(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceReference)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceReference.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceReference.cs new file mode 100644 index 0000000000000..f2dcdb3509b26 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResourceReference.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The resource reference. + public partial class ResourceReference + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ResourceReference() + { + } + + /// Initializes a new instance of . + /// The resource id. + /// Gets the resource name. + /// Gets the resource type. + /// Keeps track of any properties unknown to the library. + internal ResourceReference(string id, string name, string resourceType, IDictionary serializedAdditionalRawData) + { + Id = id; + Name = name; + ResourceType = resourceType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource id. + [WirePath("id")] + public string Id { get; set; } + /// Gets the resource name. + [WirePath("name")] + public string Name { get; } + /// Gets the resource type. + [WirePath("type")] + public string ResourceType { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Response.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Response.Serialization.cs new file mode 100644 index 0000000000000..ab0e320b96f1e --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Response.Serialization.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class Response : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Response)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Headers)) + { + writer.WritePropertyName("headers"u8); +#if NET6_0_OR_GREATER + writer.WriteRawValue(Headers); +#else + using (JsonDocument document = JsonDocument.Parse(Headers)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + if (Optional.IsDefined(StatusCode)) + { + writer.WritePropertyName("statusCode"u8); + writer.WriteNumberValue(StatusCode.Value); + } + if (Optional.IsDefined(BodyLink)) + { + writer.WritePropertyName("bodyLink"u8); + writer.WriteObjectValue(BodyLink, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Response IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Response)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResponse(document.RootElement, options); + } + + internal static Response DeserializeResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + BinaryData headers = default; + int? statusCode = default; + ContentLink bodyLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("headers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + headers = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("statusCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + statusCode = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("bodyLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + bodyLink = ContentLink.DeserializeContentLink(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Response(headers, statusCode, bodyLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Headers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" headers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Headers)) + { + builder.Append(" headers: "); + builder.AppendLine($"'{Headers.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StatusCode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" statusCode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StatusCode)) + { + builder.Append(" statusCode: "); + builder.AppendLine($"{StatusCode.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BodyLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" bodyLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(BodyLink)) + { + builder.Append(" bodyLink: "); + BicepSerializationHelpers.AppendChildObject(builder, BodyLink, options, 2, false, " bodyLink: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Response)} does not support writing '{options.Format}' format."); + } + } + + Response IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Response)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Response.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Response.cs new file mode 100644 index 0000000000000..1e6bde49393c5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Response.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// A response. + public partial class Response + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Response() + { + } + + /// Initializes a new instance of . + /// A list of all the headers attached to the response. + /// The status code of the response. + /// Details on the location of the body content. + /// Keeps track of any properties unknown to the library. + internal Response(BinaryData headers, int? statusCode, ContentLink bodyLink, IDictionary serializedAdditionalRawData) + { + Headers = headers; + StatusCode = statusCode; + BodyLink = bodyLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// A list of all the headers attached to the response. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + [WirePath("headers")] + public BinaryData Headers { get; set; } + /// The status code of the response. + [WirePath("statusCode")] + public int? StatusCode { get; set; } + /// Details on the location of the body content. + [WirePath("bodyLink")] + public ContentLink BodyLink { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResponseMessageEnvelopeRemotePrivateEndpointConnection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResponseMessageEnvelopeRemotePrivateEndpointConnection.Serialization.cs index 0c7bd20aa8401..18df59ddaa7d3 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResponseMessageEnvelopeRemotePrivateEndpointConnection.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResponseMessageEnvelopeRemotePrivateEndpointConnection.Serialization.cs @@ -68,7 +68,7 @@ void IJsonModel.Write(Ut if (Optional.IsDefined(Error)) { writer.WritePropertyName("error"u8); - JsonSerializer.Serialize(writer, Error); + writer.WriteObjectValue(Error, options); } if (Optional.IsDefined(Identity)) { @@ -149,7 +149,7 @@ internal static ResponseMessageEnvelopeRemotePrivateEndpointConnection Deseriali RemotePrivateEndpointConnection properties = default; AppServiceSkuDescription sku = default; string status = default; - ResponseError error = default; + ErrorEntity error = default; ManagedServiceIdentity identity = default; IReadOnlyList zones = default; ResourceIdentifier id = default; @@ -221,7 +221,7 @@ internal static ResponseMessageEnvelopeRemotePrivateEndpointConnection Deseriali { continue; } - error = JsonSerializer.Deserialize(property.Value.GetRawText()); + error = ErrorEntity.DeserializeErrorEntity(property.Value, options); continue; } if (property.NameEquals("identity"u8)) diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResponseMessageEnvelopeRemotePrivateEndpointConnection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResponseMessageEnvelopeRemotePrivateEndpointConnection.cs index 8c9b608a16286..bc33f58b66edd 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResponseMessageEnvelopeRemotePrivateEndpointConnection.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ResponseMessageEnvelopeRemotePrivateEndpointConnection.cs @@ -69,7 +69,7 @@ internal ResponseMessageEnvelopeRemotePrivateEndpointConnection() /// MSI resource. /// Logical Availability Zones the service is hosted in. /// Keeps track of any properties unknown to the library. - internal ResponseMessageEnvelopeRemotePrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IReadOnlyDictionary tags, AppServiceArmPlan plan, RemotePrivateEndpointConnection properties, AppServiceSkuDescription sku, string status, ResponseError error, ManagedServiceIdentity identity, IReadOnlyList zones, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal ResponseMessageEnvelopeRemotePrivateEndpointConnection(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, IReadOnlyDictionary tags, AppServiceArmPlan plan, RemotePrivateEndpointConnection properties, AppServiceSkuDescription sku, string status, ErrorEntity error, ManagedServiceIdentity identity, IReadOnlyList zones, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Location = location; Tags = tags; @@ -103,7 +103,7 @@ internal ResponseMessageEnvelopeRemotePrivateEndpointConnection(ResourceIdentifi public string Status { get; } /// Azure-AsyncOperation Error info. [WirePath("error")] - public ResponseError Error { get; } + public ErrorEntity Error { get; } /// MSI resource. [WirePath("identity")] public ManagedServiceIdentity Identity { get; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RetryHistory.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RetryHistory.Serialization.cs new file mode 100644 index 0000000000000..c94aecb558e95 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RetryHistory.Serialization.cs @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class RetryHistory : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RetryHistory)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(StartOn)) + { + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn.Value, "O"); + } + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(ClientRequestId)) + { + writer.WritePropertyName("clientRequestId"u8); + writer.WriteStringValue(ClientRequestId); + } + if (Optional.IsDefined(ServiceRequestId)) + { + writer.WritePropertyName("serviceRequestId"u8); + writer.WriteStringValue(ServiceRequestId); + } + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + writer.WriteObjectValue(Error, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RetryHistory IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RetryHistory)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRetryHistory(document.RootElement, options); + } + + internal static RetryHistory DeserializeRetryHistory(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? startTime = default; + DateTimeOffset? endTime = default; + string code = default; + string clientRequestId = default; + string serviceRequestId = default; + ErrorResponse error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientRequestId"u8)) + { + clientRequestId = property.Value.GetString(); + continue; + } + if (property.NameEquals("serviceRequestId"u8)) + { + serviceRequestId = property.Value.GetString(); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorResponse.DeserializeErrorResponse(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RetryHistory( + startTime, + endTime, + code, + clientRequestId, + serviceRequestId, + error, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartOn)) + { + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndOn)) + { + builder.Append(" endTime: "); + var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Code), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" code: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Code)) + { + builder.Append(" code: "); + if (Code.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Code}'''"); + } + else + { + builder.AppendLine($"'{Code}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClientRequestId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" clientRequestId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ClientRequestId)) + { + builder.Append(" clientRequestId: "); + if (ClientRequestId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ClientRequestId}'''"); + } + else + { + builder.AppendLine($"'{ClientRequestId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ServiceRequestId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" serviceRequestId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ServiceRequestId)) + { + builder.Append(" serviceRequestId: "); + if (ServiceRequestId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ServiceRequestId}'''"); + } + else + { + builder.AppendLine($"'{ServiceRequestId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue("Error", out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" error: "); + builder.AppendLine("{"); + builder.Append(" error: "); + builder.AppendLine(propertyOverride); + builder.AppendLine(" }"); + } + else + { + if (Optional.IsDefined(Error)) + { + builder.Append(" error: "); + BicepSerializationHelpers.AppendChildObject(builder, Error, options, 2, false, " error: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RetryHistory)} does not support writing '{options.Format}' format."); + } + } + + RetryHistory IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRetryHistory(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RetryHistory)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RetryHistory.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RetryHistory.cs new file mode 100644 index 0000000000000..d5053b5452d79 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RetryHistory.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The retry history. + public partial class RetryHistory + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RetryHistory() + { + } + + /// Initializes a new instance of . + /// Gets the start time. + /// Gets the end time. + /// Gets the status code. + /// Gets the client request Id. + /// Gets the service request Id. + /// Gets the error response. + /// Keeps track of any properties unknown to the library. + internal RetryHistory(DateTimeOffset? startOn, DateTimeOffset? endOn, string code, string clientRequestId, string serviceRequestId, ErrorResponse error, IDictionary serializedAdditionalRawData) + { + StartOn = startOn; + EndOn = endOn; + Code = code; + ClientRequestId = clientRequestId; + ServiceRequestId = serviceRequestId; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets the start time. + [WirePath("startTime")] + public DateTimeOffset? StartOn { get; set; } + /// Gets the end time. + [WirePath("endTime")] + public DateTimeOffset? EndOn { get; set; } + /// Gets the status code. + [WirePath("code")] + public string Code { get; set; } + /// Gets the client request Id. + [WirePath("clientRequestId")] + public string ClientRequestId { get; set; } + /// Gets the service request Id. + [WirePath("serviceRequestId")] + public string ServiceRequestId { get; set; } + /// Gets the error response. + internal ErrorResponse Error { get; set; } + /// The error properties. + [WirePath("error.error")] + public ErrorProperties Error + { + get => Error is null ? default(ErrorProperties) : Error.Error; + set + { + if (Error is null) + Error = new ErrorResponse(); + Error.Error = value; + } + } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionCollection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionCollection.Serialization.cs new file mode 100644 index 0000000000000..cc54ab6c45bec --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionCollection.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class RevisionCollection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RevisionCollection)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RevisionCollection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RevisionCollection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRevisionCollection(document.RootElement, options); + } + + internal static RevisionCollection DeserializeRevisionCollection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RevisionData.DeserializeRevisionData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RevisionCollection(value, nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RevisionCollection)} does not support writing '{options.Format}' format."); + } + } + + RevisionCollection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRevisionCollection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RevisionCollection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionCollection.cs new file mode 100644 index 0000000000000..3c0b4b653feb3 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionCollection.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App Revisions collection ARM resource. + internal partial class RevisionCollection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Collection of resources. + /// is null. + internal RevisionCollection(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// Collection of resources. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal RevisionCollection(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RevisionCollection() + { + } + + /// Collection of resources. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionHealthState.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionHealthState.cs new file mode 100644 index 0000000000000..80735487acf06 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionHealthState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Current health State of the revision. + public readonly partial struct RevisionHealthState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RevisionHealthState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HealthyValue = "Healthy"; + private const string UnhealthyValue = "Unhealthy"; + private const string NoneValue = "None"; + + /// Healthy. + public static RevisionHealthState Healthy { get; } = new RevisionHealthState(HealthyValue); + /// Unhealthy. + public static RevisionHealthState Unhealthy { get; } = new RevisionHealthState(UnhealthyValue); + /// None. + public static RevisionHealthState None { get; } = new RevisionHealthState(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(RevisionHealthState left, RevisionHealthState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RevisionHealthState left, RevisionHealthState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RevisionHealthState(string value) => new RevisionHealthState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RevisionHealthState other && Equals(other); + /// + public bool Equals(RevisionHealthState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionProvisioningState.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionProvisioningState.cs new file mode 100644 index 0000000000000..cb0675f16161b --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RevisionProvisioningState.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Current provisioning State of the revision. + public readonly partial struct RevisionProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RevisionProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ProvisioningValue = "Provisioning"; + private const string ProvisionedValue = "Provisioned"; + private const string FailedValue = "Failed"; + private const string DeprovisioningValue = "Deprovisioning"; + private const string DeprovisionedValue = "Deprovisioned"; + + /// Provisioning. + public static RevisionProvisioningState Provisioning { get; } = new RevisionProvisioningState(ProvisioningValue); + /// Provisioned. + public static RevisionProvisioningState Provisioned { get; } = new RevisionProvisioningState(ProvisionedValue); + /// Failed. + public static RevisionProvisioningState Failed { get; } = new RevisionProvisioningState(FailedValue); + /// Deprovisioning. + public static RevisionProvisioningState Deprovisioning { get; } = new RevisionProvisioningState(DeprovisioningValue); + /// Deprovisioned. + public static RevisionProvisioningState Deprovisioned { get; } = new RevisionProvisioningState(DeprovisionedValue); + /// Determines if two values are the same. + public static bool operator ==(RevisionProvisioningState left, RevisionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RevisionProvisioningState left, RevisionProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RevisionProvisioningState(string value) => new RevisionProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RevisionProvisioningState other && Equals(other); + /// + public bool Equals(RevisionProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunActionCorrelation.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunActionCorrelation.Serialization.cs new file mode 100644 index 0000000000000..dadadbacfe65a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunActionCorrelation.Serialization.cs @@ -0,0 +1,259 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class RunActionCorrelation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunActionCorrelation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ActionTrackingId)) + { + writer.WritePropertyName("actionTrackingId"u8); + writer.WriteStringValue(ActionTrackingId); + } + if (Optional.IsDefined(ClientTrackingId)) + { + writer.WritePropertyName("clientTrackingId"u8); + writer.WriteStringValue(ClientTrackingId); + } + if (Optional.IsCollectionDefined(ClientKeywords)) + { + writer.WritePropertyName("clientKeywords"u8); + writer.WriteStartArray(); + foreach (var item in ClientKeywords) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RunActionCorrelation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunActionCorrelation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunActionCorrelation(document.RootElement, options); + } + + internal static RunActionCorrelation DeserializeRunActionCorrelation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string actionTrackingId = default; + string clientTrackingId = default; + IList clientKeywords = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("actionTrackingId"u8)) + { + actionTrackingId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientTrackingId"u8)) + { + clientTrackingId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientKeywords"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + clientKeywords = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunActionCorrelation(clientTrackingId, clientKeywords ?? new ChangeTrackingList(), serializedAdditionalRawData, actionTrackingId); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActionTrackingId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" actionTrackingId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ActionTrackingId)) + { + builder.Append(" actionTrackingId: "); + if (ActionTrackingId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ActionTrackingId}'''"); + } + else + { + builder.AppendLine($"'{ActionTrackingId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClientTrackingId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" clientTrackingId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ClientTrackingId)) + { + builder.Append(" clientTrackingId: "); + if (ClientTrackingId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ClientTrackingId}'''"); + } + else + { + builder.AppendLine($"'{ClientTrackingId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClientKeywords), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" clientKeywords: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ClientKeywords)) + { + if (ClientKeywords.Any()) + { + builder.Append(" clientKeywords: "); + builder.AppendLine("["); + foreach (var item in ClientKeywords) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RunActionCorrelation)} does not support writing '{options.Format}' format."); + } + } + + RunActionCorrelation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRunActionCorrelation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunActionCorrelation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunActionCorrelation.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunActionCorrelation.cs new file mode 100644 index 0000000000000..54e7566539be5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunActionCorrelation.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The workflow run action correlation properties. + public partial class RunActionCorrelation : RunCorrelation + { + /// Initializes a new instance of . + public RunActionCorrelation() + { + } + + /// Initializes a new instance of . + /// The client tracking identifier. + /// The client keywords. + /// Keeps track of any properties unknown to the library. + /// The action tracking identifier. + internal RunActionCorrelation(string clientTrackingId, IList clientKeywords, IDictionary serializedAdditionalRawData, string actionTrackingId) : base(clientTrackingId, clientKeywords, serializedAdditionalRawData) + { + ActionTrackingId = actionTrackingId; + } + + /// The action tracking identifier. + [WirePath("actionTrackingId")] + public string ActionTrackingId { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunCorrelation.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunCorrelation.Serialization.cs new file mode 100644 index 0000000000000..a5de48dfb3249 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunCorrelation.Serialization.cs @@ -0,0 +1,225 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class RunCorrelation : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunCorrelation)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ClientTrackingId)) + { + writer.WritePropertyName("clientTrackingId"u8); + writer.WriteStringValue(ClientTrackingId); + } + if (Optional.IsCollectionDefined(ClientKeywords)) + { + writer.WritePropertyName("clientKeywords"u8); + writer.WriteStartArray(); + foreach (var item in ClientKeywords) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + RunCorrelation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RunCorrelation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRunCorrelation(document.RootElement, options); + } + + internal static RunCorrelation DeserializeRunCorrelation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientTrackingId = default; + IList clientKeywords = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientTrackingId"u8)) + { + clientTrackingId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientKeywords"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + clientKeywords = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RunCorrelation(clientTrackingId, clientKeywords ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClientTrackingId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" clientTrackingId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ClientTrackingId)) + { + builder.Append(" clientTrackingId: "); + if (ClientTrackingId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ClientTrackingId}'''"); + } + else + { + builder.AppendLine($"'{ClientTrackingId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ClientKeywords), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" clientKeywords: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ClientKeywords)) + { + if (ClientKeywords.Any()) + { + builder.Append(" clientKeywords: "); + builder.AppendLine("["); + foreach (var item in ClientKeywords) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(RunCorrelation)} does not support writing '{options.Format}' format."); + } + } + + RunCorrelation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRunCorrelation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RunCorrelation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunCorrelation.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunCorrelation.cs new file mode 100644 index 0000000000000..b85be8088f0a1 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RunCorrelation.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The correlation properties. + public partial class RunCorrelation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public RunCorrelation() + { + ClientKeywords = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The client tracking identifier. + /// The client keywords. + /// Keeps track of any properties unknown to the library. + internal RunCorrelation(string clientTrackingId, IList clientKeywords, IDictionary serializedAdditionalRawData) + { + ClientTrackingId = clientTrackingId; + ClientKeywords = clientKeywords; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The client tracking identifier. + [WirePath("clientTrackingId")] + public string ClientTrackingId { get; set; } + /// The client keywords. + [WirePath("clientKeywords")] + public IList ClientKeywords { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RuntimeName.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RuntimeName.cs new file mode 100644 index 0000000000000..9fe1e93c3529a --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/RuntimeName.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Function app runtime name. Available options: dotnet-isolated, node, java, powershell, python, custom. + public readonly partial struct RuntimeName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RuntimeName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DotnetIsolatedValue = "dotnet-isolated"; + private const string NodeValue = "node"; + private const string JavaValue = "java"; + private const string PowershellValue = "powershell"; + private const string PythonValue = "python"; + private const string CustomValue = "custom"; + + /// dotnet-isolated. + public static RuntimeName DotnetIsolated { get; } = new RuntimeName(DotnetIsolatedValue); + /// node. + public static RuntimeName Node { get; } = new RuntimeName(NodeValue); + /// java. + public static RuntimeName Java { get; } = new RuntimeName(JavaValue); + /// powershell. + public static RuntimeName Powershell { get; } = new RuntimeName(PowershellValue); + /// python. + public static RuntimeName Python { get; } = new RuntimeName(PythonValue); + /// custom. + public static RuntimeName Custom { get; } = new RuntimeName(CustomValue); + /// Determines if two values are the same. + public static bool operator ==(RuntimeName left, RuntimeName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RuntimeName left, RuntimeName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RuntimeName(string value) => new RuntimeName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RuntimeName other && Equals(other); + /// + public bool Equals(RuntimeName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Scale.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Scale.Serialization.cs new file mode 100644 index 0000000000000..dd0f70f94e21f --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Scale.Serialization.cs @@ -0,0 +1,238 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class Scale : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Scale)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(MinReplicas)) + { + writer.WritePropertyName("minReplicas"u8); + writer.WriteNumberValue(MinReplicas.Value); + } + if (Optional.IsDefined(MaxReplicas)) + { + writer.WritePropertyName("maxReplicas"u8); + writer.WriteNumberValue(MaxReplicas.Value); + } + if (Optional.IsCollectionDefined(Rules)) + { + writer.WritePropertyName("rules"u8); + writer.WriteStartArray(); + foreach (var item in Rules) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Scale IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Scale)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScale(document.RootElement, options); + } + + internal static Scale DeserializeScale(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? minReplicas = default; + int? maxReplicas = default; + IList rules = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("minReplicas"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + minReplicas = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("maxReplicas"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + maxReplicas = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("rules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ScaleRule.DeserializeScaleRule(item, options)); + } + rules = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Scale(minReplicas, maxReplicas, rules ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinReplicas), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" minReplicas: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MinReplicas)) + { + builder.Append(" minReplicas: "); + builder.AppendLine($"{MinReplicas.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MaxReplicas), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" maxReplicas: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MaxReplicas)) + { + builder.Append(" maxReplicas: "); + builder.AppendLine($"{MaxReplicas.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Rules), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rules: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Rules)) + { + if (Rules.Any()) + { + builder.Append(" rules: "); + builder.AppendLine("["); + foreach (var item in Rules) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " rules: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Scale)} does not support writing '{options.Format}' format."); + } + } + + Scale IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeScale(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Scale)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Scale.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Scale.cs new file mode 100644 index 0000000000000..e077a78ab5996 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Scale.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App scaling configurations. + public partial class Scale + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Scale() + { + Rules = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Optional. Minimum number of container replicas. + /// Optional. Maximum number of container replicas. Defaults to 10 if not set. + /// Scaling rules. + /// Keeps track of any properties unknown to the library. + internal Scale(int? minReplicas, int? maxReplicas, IList rules, IDictionary serializedAdditionalRawData) + { + MinReplicas = minReplicas; + MaxReplicas = maxReplicas; + Rules = rules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Optional. Minimum number of container replicas. + [WirePath("minReplicas")] + public int? MinReplicas { get; set; } + /// Optional. Maximum number of container replicas. Defaults to 10 if not set. + [WirePath("maxReplicas")] + public int? MaxReplicas { get; set; } + /// Scaling rules. + [WirePath("rules")] + public IList Rules { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRule.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRule.Serialization.cs new file mode 100644 index 0000000000000..cba01badbd4b5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRule.Serialization.cs @@ -0,0 +1,253 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ScaleRule : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ScaleRule)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(AzureQueue)) + { + writer.WritePropertyName("azureQueue"u8); + writer.WriteObjectValue(AzureQueue, options); + } + if (Optional.IsDefined(Custom)) + { + writer.WritePropertyName("custom"u8); + writer.WriteObjectValue(Custom, options); + } + if (Optional.IsDefined(Http)) + { + writer.WritePropertyName("http"u8); + writer.WriteObjectValue(Http, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ScaleRule IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ScaleRule)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScaleRule(document.RootElement, options); + } + + internal static ScaleRule DeserializeScaleRule(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + QueueScaleRule azureQueue = default; + CustomScaleRule custom = default; + HttpScaleRule http = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("azureQueue"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureQueue = QueueScaleRule.DeserializeQueueScaleRule(property.Value, options); + continue; + } + if (property.NameEquals("custom"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + custom = CustomScaleRule.DeserializeCustomScaleRule(property.Value, options); + continue; + } + if (property.NameEquals("http"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + http = HttpScaleRule.DeserializeHttpScaleRule(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScaleRule(name, azureQueue, custom, http, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AzureQueue), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" azureQueue: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AzureQueue)) + { + builder.Append(" azureQueue: "); + BicepSerializationHelpers.AppendChildObject(builder, AzureQueue, options, 2, false, " azureQueue: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Custom), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" custom: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Custom)) + { + builder.Append(" custom: "); + BicepSerializationHelpers.AppendChildObject(builder, Custom, options, 2, false, " custom: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Http), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" http: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Http)) + { + builder.Append(" http: "); + BicepSerializationHelpers.AppendChildObject(builder, Http, options, 2, false, " http: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ScaleRule)} does not support writing '{options.Format}' format."); + } + } + + ScaleRule IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeScaleRule(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScaleRule)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRule.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRule.cs new file mode 100644 index 0000000000000..7e82ef78dd559 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRule.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App container scaling rule. + public partial class ScaleRule + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ScaleRule() + { + } + + /// Initializes a new instance of . + /// Scale Rule Name. + /// Azure Queue based scaling. + /// Custom scale rule. + /// HTTP requests based scaling. + /// Keeps track of any properties unknown to the library. + internal ScaleRule(string name, QueueScaleRule azureQueue, CustomScaleRule custom, HttpScaleRule http, IDictionary serializedAdditionalRawData) + { + Name = name; + AzureQueue = azureQueue; + Custom = custom; + Http = http; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Scale Rule Name. + [WirePath("name")] + public string Name { get; set; } + /// Azure Queue based scaling. + [WirePath("azureQueue")] + public QueueScaleRule AzureQueue { get; set; } + /// Custom scale rule. + [WirePath("custom")] + public CustomScaleRule Custom { get; set; } + /// HTTP requests based scaling. + [WirePath("http")] + public HttpScaleRule Http { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRuleAuth.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRuleAuth.Serialization.cs new file mode 100644 index 0000000000000..be83ef35d0257 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRuleAuth.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class ScaleRuleAuth : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ScaleRuleAuth)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(SecretRef)) + { + writer.WritePropertyName("secretRef"u8); + writer.WriteStringValue(SecretRef); + } + if (Optional.IsDefined(TriggerParameter)) + { + writer.WritePropertyName("triggerParameter"u8); + writer.WriteStringValue(TriggerParameter); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ScaleRuleAuth IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ScaleRuleAuth)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeScaleRuleAuth(document.RootElement, options); + } + + internal static ScaleRuleAuth DeserializeScaleRuleAuth(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string secretRef = default; + string triggerParameter = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretRef"u8)) + { + secretRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("triggerParameter"u8)) + { + triggerParameter = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ScaleRuleAuth(secretRef, triggerParameter, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SecretRef), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" secretRef: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SecretRef)) + { + builder.Append(" secretRef: "); + if (SecretRef.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{SecretRef}'''"); + } + else + { + builder.AppendLine($"'{SecretRef}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TriggerParameter), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" triggerParameter: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TriggerParameter)) + { + builder.Append(" triggerParameter: "); + if (TriggerParameter.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{TriggerParameter}'''"); + } + else + { + builder.AppendLine($"'{TriggerParameter}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(ScaleRuleAuth)} does not support writing '{options.Format}' format."); + } + } + + ScaleRuleAuth IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeScaleRuleAuth(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ScaleRuleAuth)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRuleAuth.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRuleAuth.cs new file mode 100644 index 0000000000000..f6491247bd799 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/ScaleRuleAuth.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Auth Secrets for Container App Scale Rule. + public partial class ScaleRuleAuth + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ScaleRuleAuth() + { + } + + /// Initializes a new instance of . + /// Name of the Container App secret from which to pull the auth params. + /// Trigger Parameter that uses the secret. + /// Keeps track of any properties unknown to the library. + internal ScaleRuleAuth(string secretRef, string triggerParameter, IDictionary serializedAdditionalRawData) + { + SecretRef = secretRef; + TriggerParameter = triggerParameter; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of the Container App secret from which to pull the auth params. + [WirePath("secretRef")] + public string SecretRef { get; set; } + /// Trigger Parameter that uses the secret. + [WirePath("triggerParameter")] + public string TriggerParameter { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Secret.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Secret.Serialization.cs new file mode 100644 index 0000000000000..dfd8efee28410 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Secret.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class Secret : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Secret)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Secret IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Secret)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecret(document.RootElement, options); + } + + internal static Secret DeserializeSecret(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Secret(name, value, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(Secret)} does not support writing '{options.Format}' format."); + } + } + + Secret IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSecret(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Secret)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Secret.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Secret.cs new file mode 100644 index 0000000000000..93daec48b6f42 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Secret.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App Secret. + public partial class Secret + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Secret() + { + } + + /// Initializes a new instance of . + /// Secret Name. + /// Secret Value. + /// Keeps track of any properties unknown to the library. + internal Secret(string name, string value, IDictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Secret Name. + [WirePath("name")] + public string Name { get; set; } + /// Secret Value. + [WirePath("value")] + public string Value { get; set; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SecretsCollection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SecretsCollection.Serialization.cs new file mode 100644 index 0000000000000..7ec800f7235f4 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SecretsCollection.Serialization.cs @@ -0,0 +1,171 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class SecretsCollection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecretsCollection)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SecretsCollection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SecretsCollection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretsCollection(document.RootElement, options); + } + + internal static SecretsCollection DeserializeSecretsCollection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ContainerAppSecret.DeserializeContainerAppSecret(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretsCollection(value, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SecretsCollection)} does not support writing '{options.Format}' format."); + } + } + + SecretsCollection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSecretsCollection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretsCollection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SecretsCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SecretsCollection.cs new file mode 100644 index 0000000000000..5d83f172c91ca --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SecretsCollection.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Container App Secrets Collection ARM resource. + internal partial class SecretsCollection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Collection of resources. + /// is null. + internal SecretsCollection(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// Collection of resources. + /// Keeps track of any properties unknown to the library. + internal SecretsCollection(IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretsCollection() + { + } + + /// Collection of resources. + [WirePath("value")] + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteAuthSettings.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteAuthSettings.cs index 6b5fbbbaddb01..43ef6b8d9e830 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteAuthSettings.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteAuthSettings.cs @@ -113,7 +113,7 @@ public SiteAuthSettings() /// /// Gets a value indicating whether the issuer should be a valid HTTPS url and be validated as such. /// - /// Allowed audience values to consider when validating JWTs issued by + /// Allowed audience values to consider when validating JSON Web Tokens issued by /// Azure Active Directory. Note that the <code>ClientID</code> value is always considered an /// allowed audience, regardless of this setting. /// @@ -339,7 +339,7 @@ internal SiteAuthSettings(ResourceIdentifier id, string name, ResourceType resou [WirePath("properties.validateIssuer")] public bool? ValidateIssuer { get; set; } /// - /// Allowed audience values to consider when validating JWTs issued by + /// Allowed audience values to consider when validating JSON Web Tokens issued by /// Azure Active Directory. Note that the <code>ClientID</code> value is always considered an /// allowed audience, regardless of this setting. /// diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteConfigProperties.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteConfigProperties.Serialization.cs index ea73c6537fdf9..226512dc4391e 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteConfigProperties.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteConfigProperties.Serialization.cs @@ -278,6 +278,23 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr writer.WriteNull("appSettings"); } } + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata != null) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartArray(); + foreach (var item in Metadata) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + else + { + writer.WriteNull("metadata"); + } + } if (Optional.IsCollectionDefined(ConnectionStrings)) { if (ConnectionStrings != null) @@ -694,6 +711,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr writer.WriteNull("ipSecurityRestrictions"); } } + if (Optional.IsDefined(IPSecurityRestrictionsDefaultAction)) + { + if (IPSecurityRestrictionsDefaultAction != null) + { + writer.WritePropertyName("ipSecurityRestrictionsDefaultAction"u8); + writer.WriteStringValue(IPSecurityRestrictionsDefaultAction.Value.ToString()); + } + else + { + writer.WriteNull("ipSecurityRestrictionsDefaultAction"); + } + } if (Optional.IsCollectionDefined(ScmIPSecurityRestrictions)) { if (ScmIPSecurityRestrictions != null) @@ -711,6 +740,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr writer.WriteNull("scmIpSecurityRestrictions"); } } + if (Optional.IsDefined(ScmIPSecurityRestrictionsDefaultAction)) + { + if (ScmIPSecurityRestrictionsDefaultAction != null) + { + writer.WritePropertyName("scmIpSecurityRestrictionsDefaultAction"u8); + writer.WriteStringValue(ScmIPSecurityRestrictionsDefaultAction.Value.ToString()); + } + else + { + writer.WriteNull("scmIpSecurityRestrictionsDefaultAction"); + } + } if (Optional.IsDefined(AllowIPSecurityRestrictionsForScmToUseMain)) { if (AllowIPSecurityRestrictionsForScmToUseMain != null) @@ -747,6 +788,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr writer.WriteNull("minTlsVersion"); } } + if (Optional.IsDefined(MinTlsCipherSuite)) + { + if (MinTlsCipherSuite != null) + { + writer.WritePropertyName("minTlsCipherSuite"u8); + writer.WriteStringValue(MinTlsCipherSuite.Value.ToString()); + } + else + { + writer.WriteNull("minTlsCipherSuite"); + } + } if (Optional.IsDefined(ScmMinTlsVersion)) { if (ScmMinTlsVersion != null) @@ -795,6 +848,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr writer.WriteNull("functionAppScaleLimit"); } } + if (Optional.IsDefined(ElasticWebAppScaleLimit)) + { + if (ElasticWebAppScaleLimit != null) + { + writer.WritePropertyName("elasticWebAppScaleLimit"u8); + writer.WriteNumberValue(ElasticWebAppScaleLimit.Value); + } + else + { + writer.WriteNull("elasticWebAppScaleLimit"); + } + } if (Optional.IsDefined(HealthCheckPath)) { if (HealthCheckPath != null) @@ -931,6 +996,7 @@ internal static SiteConfigProperties DeserializeSiteConfigProperties(JsonElement bool? detailedErrorLoggingEnabled = default; string publishingUsername = default; IList appSettings = default; + IList metadata = default; IList connectionStrings = default; SiteMachineKey machineKey = default; IList handlerMappings = default; @@ -964,14 +1030,18 @@ internal static SiteConfigProperties DeserializeSiteConfigProperties(JsonElement int? xManagedServiceIdentityId = default; string keyVaultReferenceIdentity = default; IList ipSecurityRestrictions = default; + DefaultAction? ipSecurityRestrictionsDefaultAction = default; IList scmIPSecurityRestrictions = default; + DefaultAction? scmIPSecurityRestrictionsDefaultAction = default; bool? scmIPSecurityRestrictionsUseMain = default; bool? http20Enabled = default; AppServiceSupportedTlsVersion? minTlsVersion = default; + TlsCipherSuite? minTlsCipherSuite = default; AppServiceSupportedTlsVersion? scmMinTlsVersion = default; AppServiceFtpsState? ftpsState = default; int? preWarmedInstanceCount = default; int? functionAppScaleLimit = default; + int? elasticWebAppScaleLimit = default; string healthCheckPath = default; bool? functionsRuntimeScaleMonitoringEnabled = default; string websiteTimeZone = default; @@ -1192,6 +1262,21 @@ internal static SiteConfigProperties DeserializeSiteConfigProperties(JsonElement appSettings = array; continue; } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + metadata = null; + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AppServiceNameValuePair.DeserializeAppServiceNameValuePair(item, options)); + } + metadata = array; + continue; + } if (property.NameEquals("connectionStrings"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -1542,6 +1627,16 @@ internal static SiteConfigProperties DeserializeSiteConfigProperties(JsonElement ipSecurityRestrictions = array; continue; } + if (property.NameEquals("ipSecurityRestrictionsDefaultAction"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + ipSecurityRestrictionsDefaultAction = null; + continue; + } + ipSecurityRestrictionsDefaultAction = new DefaultAction(property.Value.GetString()); + continue; + } if (property.NameEquals("scmIpSecurityRestrictions"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -1557,6 +1652,16 @@ internal static SiteConfigProperties DeserializeSiteConfigProperties(JsonElement scmIPSecurityRestrictions = array; continue; } + if (property.NameEquals("scmIpSecurityRestrictionsDefaultAction"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + scmIPSecurityRestrictionsDefaultAction = null; + continue; + } + scmIPSecurityRestrictionsDefaultAction = new DefaultAction(property.Value.GetString()); + continue; + } if (property.NameEquals("scmIpSecurityRestrictionsUseMain"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -1587,6 +1692,16 @@ internal static SiteConfigProperties DeserializeSiteConfigProperties(JsonElement minTlsVersion = new AppServiceSupportedTlsVersion(property.Value.GetString()); continue; } + if (property.NameEquals("minTlsCipherSuite"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + minTlsCipherSuite = null; + continue; + } + minTlsCipherSuite = new TlsCipherSuite(property.Value.GetString()); + continue; + } if (property.NameEquals("scmMinTlsVersion"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -1627,6 +1742,16 @@ internal static SiteConfigProperties DeserializeSiteConfigProperties(JsonElement functionAppScaleLimit = property.Value.GetInt32(); continue; } + if (property.NameEquals("elasticWebAppScaleLimit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + elasticWebAppScaleLimit = null; + continue; + } + elasticWebAppScaleLimit = property.Value.GetInt32(); + continue; + } if (property.NameEquals("healthCheckPath"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -1719,6 +1844,7 @@ internal static SiteConfigProperties DeserializeSiteConfigProperties(JsonElement detailedErrorLoggingEnabled, publishingUsername, appSettings ?? new ChangeTrackingList(), + metadata ?? new ChangeTrackingList(), connectionStrings ?? new ChangeTrackingList(), machineKey, handlerMappings ?? new ChangeTrackingList(), @@ -1752,14 +1878,18 @@ internal static SiteConfigProperties DeserializeSiteConfigProperties(JsonElement xManagedServiceIdentityId, keyVaultReferenceIdentity, ipSecurityRestrictions ?? new ChangeTrackingList(), + ipSecurityRestrictionsDefaultAction, scmIPSecurityRestrictions ?? new ChangeTrackingList(), + scmIPSecurityRestrictionsDefaultAction, scmIPSecurityRestrictionsUseMain, http20Enabled, minTlsVersion, + minTlsCipherSuite, scmMinTlsVersion, ftpsState, preWarmedInstanceCount, functionAppScaleLimit, + elasticWebAppScaleLimit, healthCheckPath, functionsRuntimeScaleMonitoringEnabled, websiteTimeZone, @@ -2195,6 +2325,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Metadata), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" metadata: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Metadata)) + { + if (Metadata.Any()) + { + builder.Append(" metadata: "); + builder.AppendLine("["); + foreach (var item in Metadata) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " metadata: "); + } + builder.AppendLine(" ]"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConnectionStrings), out propertyOverride); if (hasPropertyOverride) { @@ -2809,6 +2962,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IPSecurityRestrictionsDefaultAction), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" ipSecurityRestrictionsDefaultAction: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IPSecurityRestrictionsDefaultAction)) + { + builder.Append(" ipSecurityRestrictionsDefaultAction: "); + builder.AppendLine($"'{IPSecurityRestrictionsDefaultAction.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScmIPSecurityRestrictions), out propertyOverride); if (hasPropertyOverride) { @@ -2832,6 +3000,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScmIPSecurityRestrictionsDefaultAction), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" scmIpSecurityRestrictionsDefaultAction: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ScmIPSecurityRestrictionsDefaultAction)) + { + builder.Append(" scmIpSecurityRestrictionsDefaultAction: "); + builder.AppendLine($"'{ScmIPSecurityRestrictionsDefaultAction.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AllowIPSecurityRestrictionsForScmToUseMain), out propertyOverride); if (hasPropertyOverride) { @@ -2879,6 +3062,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(MinTlsCipherSuite), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" minTlsCipherSuite: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(MinTlsCipherSuite)) + { + builder.Append(" minTlsCipherSuite: "); + builder.AppendLine($"'{MinTlsCipherSuite.Value.ToString()}'"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ScmMinTlsVersion), out propertyOverride); if (hasPropertyOverride) { @@ -2939,6 +3137,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ElasticWebAppScaleLimit), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" elasticWebAppScaleLimit: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ElasticWebAppScaleLimit)) + { + builder.Append(" elasticWebAppScaleLimit: "); + builder.AppendLine($"{ElasticWebAppScaleLimit.Value}"); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(HealthCheckPath), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteConfigProperties.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteConfigProperties.cs index 7279f3b43e837..51739f4e0af4a 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteConfigProperties.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteConfigProperties.cs @@ -50,6 +50,7 @@ public SiteConfigProperties() { DefaultDocuments = new ChangeTrackingList(); AppSettings = new ChangeTrackingList(); + Metadata = new ChangeTrackingList(); ConnectionStrings = new ChangeTrackingList(); HandlerMappings = new ChangeTrackingList(); VirtualApplications = new ChangeTrackingList(); @@ -79,6 +80,7 @@ public SiteConfigProperties() /// <code>true</code> if detailed error logging is enabled; otherwise, <code>false</code>. /// Publishing user name. /// Application settings. + /// Application metadata. This property cannot be retrieved, since it may contain secrets. /// Connection strings. /// Site MachineKey. /// Handler mappings. @@ -112,10 +114,13 @@ public SiteConfigProperties() /// Explicit Managed Service Identity Id. /// Identity to use for Key Vault Reference authentication. /// IP security restrictions for main. + /// Default action for main access restriction if no rules are matched. /// IP security restrictions for scm. + /// Default action for scm access restriction if no rules are matched. /// IP security restrictions for scm to use main. /// Http20Enabled: configures a web site to allow clients to connect over http2.0. /// MinTlsVersion: configures the minimum version of TLS required for SSL requests. + /// The minimum strength TLS cipher suite allowed for an application. /// ScmMinTlsVersion: configures the minimum version of TLS required for SSL requests for SCM site. /// State of FTP / FTPS service. /// @@ -126,6 +131,10 @@ public SiteConfigProperties() /// Maximum number of workers that a site can scale out to. /// This setting only applies to the Consumption and Elastic Premium Plans /// + /// + /// Maximum number of workers that a site can scale out to. + /// This setting only applies to apps in plans where ElasticScaleEnabled is <code>true</code> + /// /// Health check path. /// /// Gets or sets a value indicating whether functions runtime scale monitoring is enabled. When enabled, @@ -140,7 +149,7 @@ public SiteConfigProperties() /// List of Azure Storage Accounts. /// Property to allow or block all public traffic. /// Keeps track of any properties unknown to the library. - internal SiteConfigProperties(int? numberOfWorkers, IList defaultDocuments, string netFrameworkVersion, string phpVersion, string pythonVersion, string nodeVersion, string powerShellVersion, string linuxFxVersion, string windowsFxVersion, bool? isRequestTracingEnabled, DateTimeOffset? requestTracingExpirationOn, bool? isRemoteDebuggingEnabled, string remoteDebuggingVersion, bool? isHttpLoggingEnabled, bool? useManagedIdentityCreds, string acrUserManagedIdentityId, int? logsDirectorySizeLimit, bool? isDetailedErrorLoggingEnabled, string publishingUsername, IList appSettings, IList connectionStrings, SiteMachineKey machineKey, IList handlerMappings, string documentRoot, ScmType? scmType, bool? use32BitWorkerProcess, bool? isWebSocketsEnabled, bool? isAlwaysOn, string javaVersion, string javaContainer, string javaContainerVersion, string appCommandLine, ManagedPipelineMode? managedPipelineMode, IList virtualApplications, SiteLoadBalancing? loadBalancing, RoutingRuleExperiments experiments, SiteLimits limits, bool? isAutoHealEnabled, AutoHealRules autoHealRules, string tracingOptions, string vnetName, bool? isVnetRouteAllEnabled, int? vnetPrivatePortsCount, AppServiceCorsSettings cors, WebAppPushSettings push, AppServiceApiDefinitionInfo apiDefinition, ApiManagementConfig apiManagementConfig, string autoSwapSlotName, bool? isLocalMySqlEnabled, int? managedServiceIdentityId, int? xManagedServiceIdentityId, string keyVaultReferenceIdentity, IList ipSecurityRestrictions, IList scmIPSecurityRestrictions, bool? allowIPSecurityRestrictionsForScmToUseMain, bool? isHttp20Enabled, AppServiceSupportedTlsVersion? minTlsVersion, AppServiceSupportedTlsVersion? scmMinTlsVersion, AppServiceFtpsState? ftpsState, int? preWarmedInstanceCount, int? functionAppScaleLimit, string healthCheckPath, bool? isFunctionsRuntimeScaleMonitoringEnabled, string websiteTimeZone, int? minimumElasticInstanceCount, IDictionary azureStorageAccounts, string publicNetworkAccess, IDictionary serializedAdditionalRawData) + internal SiteConfigProperties(int? numberOfWorkers, IList defaultDocuments, string netFrameworkVersion, string phpVersion, string pythonVersion, string nodeVersion, string powerShellVersion, string linuxFxVersion, string windowsFxVersion, bool? isRequestTracingEnabled, DateTimeOffset? requestTracingExpirationOn, bool? isRemoteDebuggingEnabled, string remoteDebuggingVersion, bool? isHttpLoggingEnabled, bool? useManagedIdentityCreds, string acrUserManagedIdentityId, int? logsDirectorySizeLimit, bool? isDetailedErrorLoggingEnabled, string publishingUsername, IList appSettings, IList metadata, IList connectionStrings, SiteMachineKey machineKey, IList handlerMappings, string documentRoot, ScmType? scmType, bool? use32BitWorkerProcess, bool? isWebSocketsEnabled, bool? isAlwaysOn, string javaVersion, string javaContainer, string javaContainerVersion, string appCommandLine, ManagedPipelineMode? managedPipelineMode, IList virtualApplications, SiteLoadBalancing? loadBalancing, RoutingRuleExperiments experiments, SiteLimits limits, bool? isAutoHealEnabled, AutoHealRules autoHealRules, string tracingOptions, string vnetName, bool? isVnetRouteAllEnabled, int? vnetPrivatePortsCount, AppServiceCorsSettings cors, WebAppPushSettings push, AppServiceApiDefinitionInfo apiDefinition, ApiManagementConfig apiManagementConfig, string autoSwapSlotName, bool? isLocalMySqlEnabled, int? managedServiceIdentityId, int? xManagedServiceIdentityId, string keyVaultReferenceIdentity, IList ipSecurityRestrictions, DefaultAction? ipSecurityRestrictionsDefaultAction, IList scmIPSecurityRestrictions, DefaultAction? scmIPSecurityRestrictionsDefaultAction, bool? allowIPSecurityRestrictionsForScmToUseMain, bool? isHttp20Enabled, AppServiceSupportedTlsVersion? minTlsVersion, TlsCipherSuite? minTlsCipherSuite, AppServiceSupportedTlsVersion? scmMinTlsVersion, AppServiceFtpsState? ftpsState, int? preWarmedInstanceCount, int? functionAppScaleLimit, int? elasticWebAppScaleLimit, string healthCheckPath, bool? isFunctionsRuntimeScaleMonitoringEnabled, string websiteTimeZone, int? minimumElasticInstanceCount, IDictionary azureStorageAccounts, string publicNetworkAccess, IDictionary serializedAdditionalRawData) { NumberOfWorkers = numberOfWorkers; DefaultDocuments = defaultDocuments; @@ -162,6 +171,7 @@ internal SiteConfigProperties(int? numberOfWorkers, IList defaultDocumen IsDetailedErrorLoggingEnabled = isDetailedErrorLoggingEnabled; PublishingUsername = publishingUsername; AppSettings = appSettings; + Metadata = metadata; ConnectionStrings = connectionStrings; MachineKey = machineKey; HandlerMappings = handlerMappings; @@ -195,14 +205,18 @@ internal SiteConfigProperties(int? numberOfWorkers, IList defaultDocumen XManagedServiceIdentityId = xManagedServiceIdentityId; KeyVaultReferenceIdentity = keyVaultReferenceIdentity; IPSecurityRestrictions = ipSecurityRestrictions; + IPSecurityRestrictionsDefaultAction = ipSecurityRestrictionsDefaultAction; ScmIPSecurityRestrictions = scmIPSecurityRestrictions; + ScmIPSecurityRestrictionsDefaultAction = scmIPSecurityRestrictionsDefaultAction; AllowIPSecurityRestrictionsForScmToUseMain = allowIPSecurityRestrictionsForScmToUseMain; IsHttp20Enabled = isHttp20Enabled; MinTlsVersion = minTlsVersion; + MinTlsCipherSuite = minTlsCipherSuite; ScmMinTlsVersion = scmMinTlsVersion; FtpsState = ftpsState; PreWarmedInstanceCount = preWarmedInstanceCount; FunctionAppScaleLimit = functionAppScaleLimit; + ElasticWebAppScaleLimit = elasticWebAppScaleLimit; HealthCheckPath = healthCheckPath; IsFunctionsRuntimeScaleMonitoringEnabled = isFunctionsRuntimeScaleMonitoringEnabled; WebsiteTimeZone = websiteTimeZone; @@ -272,6 +286,9 @@ internal SiteConfigProperties(int? numberOfWorkers, IList defaultDocumen /// Application settings. [WirePath("appSettings")] public IList AppSettings { get; set; } + /// Application metadata. This property cannot be retrieved, since it may contain secrets. + [WirePath("metadata")] + public IList Metadata { get; set; } /// Connection strings. [WirePath("connectionStrings")] public IList ConnectionStrings { get; set; } @@ -406,9 +423,15 @@ public string ApiManagementConfigId /// IP security restrictions for main. [WirePath("ipSecurityRestrictions")] public IList IPSecurityRestrictions { get; set; } + /// Default action for main access restriction if no rules are matched. + [WirePath("ipSecurityRestrictionsDefaultAction")] + public DefaultAction? IPSecurityRestrictionsDefaultAction { get; set; } /// IP security restrictions for scm. [WirePath("scmIpSecurityRestrictions")] public IList ScmIPSecurityRestrictions { get; set; } + /// Default action for scm access restriction if no rules are matched. + [WirePath("scmIpSecurityRestrictionsDefaultAction")] + public DefaultAction? ScmIPSecurityRestrictionsDefaultAction { get; set; } /// IP security restrictions for scm to use main. [WirePath("scmIpSecurityRestrictionsUseMain")] public bool? AllowIPSecurityRestrictionsForScmToUseMain { get; set; } @@ -418,6 +441,9 @@ public string ApiManagementConfigId /// MinTlsVersion: configures the minimum version of TLS required for SSL requests. [WirePath("minTlsVersion")] public AppServiceSupportedTlsVersion? MinTlsVersion { get; set; } + /// The minimum strength TLS cipher suite allowed for an application. + [WirePath("minTlsCipherSuite")] + public TlsCipherSuite? MinTlsCipherSuite { get; set; } /// ScmMinTlsVersion: configures the minimum version of TLS required for SSL requests for SCM site. [WirePath("scmMinTlsVersion")] public AppServiceSupportedTlsVersion? ScmMinTlsVersion { get; set; } @@ -436,6 +462,12 @@ public string ApiManagementConfigId /// [WirePath("functionAppScaleLimit")] public int? FunctionAppScaleLimit { get; set; } + /// + /// Maximum number of workers that a site can scale out to. + /// This setting only applies to apps in plans where ElasticScaleEnabled is <code>true</code> + /// + [WirePath("elasticWebAppScaleLimit")] + public int? ElasticWebAppScaleLimit { get; set; } /// Health check path. [WirePath("healthCheckPath")] public string HealthCheckPath { get; set; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteContainerCollection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteContainerCollection.Serialization.cs new file mode 100644 index 0000000000000..b8375ab31b27c --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteContainerCollection.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class SiteContainerCollection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SiteContainerCollection)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SiteContainerCollection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SiteContainerCollection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSiteContainerCollection(document.RootElement, options); + } + + internal static SiteContainerCollection DeserializeSiteContainerCollection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SiteContainerData.DeserializeSiteContainerData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SiteContainerCollection(value, nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SiteContainerCollection)} does not support writing '{options.Format}' format."); + } + } + + SiteContainerCollection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSiteContainerCollection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SiteContainerCollection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteContainerCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteContainerCollection.cs new file mode 100644 index 0000000000000..3def47fb38b9e --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteContainerCollection.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Collection of site containers. + internal partial class SiteContainerCollection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Collection of resources. + /// is null. + internal SiteContainerCollection(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// Collection of resources. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal SiteContainerCollection(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SiteContainerCollection() + { + } + + /// Collection of resources. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteDnsConfig.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteDnsConfig.Serialization.cs new file mode 100644 index 0000000000000..8c194de2c8d83 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteDnsConfig.Serialization.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class SiteDnsConfig : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SiteDnsConfig)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(DnsServers)) + { + writer.WritePropertyName("dnsServers"u8); + writer.WriteStartArray(); + foreach (var item in DnsServers) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DnsAltServer)) + { + writer.WritePropertyName("dnsAltServer"u8); + writer.WriteStringValue(DnsAltServer); + } + if (Optional.IsDefined(DnsRetryAttemptTimeout)) + { + writer.WritePropertyName("dnsRetryAttemptTimeout"u8); + writer.WriteNumberValue(DnsRetryAttemptTimeout.Value); + } + if (Optional.IsDefined(DnsRetryAttemptCount)) + { + writer.WritePropertyName("dnsRetryAttemptCount"u8); + writer.WriteNumberValue(DnsRetryAttemptCount.Value); + } + if (Optional.IsDefined(DnsMaxCacheTimeout)) + { + writer.WritePropertyName("dnsMaxCacheTimeout"u8); + writer.WriteNumberValue(DnsMaxCacheTimeout.Value); + } + if (options.Format != "W" && Optional.IsDefined(DnsLegacySortOrder)) + { + writer.WritePropertyName("dnsLegacySortOrder"u8); + writer.WriteBooleanValue(DnsLegacySortOrder.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SiteDnsConfig IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SiteDnsConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSiteDnsConfig(document.RootElement, options); + } + + internal static SiteDnsConfig DeserializeSiteDnsConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList dnsServers = default; + string dnsAltServer = default; + int? dnsRetryAttemptTimeout = default; + int? dnsRetryAttemptCount = default; + int? dnsMaxCacheTimeout = default; + bool? dnsLegacySortOrder = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("dnsServers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dnsServers = array; + continue; + } + if (property.NameEquals("dnsAltServer"u8)) + { + dnsAltServer = property.Value.GetString(); + continue; + } + if (property.NameEquals("dnsRetryAttemptTimeout"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsRetryAttemptTimeout = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("dnsRetryAttemptCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsRetryAttemptCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("dnsMaxCacheTimeout"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsMaxCacheTimeout = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("dnsLegacySortOrder"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsLegacySortOrder = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SiteDnsConfig( + dnsServers ?? new ChangeTrackingList(), + dnsAltServer, + dnsRetryAttemptTimeout, + dnsRetryAttemptCount, + dnsMaxCacheTimeout, + dnsLegacySortOrder, + serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsServers), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsServers: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(DnsServers)) + { + if (DnsServers.Any()) + { + builder.Append(" dnsServers: "); + builder.AppendLine("["); + foreach (var item in DnsServers) + { + if (item == null) + { + builder.Append("null"); + continue; + } + if (item.Contains(Environment.NewLine)) + { + builder.AppendLine(" '''"); + builder.AppendLine($"{item}'''"); + } + else + { + builder.AppendLine($" '{item}'"); + } + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsAltServer), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsAltServer: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DnsAltServer)) + { + builder.Append(" dnsAltServer: "); + if (DnsAltServer.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{DnsAltServer}'''"); + } + else + { + builder.AppendLine($"'{DnsAltServer}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsRetryAttemptTimeout), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsRetryAttemptTimeout: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DnsRetryAttemptTimeout)) + { + builder.Append(" dnsRetryAttemptTimeout: "); + builder.AppendLine($"{DnsRetryAttemptTimeout.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsRetryAttemptCount), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsRetryAttemptCount: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DnsRetryAttemptCount)) + { + builder.Append(" dnsRetryAttemptCount: "); + builder.AppendLine($"{DnsRetryAttemptCount.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsMaxCacheTimeout), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsMaxCacheTimeout: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DnsMaxCacheTimeout)) + { + builder.Append(" dnsMaxCacheTimeout: "); + builder.AppendLine($"{DnsMaxCacheTimeout.Value}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsLegacySortOrder), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsLegacySortOrder: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DnsLegacySortOrder)) + { + builder.Append(" dnsLegacySortOrder: "); + var boolValue = DnsLegacySortOrder.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(SiteDnsConfig)} does not support writing '{options.Format}' format."); + } + } + + SiteDnsConfig IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSiteDnsConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SiteDnsConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteDnsConfig.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteDnsConfig.cs new file mode 100644 index 0000000000000..9d472159cbf55 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteDnsConfig.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// The SiteDnsConfig. + public partial class SiteDnsConfig + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SiteDnsConfig() + { + DnsServers = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// List of custom DNS servers to be used by an app for lookups. Maximum 5 dns servers can be set. + /// Alternate DNS server to be used by apps. This property replicates the WEBSITE_DNS_ALT_SERVER app setting. + /// Timeout for a single dns lookup in seconds. Allowed range: 1-30. Default is 3. + /// Total number of retries for dns lookup. Allowed range: 1-5. Default is 3. + /// Custom time for DNS to be cached in seconds. Allowed range: 0-60. Default is 30 seconds. 0 means caching disabled. + /// Indicates that sites using Virtual network custom DNS servers are still sorting the list of DNS servers. Read-Only. + /// Keeps track of any properties unknown to the library. + internal SiteDnsConfig(IList dnsServers, string dnsAltServer, int? dnsRetryAttemptTimeout, int? dnsRetryAttemptCount, int? dnsMaxCacheTimeout, bool? dnsLegacySortOrder, IDictionary serializedAdditionalRawData) + { + DnsServers = dnsServers; + DnsAltServer = dnsAltServer; + DnsRetryAttemptTimeout = dnsRetryAttemptTimeout; + DnsRetryAttemptCount = dnsRetryAttemptCount; + DnsMaxCacheTimeout = dnsMaxCacheTimeout; + DnsLegacySortOrder = dnsLegacySortOrder; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// List of custom DNS servers to be used by an app for lookups. Maximum 5 dns servers can be set. + [WirePath("dnsServers")] + public IList DnsServers { get; } + /// Alternate DNS server to be used by apps. This property replicates the WEBSITE_DNS_ALT_SERVER app setting. + [WirePath("dnsAltServer")] + public string DnsAltServer { get; set; } + /// Timeout for a single dns lookup in seconds. Allowed range: 1-30. Default is 3. + [WirePath("dnsRetryAttemptTimeout")] + public int? DnsRetryAttemptTimeout { get; set; } + /// Total number of retries for dns lookup. Allowed range: 1-5. Default is 3. + [WirePath("dnsRetryAttemptCount")] + public int? DnsRetryAttemptCount { get; set; } + /// Custom time for DNS to be cached in seconds. Allowed range: 0-60. Default is 30 seconds. 0 means caching disabled. + [WirePath("dnsMaxCacheTimeout")] + public int? DnsMaxCacheTimeout { get; set; } + /// Indicates that sites using Virtual network custom DNS servers are still sorting the list of DNS servers. Read-Only. + [WirePath("dnsLegacySortOrder")] + public bool? DnsLegacySortOrder { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteLoadBalancing.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteLoadBalancing.Serialization.cs index 413326008b218..0838463f150fd 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteLoadBalancing.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteLoadBalancing.Serialization.cs @@ -19,6 +19,7 @@ internal static partial class SiteLoadBalancingExtensions SiteLoadBalancing.WeightedTotalTraffic => "WeightedTotalTraffic", SiteLoadBalancing.RequestHash => "RequestHash", SiteLoadBalancing.PerSiteRoundRobin => "PerSiteRoundRobin", + SiteLoadBalancing.LeastRequestsWithTieBreaker => "LeastRequestsWithTieBreaker", _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SiteLoadBalancing value.") }; @@ -30,6 +31,7 @@ public static SiteLoadBalancing ToSiteLoadBalancing(this string value) if (StringComparer.OrdinalIgnoreCase.Equals(value, "WeightedTotalTraffic")) return SiteLoadBalancing.WeightedTotalTraffic; if (StringComparer.OrdinalIgnoreCase.Equals(value, "RequestHash")) return SiteLoadBalancing.RequestHash; if (StringComparer.OrdinalIgnoreCase.Equals(value, "PerSiteRoundRobin")) return SiteLoadBalancing.PerSiteRoundRobin; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "LeastRequestsWithTieBreaker")) return SiteLoadBalancing.LeastRequestsWithTieBreaker; throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown SiteLoadBalancing value."); } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteLoadBalancing.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteLoadBalancing.cs index 1ecabc3b60cb9..e8a902bf1804f 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteLoadBalancing.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SiteLoadBalancing.cs @@ -21,6 +21,8 @@ public enum SiteLoadBalancing /// RequestHash. RequestHash, /// PerSiteRoundRobin. - PerSiteRoundRobin + PerSiteRoundRobin, + /// LeastRequestsWithTieBreaker. + LeastRequestsWithTieBreaker } } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SitePatchInfo.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SitePatchInfo.Serialization.cs index 52f2db0769ec7..350b7da3c95e4 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SitePatchInfo.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SitePatchInfo.Serialization.cs @@ -141,6 +141,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpt writer.WritePropertyName("lastModifiedTimeUtc"u8); writer.WriteStringValue(LastModifiedOn.Value, "O"); } + if (Optional.IsDefined(DnsConfiguration)) + { + writer.WritePropertyName("dnsConfiguration"u8); + writer.WriteObjectValue(DnsConfiguration, options); + } if (Optional.IsDefined(SiteConfig)) { writer.WritePropertyName("siteConfig"u8); @@ -344,6 +349,7 @@ internal static SitePatchInfo DeserializeSitePatchInfo(JsonElement element, Mode bool? isXenon = default; bool? hyperV = default; DateTimeOffset? lastModifiedTimeUtc = default; + SiteDnsConfig dnsConfiguration = default; SiteConfigProperties siteConfig = default; IReadOnlyList trafficManagerHostNames = default; bool? scmSiteAlsoStopped = default; @@ -547,6 +553,15 @@ internal static SitePatchInfo DeserializeSitePatchInfo(JsonElement element, Mode lastModifiedTimeUtc = property0.Value.GetDateTimeOffset("O"); continue; } + if (property0.NameEquals("dnsConfiguration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dnsConfiguration = SiteDnsConfig.DeserializeSiteDnsConfig(property0.Value, options); + continue; + } if (property0.NameEquals("siteConfig"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -800,6 +815,7 @@ internal static SitePatchInfo DeserializeSitePatchInfo(JsonElement element, Mode isXenon, hyperV, lastModifiedTimeUtc, + dnsConfiguration, siteConfig, trafficManagerHostNames ?? new ChangeTrackingList(), scmSiteAlsoStopped, @@ -1202,6 +1218,21 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DnsConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" dnsConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(DnsConfiguration)) + { + builder.Append(" dnsConfiguration: "); + BicepSerializationHelpers.AppendChildObject(builder, DnsConfiguration, options, 4, false, " dnsConfiguration: "); + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SiteConfig), out propertyOverride); if (hasPropertyOverride) { diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SitePatchInfo.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SitePatchInfo.cs index 1e83277912077..a8dfcea222233 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SitePatchInfo.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/SitePatchInfo.cs @@ -78,6 +78,7 @@ public SitePatchInfo() /// Obsolete: Hyper-V sandbox. /// Hyper-V sandbox. /// Last time the app was modified, in UTC. Read-only. + /// Property to configure various DNS related settings for a site. /// Configuration of the app. /// Azure Traffic Manager hostnames associated with the app. Read-only. /// <code>true</code> to stop SCM (KUDU) site when the app is stopped; otherwise, <code>false</code>. The default is <code>false</code>. @@ -125,7 +126,7 @@ public SitePatchInfo() /// /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal SitePatchInfo(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, string state, IReadOnlyList hostNames, string repositorySiteName, AppServiceUsageState? usageState, bool? isEnabled, IReadOnlyList enabledHostNames, WebSiteAvailabilityState? availabilityState, IList hostNameSslStates, ResourceIdentifier serverFarmId, bool? isReserved, bool? isXenon, bool? isHyperV, DateTimeOffset? lastModifiedOn, SiteConfigProperties siteConfig, IReadOnlyList trafficManagerHostNames, bool? isScmSiteAlsoStopped, string targetSwapSlot, HostingEnvironmentProfile hostingEnvironmentProfile, bool? isClientAffinityEnabled, bool? isClientCertEnabled, ClientCertMode? clientCertMode, string clientCertExclusionPaths, bool? isHostNameDisabled, string customDomainVerificationId, string outboundIPAddresses, string possibleOutboundIPAddresses, int? containerSize, int? dailyMemoryTimeQuota, DateTimeOffset? suspendOn, int? maxNumberOfWorkers, CloningInfo cloningInfo, string resourceGroup, bool? isDefaultContainer, string defaultHostName, SlotSwapStatus slotSwapStatus, bool? isHttpsOnly, RedundancyMode? redundancyMode, Guid? inProgressOperationId, bool? isStorageAccountRequired, string keyVaultReferenceIdentity, ResourceIdentifier virtualNetworkSubnetId, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal SitePatchInfo(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ManagedServiceIdentity identity, string state, IReadOnlyList hostNames, string repositorySiteName, AppServiceUsageState? usageState, bool? isEnabled, IReadOnlyList enabledHostNames, WebSiteAvailabilityState? availabilityState, IList hostNameSslStates, ResourceIdentifier serverFarmId, bool? isReserved, bool? isXenon, bool? isHyperV, DateTimeOffset? lastModifiedOn, SiteDnsConfig dnsConfiguration, SiteConfigProperties siteConfig, IReadOnlyList trafficManagerHostNames, bool? isScmSiteAlsoStopped, string targetSwapSlot, HostingEnvironmentProfile hostingEnvironmentProfile, bool? isClientAffinityEnabled, bool? isClientCertEnabled, ClientCertMode? clientCertMode, string clientCertExclusionPaths, bool? isHostNameDisabled, string customDomainVerificationId, string outboundIPAddresses, string possibleOutboundIPAddresses, int? containerSize, int? dailyMemoryTimeQuota, DateTimeOffset? suspendOn, int? maxNumberOfWorkers, CloningInfo cloningInfo, string resourceGroup, bool? isDefaultContainer, string defaultHostName, SlotSwapStatus slotSwapStatus, bool? isHttpsOnly, RedundancyMode? redundancyMode, Guid? inProgressOperationId, bool? isStorageAccountRequired, string keyVaultReferenceIdentity, ResourceIdentifier virtualNetworkSubnetId, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { Identity = identity; State = state; @@ -141,6 +142,7 @@ internal SitePatchInfo(ResourceIdentifier id, string name, ResourceType resource IsXenon = isXenon; IsHyperV = isHyperV; LastModifiedOn = lastModifiedOn; + DnsConfiguration = dnsConfiguration; SiteConfig = siteConfig; TrafficManagerHostNames = trafficManagerHostNames; IsScmSiteAlsoStopped = isScmSiteAlsoStopped; @@ -218,6 +220,9 @@ internal SitePatchInfo(ResourceIdentifier id, string name, ResourceType resource /// Last time the app was modified, in UTC. Read-only. [WirePath("properties.lastModifiedTimeUtc")] public DateTimeOffset? LastModifiedOn { get; } + /// Property to configure various DNS related settings for a site. + [WirePath("properties.dnsConfiguration")] + public SiteDnsConfig DnsConfiguration { get; set; } /// Configuration of the app. [WirePath("properties.siteConfig")] public SiteConfigProperties SiteConfig { get; set; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteBasicAuthPropertiesCollection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteBasicAuthPropertiesCollection.Serialization.cs new file mode 100644 index 0000000000000..5d1c25fc8a095 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteBasicAuthPropertiesCollection.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class StaticSiteBasicAuthPropertiesCollection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StaticSiteBasicAuthPropertiesCollection)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StaticSiteBasicAuthPropertiesCollection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StaticSiteBasicAuthPropertiesCollection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStaticSiteBasicAuthPropertiesCollection(document.RootElement, options); + } + + internal static StaticSiteBasicAuthPropertiesCollection DeserializeStaticSiteBasicAuthPropertiesCollection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StaticSiteBasicAuthPropertiesARMResourceData.DeserializeStaticSiteBasicAuthPropertiesARMResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StaticSiteBasicAuthPropertiesCollection(value, nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(StaticSiteBasicAuthPropertiesCollection)} does not support writing '{options.Format}' format."); + } + } + + StaticSiteBasicAuthPropertiesCollection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStaticSiteBasicAuthPropertiesCollection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StaticSiteBasicAuthPropertiesCollection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteBasicAuthPropertiesCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteBasicAuthPropertiesCollection.cs new file mode 100644 index 0000000000000..503e6f3595375 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteBasicAuthPropertiesCollection.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Collection of static site basic auth. + internal partial class StaticSiteBasicAuthPropertiesCollection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Collection of resources. + /// is null. + internal StaticSiteBasicAuthPropertiesCollection(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// Collection of resources. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal StaticSiteBasicAuthPropertiesCollection(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StaticSiteBasicAuthPropertiesCollection() + { + } + + /// Collection of resources. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteDatabaseConnectionConfigurationFileOverview.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteDatabaseConnectionConfigurationFileOverview.Serialization.cs new file mode 100644 index 0000000000000..d366fb946f2f1 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteDatabaseConnectionConfigurationFileOverview.Serialization.cs @@ -0,0 +1,231 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class StaticSiteDatabaseConnectionConfigurationFileOverview : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StaticSiteDatabaseConnectionConfigurationFileOverview)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(FileName)) + { + writer.WritePropertyName("fileName"u8); + writer.WriteStringValue(FileName); + } + if (options.Format != "W" && Optional.IsDefined(Contents)) + { + writer.WritePropertyName("contents"u8); + writer.WriteStringValue(Contents); + } + if (options.Format != "W" && Optional.IsDefined(StaticSiteDatabaseConnectionConfigurationFileOverviewType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(StaticSiteDatabaseConnectionConfigurationFileOverviewType); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StaticSiteDatabaseConnectionConfigurationFileOverview IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StaticSiteDatabaseConnectionConfigurationFileOverview)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStaticSiteDatabaseConnectionConfigurationFileOverview(document.RootElement, options); + } + + internal static StaticSiteDatabaseConnectionConfigurationFileOverview DeserializeStaticSiteDatabaseConnectionConfigurationFileOverview(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileName = default; + string contents = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("fileName"u8)) + { + fileName = property.Value.GetString(); + continue; + } + if (property.NameEquals("contents"u8)) + { + contents = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StaticSiteDatabaseConnectionConfigurationFileOverview(fileName, contents, type, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(FileName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" fileName: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(FileName)) + { + builder.Append(" fileName: "); + if (FileName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{FileName}'''"); + } + else + { + builder.AppendLine($"'{FileName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Contents), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contents: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Contents)) + { + builder.Append(" contents: "); + if (Contents.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Contents}'''"); + } + else + { + builder.AppendLine($"'{Contents}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StaticSiteDatabaseConnectionConfigurationFileOverviewType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" type: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StaticSiteDatabaseConnectionConfigurationFileOverviewType)) + { + builder.Append(" type: "); + if (StaticSiteDatabaseConnectionConfigurationFileOverviewType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{StaticSiteDatabaseConnectionConfigurationFileOverviewType}'''"); + } + else + { + builder.AppendLine($"'{StaticSiteDatabaseConnectionConfigurationFileOverviewType}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(StaticSiteDatabaseConnectionConfigurationFileOverview)} does not support writing '{options.Format}' format."); + } + } + + StaticSiteDatabaseConnectionConfigurationFileOverview IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStaticSiteDatabaseConnectionConfigurationFileOverview(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StaticSiteDatabaseConnectionConfigurationFileOverview)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteDatabaseConnectionConfigurationFileOverview.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteDatabaseConnectionConfigurationFileOverview.cs new file mode 100644 index 0000000000000..348e653f803ca --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteDatabaseConnectionConfigurationFileOverview.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// A database connection configuration file. + public partial class StaticSiteDatabaseConnectionConfigurationFileOverview + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal StaticSiteDatabaseConnectionConfigurationFileOverview() + { + } + + /// Initializes a new instance of . + /// The name of the configuration file. + /// The Base64 encoding of the file contents. + /// The type of configuration file. + /// Keeps track of any properties unknown to the library. + internal StaticSiteDatabaseConnectionConfigurationFileOverview(string fileName, string contents, string staticSiteDatabaseConnectionConfigurationFileOverviewType, IDictionary serializedAdditionalRawData) + { + FileName = fileName; + Contents = contents; + StaticSiteDatabaseConnectionConfigurationFileOverviewType = staticSiteDatabaseConnectionConfigurationFileOverviewType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the configuration file. + [WirePath("fileName")] + public string FileName { get; } + /// The Base64 encoding of the file contents. + [WirePath("contents")] + public string Contents { get; } + /// The type of configuration file. + [WirePath("type")] + public string StaticSiteDatabaseConnectionConfigurationFileOverviewType { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackend.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackend.Serialization.cs new file mode 100644 index 0000000000000..2c277448795b5 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackend.Serialization.cs @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class StaticSiteLinkedBackend : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StaticSiteLinkedBackend)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(BackendResourceId)) + { + writer.WritePropertyName("backendResourceId"u8); + writer.WriteStringValue(BackendResourceId); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (options.Format != "W" && Optional.IsDefined(CreatedOn)) + { + writer.WritePropertyName("createdOn"u8); + writer.WriteStringValue(CreatedOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StaticSiteLinkedBackend IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StaticSiteLinkedBackend)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStaticSiteLinkedBackend(document.RootElement, options); + } + + internal static StaticSiteLinkedBackend DeserializeStaticSiteLinkedBackend(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string backendResourceId = default; + string region = default; + DateTimeOffset? createdOn = default; + string provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("backendResourceId"u8)) + { + backendResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdOn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdOn = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + provisioningState = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StaticSiteLinkedBackend(backendResourceId, region, createdOn, provisioningState, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(BackendResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" backendResourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(BackendResourceId)) + { + builder.Append(" backendResourceId: "); + if (BackendResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{BackendResourceId}'''"); + } + else + { + builder.AppendLine($"'{BackendResourceId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Region), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" region: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Region)) + { + builder.Append(" region: "); + if (Region.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Region}'''"); + } + else + { + builder.AppendLine($"'{Region}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(CreatedOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" createdOn: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(CreatedOn)) + { + builder.Append(" createdOn: "); + var formattedDateTimeString = TypeFormatters.ToString(CreatedOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + if (ProvisioningState.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ProvisioningState}'''"); + } + else + { + builder.AppendLine($"'{ProvisioningState}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(StaticSiteLinkedBackend)} does not support writing '{options.Format}' format."); + } + } + + StaticSiteLinkedBackend IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStaticSiteLinkedBackend(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StaticSiteLinkedBackend)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackend.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackend.cs new file mode 100644 index 0000000000000..23db1826d45ef --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackend.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Static Site Linked Backend ARM resource. + public partial class StaticSiteLinkedBackend + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal StaticSiteLinkedBackend() + { + } + + /// Initializes a new instance of . + /// The resource id of the backend linked to the static site. + /// The region of the backend linked to the static site. + /// The date and time on which the backend was linked to the static site. + /// The provisioning state of the linking process. + /// Keeps track of any properties unknown to the library. + internal StaticSiteLinkedBackend(string backendResourceId, string region, DateTimeOffset? createdOn, string provisioningState, IDictionary serializedAdditionalRawData) + { + BackendResourceId = backendResourceId; + Region = region; + CreatedOn = createdOn; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource id of the backend linked to the static site. + [WirePath("backendResourceId")] + public string BackendResourceId { get; } + /// The region of the backend linked to the static site. + [WirePath("region")] + public string Region { get; } + /// The date and time on which the backend was linked to the static site. + [WirePath("createdOn")] + public DateTimeOffset? CreatedOn { get; } + /// The provisioning state of the linking process. + [WirePath("provisioningState")] + public string ProvisioningState { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackendsCollection.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackendsCollection.Serialization.cs new file mode 100644 index 0000000000000..7c2350603c326 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackendsCollection.Serialization.cs @@ -0,0 +1,205 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + internal partial class StaticSiteLinkedBackendsCollection : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StaticSiteLinkedBackendsCollection)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + StaticSiteLinkedBackendsCollection IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StaticSiteLinkedBackendsCollection)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStaticSiteLinkedBackendsCollection(document.RootElement, options); + } + + internal static StaticSiteLinkedBackendsCollection DeserializeStaticSiteLinkedBackendsCollection(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(StaticSiteLinkedBackendARMResourceData.DeserializeStaticSiteLinkedBackendARMResourceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StaticSiteLinkedBackendsCollection(value, nextLink, serializedAdditionalRawData); + } + + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(NextLink), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" nextLink: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(NextLink)) + { + builder.Append(" nextLink: "); + if (NextLink.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{NextLink}'''"); + } + else + { + builder.AppendLine($"'{NextLink}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); + default: + throw new FormatException($"The model {nameof(StaticSiteLinkedBackendsCollection)} does not support writing '{options.Format}' format."); + } + } + + StaticSiteLinkedBackendsCollection IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeStaticSiteLinkedBackendsCollection(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StaticSiteLinkedBackendsCollection)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackendsCollection.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackendsCollection.cs new file mode 100644 index 0000000000000..6fc5853987066 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSiteLinkedBackendsCollection.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AppService.Models +{ + /// Collection of static site linked backends. + internal partial class StaticSiteLinkedBackendsCollection + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Collection of resources. + /// is null. + internal StaticSiteLinkedBackendsCollection(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// Collection of resources. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal StaticSiteLinkedBackendsCollection(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal StaticSiteLinkedBackendsCollection() + { + } + + /// Collection of resources. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSitePatch.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSitePatch.Serialization.cs index 6d1195f4d8fa0..c49b20426928b 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSitePatch.Serialization.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSitePatch.Serialization.cs @@ -136,11 +136,41 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO } writer.WriteEndArray(); } - if (options.Format != "W" && Optional.IsDefined(Provider)) + if (options.Format != "W" && Optional.IsCollectionDefined(LinkedBackends)) + { + writer.WritePropertyName("linkedBackends"u8); + writer.WriteStartArray(); + foreach (var item in LinkedBackends) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Provider)) { writer.WritePropertyName("provider"u8); writer.WriteStringValue(Provider); } + if (Optional.IsDefined(EnterpriseGradeCdnStatus)) + { + writer.WritePropertyName("enterpriseGradeCdnStatus"u8); + writer.WriteStringValue(EnterpriseGradeCdnStatus.Value.ToString()); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess); + } + if (options.Format != "W" && Optional.IsCollectionDefined(DatabaseConnections)) + { + writer.WritePropertyName("databaseConnections"u8); + writer.WriteStartArray(); + foreach (var item in DatabaseConnections) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -198,7 +228,11 @@ internal static StaticSitePatch DeserializeStaticSitePatch(JsonElement element, string contentDistributionEndpoint = default; string keyVaultReferenceIdentity = default; IReadOnlyList userProvidedFunctionApps = default; + IReadOnlyList linkedBackends = default; string provider = default; + EnterpriseGradeCdnStatus? enterpriseGradeCdnStatus = default; + string publicNetworkAccess = default; + IReadOnlyList databaseConnections = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -353,11 +387,53 @@ internal static StaticSitePatch DeserializeStaticSitePatch(JsonElement element, userProvidedFunctionApps = array; continue; } + if (property0.NameEquals("linkedBackends"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(StaticSiteLinkedBackend.DeserializeStaticSiteLinkedBackend(item, options)); + } + linkedBackends = array; + continue; + } if (property0.NameEquals("provider"u8)) { provider = property0.Value.GetString(); continue; } + if (property0.NameEquals("enterpriseGradeCdnStatus"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enterpriseGradeCdnStatus = new EnterpriseGradeCdnStatus(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("publicNetworkAccess"u8)) + { + publicNetworkAccess = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("databaseConnections"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DatabaseConnectionOverview.DeserializeDatabaseConnectionOverview(item, options)); + } + databaseConnections = array; + continue; + } } continue; } @@ -385,7 +461,11 @@ internal static StaticSitePatch DeserializeStaticSitePatch(JsonElement element, contentDistributionEndpoint, keyVaultReferenceIdentity, userProvidedFunctionApps ?? new ChangeTrackingList(), + linkedBackends ?? new ChangeTrackingList(), provider, + enterpriseGradeCdnStatus, + publicNetworkAccess, + databaseConnections ?? new ChangeTrackingList(), kind, serializedAdditionalRawData); } @@ -752,6 +832,29 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LinkedBackends), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" linkedBackends: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(LinkedBackends)) + { + if (LinkedBackends.Any()) + { + builder.Append(" linkedBackends: "); + builder.AppendLine("["); + foreach (var item in LinkedBackends) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " linkedBackends: "); + } + builder.AppendLine(" ]"); + } + } + } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Provider), out propertyOverride); if (hasPropertyOverride) { @@ -775,6 +878,67 @@ private BinaryData SerializeBicep(ModelReaderWriterOptions options) } } + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EnterpriseGradeCdnStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" enterpriseGradeCdnStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EnterpriseGradeCdnStatus)) + { + builder.Append(" enterpriseGradeCdnStatus: "); + builder.AppendLine($"'{EnterpriseGradeCdnStatus.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(PublicNetworkAccess), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" publicNetworkAccess: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(PublicNetworkAccess)) + { + builder.Append(" publicNetworkAccess: "); + if (PublicNetworkAccess.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{PublicNetworkAccess}'''"); + } + else + { + builder.AppendLine($"'{PublicNetworkAccess}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(DatabaseConnections), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" databaseConnections: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(DatabaseConnections)) + { + if (DatabaseConnections.Any()) + { + builder.Append(" databaseConnections: "); + builder.AppendLine("["); + foreach (var item in DatabaseConnections) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 6, true, " databaseConnections: "); + } + builder.AppendLine(" ]"); + } + } + } + builder.AppendLine(" }"); builder.AppendLine("}"); return BinaryData.FromString(builder.ToString()); diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSitePatch.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSitePatch.cs index 827a73fc5057b..5187c0b1c4bec 100644 --- a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSitePatch.cs +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/StaticSitePatch.cs @@ -53,6 +53,8 @@ public StaticSitePatch() CustomDomains = new ChangeTrackingList(); PrivateEndpointConnections = new ChangeTrackingList(); UserProvidedFunctionApps = new ChangeTrackingList(); + LinkedBackends = new ChangeTrackingList(); + DatabaseConnections = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -73,10 +75,14 @@ public StaticSitePatch() /// The content distribution endpoint for the static site. /// Identity to use for Key Vault Reference authentication. /// User provided function apps registered with the static site. + /// Backends linked to the static side. /// The provider that submitted the last deployment to the primary environment of the static site. + /// State indicating the status of the enterprise grade CDN serving traffic to the static web app. + /// State indicating whether public traffic are allowed or not for a static web app. Allowed Values: 'Enabled', 'Disabled' or an empty string. + /// Database connections for the static site. /// Kind of resource. /// Keeps track of any properties unknown to the library. - internal StaticSitePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string defaultHostname, Uri repositoryUri, string branch, IReadOnlyList customDomains, string repositoryToken, StaticSiteBuildProperties buildProperties, IReadOnlyList privateEndpointConnections, StagingEnvironmentPolicy? stagingEnvironmentPolicy, bool? allowConfigFileUpdates, StaticSiteTemplate templateProperties, string contentDistributionEndpoint, string keyVaultReferenceIdentity, IReadOnlyList userProvidedFunctionApps, string provider, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal StaticSitePatch(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string defaultHostname, Uri repositoryUri, string branch, IReadOnlyList customDomains, string repositoryToken, StaticSiteBuildProperties buildProperties, IReadOnlyList privateEndpointConnections, StagingEnvironmentPolicy? stagingEnvironmentPolicy, bool? allowConfigFileUpdates, StaticSiteTemplate templateProperties, string contentDistributionEndpoint, string keyVaultReferenceIdentity, IReadOnlyList userProvidedFunctionApps, IReadOnlyList linkedBackends, string provider, EnterpriseGradeCdnStatus? enterpriseGradeCdnStatus, string publicNetworkAccess, IReadOnlyList databaseConnections, string kind, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { DefaultHostname = defaultHostname; RepositoryUri = repositoryUri; @@ -91,7 +97,11 @@ internal StaticSitePatch(ResourceIdentifier id, string name, ResourceType resour ContentDistributionEndpoint = contentDistributionEndpoint; KeyVaultReferenceIdentity = keyVaultReferenceIdentity; UserProvidedFunctionApps = userProvidedFunctionApps; + LinkedBackends = linkedBackends; Provider = provider; + EnterpriseGradeCdnStatus = enterpriseGradeCdnStatus; + PublicNetworkAccess = publicNetworkAccess; + DatabaseConnections = databaseConnections; Kind = kind; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -135,9 +145,21 @@ internal StaticSitePatch(ResourceIdentifier id, string name, ResourceType resour /// User provided function apps registered with the static site. [WirePath("properties.userProvidedFunctionApps")] public IReadOnlyList UserProvidedFunctionApps { get; } + /// Backends linked to the static side. + [WirePath("properties.linkedBackends")] + public IReadOnlyList LinkedBackends { get; } /// The provider that submitted the last deployment to the primary environment of the static site. [WirePath("properties.provider")] - public string Provider { get; } + public string Provider { get; set; } + /// State indicating the status of the enterprise grade CDN serving traffic to the static web app. + [WirePath("properties.enterpriseGradeCdnStatus")] + public EnterpriseGradeCdnStatus? EnterpriseGradeCdnStatus { get; set; } + /// State indicating whether public traffic are allowed or not for a static web app. Allowed Values: 'Enabled', 'Disabled' or an empty string. + [WirePath("properties.publicNetworkAccess")] + public string PublicNetworkAccess { get; set; } + /// Database connections for the static site. + [WirePath("properties.databaseConnections")] + public IReadOnlyList DatabaseConnections { get; } /// Kind of resource. [WirePath("kind")] public string Kind { get; set; } diff --git a/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Template.Serialization.cs b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Template.Serialization.cs new file mode 100644 index 0000000000000..b7eddffb76520 --- /dev/null +++ b/sdk/websites/Azure.ResourceManager.AppService/src/Generated/Models/Template.Serialization.cs @@ -0,0 +1,272 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AppService.Models +{ + public partial class Template : IUtf8JsonSerializable, IJsonModel