diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/Azure.ResourceManager.PostgreSql.sln b/sdk/postgresql/Azure.ResourceManager.PostgreSql/Azure.ResourceManager.PostgreSql.sln
index 608e8e33e924..c05781b8f340 100644
--- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/Azure.ResourceManager.PostgreSql.sln
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/Azure.ResourceManager.PostgreSql.sln
@@ -1,19 +1,15 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio Version 16
-VisualStudioVersion = 16.0.30309.148
+# Visual Studio Version 17
+VisualStudioVersion = 17.6.33801.468
MinimumVisualStudioVersion = 10.0.40219.1
-Project("{C8916C6C-CE14-4A69-BCFE-FFEDA8A137C0}") = "Azure.ResourceManager.PostgreSql", "src\Azure.ResourceManager.PostgreSql.csproj", "{1BA2F101-CA05-4DD8-8EB6-35F0953D76D5}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.PostgreSql", "src\Azure.ResourceManager.PostgreSql.csproj", "{1BA2F101-CA05-4DD8-8EB6-35F0953D76D5}"
EndProject
-Project("{C8916C6C-CE14-4A69-BCFE-FFEDA8A137C0}") = "Azure.ResourceManager.PostgreSql.Tests", "tests\Azure.ResourceManager.PostgreSql.Tests.csproj", "{F86DE6B5-3F93-4344-A8CE-0166A186585D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.PostgreSql.Tests", "tests\Azure.ResourceManager.PostgreSql.Tests.csproj", "{F86DE6B5-3F93-4344-A8CE-0166A186585D}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.PostgreSql.Samples", "samples\Azure.ResourceManager.PostgreSql.Samples.csproj", "{5630728D-75C0-426F-8511-7BCABA2F81C4}"
EndProject
Global
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
- GlobalSection(ExtensibilityGlobals) = postSolution
- SolutionGuid = {B6A1758A-8648-49E5-A900-C809F32ADAFE}
- EndGlobalSection
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
@@ -47,5 +43,23 @@ Global
{F86DE6B5-3F93-4344-A8CE-0166A186585D}.Release|x64.Build.0 = Release|Any CPU
{F86DE6B5-3F93-4344-A8CE-0166A186585D}.Release|x86.ActiveCfg = Release|Any CPU
{F86DE6B5-3F93-4344-A8CE-0166A186585D}.Release|x86.Build.0 = Release|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Debug|x64.Build.0 = Debug|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Debug|x86.Build.0 = Debug|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Release|Any CPU.Build.0 = Release|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Release|x64.ActiveCfg = Release|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Release|x64.Build.0 = Release|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Release|x86.ActiveCfg = Release|Any CPU
+ {5630728D-75C0-426F-8511-7BCABA2F81C4}.Release|x86.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {B6A1758A-8648-49E5-A900-C809F32ADAFE}
EndGlobalSection
EndGlobal
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/api/Azure.ResourceManager.PostgreSql.netstandard2.0.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/api/Azure.ResourceManager.PostgreSql.netstandard2.0.cs
index 1e6ad46b6003..793d6b4c3ed0 100644
--- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/api/Azure.ResourceManager.PostgreSql.netstandard2.0.cs
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/api/Azure.ResourceManager.PostgreSql.netstandard2.0.cs
@@ -1682,6 +1682,7 @@ internal PostgreSqlFlexibleServerVCoreCapability() { }
public static Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVersion Ver12 { get { throw null; } }
public static Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVersion Ver13 { get { throw null; } }
public static Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVersion Ver14 { get { throw null; } }
+ public static Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVersion Ver15 { get { throw null; } }
public bool Equals(Azure.ResourceManager.PostgreSql.FlexibleServers.Models.PostgreSqlFlexibleServerVersion other) { throw null; }
[System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)]
public override bool Equals(object obj) { throw null; }
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Azure.ResourceManager.PostgreSql.Samples.csproj b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Azure.ResourceManager.PostgreSql.Samples.csproj
new file mode 100644
index 000000000000..76379fc2bebc
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Azure.ResourceManager.PostgreSql.Samples.csproj
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlConfigurationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlConfigurationCollection.cs
new file mode 100644
index 000000000000..b1452f449c1a
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlConfigurationCollection.cs
@@ -0,0 +1,164 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlConfigurationCollection
+ {
+ // ConfigurationCreateOrUpdate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_ConfigurationCreateOrUpdate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json
+ // this example is just showing the usage of "Configurations_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlConfigurationResource
+ PostgreSqlConfigurationCollection collection = postgreSqlServer.GetPostgreSqlConfigurations();
+
+ // invoke the operation
+ string configurationName = "array_nulls";
+ PostgreSqlConfigurationData data = new PostgreSqlConfigurationData()
+ {
+ Value = "off",
+ Source = "user-override",
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationName, data);
+ PostgreSqlConfigurationResource 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
+ PostgreSqlConfigurationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ConfigurationGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ConfigurationGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet.json
+ // this example is just showing the usage of "Configurations_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlConfigurationResource
+ PostgreSqlConfigurationCollection collection = postgreSqlServer.GetPostgreSqlConfigurations();
+
+ // invoke the operation
+ string configurationName = "array_nulls";
+ PostgreSqlConfigurationResource result = await collection.GetAsync(configurationName);
+
+ // 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
+ PostgreSqlConfigurationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ConfigurationGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_ConfigurationGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet.json
+ // this example is just showing the usage of "Configurations_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlConfigurationResource
+ PostgreSqlConfigurationCollection collection = postgreSqlServer.GetPostgreSqlConfigurations();
+
+ // invoke the operation
+ string configurationName = "array_nulls";
+ bool result = await collection.ExistsAsync(configurationName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // ConfigurationList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ConfigurationList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationListByServer.json
+ // this example is just showing the usage of "Configurations_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlConfigurationResource
+ PostgreSqlConfigurationCollection collection = postgreSqlServer.GetPostgreSqlConfigurations();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlConfigurationResource 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
+ PostgreSqlConfigurationData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlConfigurationResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlConfigurationResource.cs
new file mode 100644
index 000000000000..9f5d42ea4b6f
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlConfigurationResource.cs
@@ -0,0 +1,90 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlConfigurationResource
+ {
+ // ConfigurationCreateOrUpdate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_ConfigurationCreateOrUpdate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationCreateOrUpdate.json
+ // this example is just showing the usage of "Configurations_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 PostgreSqlConfigurationResource created on azure
+ // for more information of creating PostgreSqlConfigurationResource, please refer to the document of PostgreSqlConfigurationResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string configurationName = "array_nulls";
+ ResourceIdentifier postgreSqlConfigurationResourceId = PostgreSqlConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, configurationName);
+ PostgreSqlConfigurationResource postgreSqlConfiguration = client.GetPostgreSqlConfigurationResource(postgreSqlConfigurationResourceId);
+
+ // invoke the operation
+ PostgreSqlConfigurationData data = new PostgreSqlConfigurationData()
+ {
+ Value = "off",
+ Source = "user-override",
+ };
+ ArmOperation lro = await postgreSqlConfiguration.UpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlConfigurationResource 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
+ PostgreSqlConfigurationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ConfigurationGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ConfigurationGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationGet.json
+ // this example is just showing the usage of "Configurations_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 PostgreSqlConfigurationResource created on azure
+ // for more information of creating PostgreSqlConfigurationResource, please refer to the document of PostgreSqlConfigurationResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string configurationName = "array_nulls";
+ ResourceIdentifier postgreSqlConfigurationResourceId = PostgreSqlConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, configurationName);
+ PostgreSqlConfigurationResource postgreSqlConfiguration = client.GetPostgreSqlConfigurationResource(postgreSqlConfigurationResourceId);
+
+ // invoke the operation
+ PostgreSqlConfigurationResource result = await postgreSqlConfiguration.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
+ PostgreSqlConfigurationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlDatabaseCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlDatabaseCollection.cs
new file mode 100644
index 000000000000..2b5b7fe205f5
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlDatabaseCollection.cs
@@ -0,0 +1,164 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlDatabaseCollection
+ {
+ // DatabaseCreate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_DatabaseCreate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseCreate.json
+ // this example is just showing the usage of "Databases_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlDatabaseResource
+ PostgreSqlDatabaseCollection collection = postgreSqlServer.GetPostgreSqlDatabases();
+
+ // invoke the operation
+ string databaseName = "db1";
+ PostgreSqlDatabaseData data = new PostgreSqlDatabaseData()
+ {
+ Charset = "UTF8",
+ Collation = "English_United States.1252",
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, data);
+ PostgreSqlDatabaseResource 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
+ PostgreSqlDatabaseData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // DatabaseGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_DatabaseGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json
+ // this example is just showing the usage of "Databases_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlDatabaseResource
+ PostgreSqlDatabaseCollection collection = postgreSqlServer.GetPostgreSqlDatabases();
+
+ // invoke the operation
+ string databaseName = "db1";
+ PostgreSqlDatabaseResource result = await collection.GetAsync(databaseName);
+
+ // 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
+ PostgreSqlDatabaseData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // DatabaseGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_DatabaseGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json
+ // this example is just showing the usage of "Databases_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlDatabaseResource
+ PostgreSqlDatabaseCollection collection = postgreSqlServer.GetPostgreSqlDatabases();
+
+ // invoke the operation
+ string databaseName = "db1";
+ bool result = await collection.ExistsAsync(databaseName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // DatabaseList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_DatabaseList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseListByServer.json
+ // this example is just showing the usage of "Databases_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlDatabaseResource
+ PostgreSqlDatabaseCollection collection = postgreSqlServer.GetPostgreSqlDatabases();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlDatabaseResource 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
+ PostgreSqlDatabaseData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlDatabaseResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlDatabaseResource.cs
new file mode 100644
index 000000000000..295a72ca38bf
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlDatabaseResource.cs
@@ -0,0 +1,118 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlDatabaseResource
+ {
+ // DatabaseCreate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_DatabaseCreate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseCreate.json
+ // this example is just showing the usage of "Databases_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 PostgreSqlDatabaseResource created on azure
+ // for more information of creating PostgreSqlDatabaseResource, please refer to the document of PostgreSqlDatabaseResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string databaseName = "db1";
+ ResourceIdentifier postgreSqlDatabaseResourceId = PostgreSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName);
+ PostgreSqlDatabaseResource postgreSqlDatabase = client.GetPostgreSqlDatabaseResource(postgreSqlDatabaseResourceId);
+
+ // invoke the operation
+ PostgreSqlDatabaseData data = new PostgreSqlDatabaseData()
+ {
+ Charset = "UTF8",
+ Collation = "English_United States.1252",
+ };
+ ArmOperation lro = await postgreSqlDatabase.UpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlDatabaseResource 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
+ PostgreSqlDatabaseData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // DatabaseDelete
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_DatabaseDelete()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseDelete.json
+ // this example is just showing the usage of "Databases_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 PostgreSqlDatabaseResource created on azure
+ // for more information of creating PostgreSqlDatabaseResource, please refer to the document of PostgreSqlDatabaseResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string databaseName = "db1";
+ ResourceIdentifier postgreSqlDatabaseResourceId = PostgreSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName);
+ PostgreSqlDatabaseResource postgreSqlDatabase = client.GetPostgreSqlDatabaseResource(postgreSqlDatabaseResourceId);
+
+ // invoke the operation
+ await postgreSqlDatabase.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // DatabaseGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_DatabaseGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/DatabaseGet.json
+ // this example is just showing the usage of "Databases_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 PostgreSqlDatabaseResource created on azure
+ // for more information of creating PostgreSqlDatabaseResource, please refer to the document of PostgreSqlDatabaseResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string databaseName = "db1";
+ ResourceIdentifier postgreSqlDatabaseResourceId = PostgreSqlDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName);
+ PostgreSqlDatabaseResource postgreSqlDatabase = client.GetPostgreSqlDatabaseResource(postgreSqlDatabaseResourceId);
+
+ // invoke the operation
+ PostgreSqlDatabaseResource result = await postgreSqlDatabase.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
+ PostgreSqlDatabaseData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFirewallRuleCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFirewallRuleCollection.cs
new file mode 100644
index 000000000000..9acad1a3bb4f
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFirewallRuleCollection.cs
@@ -0,0 +1,161 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Net;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlFirewallRuleCollection
+ {
+ // FirewallRuleCreate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_FirewallRuleCreate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleCreate.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlFirewallRuleResource
+ PostgreSqlFirewallRuleCollection collection = postgreSqlServer.GetPostgreSqlFirewallRules();
+
+ // invoke the operation
+ string firewallRuleName = "rule1";
+ PostgreSqlFirewallRuleData data = new PostgreSqlFirewallRuleData(IPAddress.Parse("0.0.0.0"), IPAddress.Parse("255.255.255.255"));
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, firewallRuleName, data);
+ PostgreSqlFirewallRuleResource 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
+ PostgreSqlFirewallRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // FirewallRuleGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_FirewallRuleGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlFirewallRuleResource
+ PostgreSqlFirewallRuleCollection collection = postgreSqlServer.GetPostgreSqlFirewallRules();
+
+ // invoke the operation
+ string firewallRuleName = "rule1";
+ PostgreSqlFirewallRuleResource result = await collection.GetAsync(firewallRuleName);
+
+ // 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
+ PostgreSqlFirewallRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // FirewallRuleGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_FirewallRuleGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlFirewallRuleResource
+ PostgreSqlFirewallRuleCollection collection = postgreSqlServer.GetPostgreSqlFirewallRules();
+
+ // invoke the operation
+ string firewallRuleName = "rule1";
+ bool result = await collection.ExistsAsync(firewallRuleName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // FirewallRuleList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_FirewallRuleList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleListByServer.json
+ // this example is just showing the usage of "FirewallRules_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlFirewallRuleResource
+ PostgreSqlFirewallRuleCollection collection = postgreSqlServer.GetPostgreSqlFirewallRules();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlFirewallRuleResource 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
+ PostgreSqlFirewallRuleData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFirewallRuleResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFirewallRuleResource.cs
new file mode 100644
index 000000000000..0a5596a5e9a2
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFirewallRuleResource.cs
@@ -0,0 +1,115 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Net;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlFirewallRuleResource
+ {
+ // FirewallRuleCreate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_FirewallRuleCreate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleCreate.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlFirewallRuleResource created on azure
+ // for more information of creating PostgreSqlFirewallRuleResource, please refer to the document of PostgreSqlFirewallRuleResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string firewallRuleName = "rule1";
+ ResourceIdentifier postgreSqlFirewallRuleResourceId = PostgreSqlFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, firewallRuleName);
+ PostgreSqlFirewallRuleResource postgreSqlFirewallRule = client.GetPostgreSqlFirewallRuleResource(postgreSqlFirewallRuleResourceId);
+
+ // invoke the operation
+ PostgreSqlFirewallRuleData data = new PostgreSqlFirewallRuleData(IPAddress.Parse("0.0.0.0"), IPAddress.Parse("255.255.255.255"));
+ ArmOperation lro = await postgreSqlFirewallRule.UpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlFirewallRuleResource 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
+ PostgreSqlFirewallRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // FirewallRuleDelete
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_FirewallRuleDelete()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleDelete.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlFirewallRuleResource created on azure
+ // for more information of creating PostgreSqlFirewallRuleResource, please refer to the document of PostgreSqlFirewallRuleResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string firewallRuleName = "rule1";
+ ResourceIdentifier postgreSqlFirewallRuleResourceId = PostgreSqlFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, firewallRuleName);
+ PostgreSqlFirewallRuleResource postgreSqlFirewallRule = client.GetPostgreSqlFirewallRuleResource(postgreSqlFirewallRuleResourceId);
+
+ // invoke the operation
+ await postgreSqlFirewallRule.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // FirewallRuleGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_FirewallRuleGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/FirewallRuleGet.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlFirewallRuleResource created on azure
+ // for more information of creating PostgreSqlFirewallRuleResource, please refer to the document of PostgreSqlFirewallRuleResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string firewallRuleName = "rule1";
+ ResourceIdentifier postgreSqlFirewallRuleResourceId = PostgreSqlFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, firewallRuleName);
+ PostgreSqlFirewallRuleResource postgreSqlFirewallRule = client.GetPostgreSqlFirewallRuleResource(postgreSqlFirewallRuleResourceId);
+
+ // invoke the operation
+ PostgreSqlFirewallRuleResource result = await postgreSqlFirewallRule.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
+ PostgreSqlFirewallRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs
new file mode 100644
index 000000000000..6c4f9cbb456e
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection.cs
@@ -0,0 +1,166 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection
+ {
+ // Adds an Active DIrectory Administrator for the server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_AddsAnActiveDIrectoryAdministratorForTheServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorAdd.json
+ // this example is just showing the usage of "Administrators_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerActiveDirectoryAdministratorResource
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerActiveDirectoryAdministrators();
+
+ // invoke the operation
+ string objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo";
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorCreateOrUpdateContent content = new PostgreSqlFlexibleServerActiveDirectoryAdministratorCreateOrUpdateContent()
+ {
+ PrincipalType = PostgreSqlFlexibleServerPrincipalType.User,
+ PrincipalName = "testuser1@microsoft.com",
+ TenantId = Guid.Parse("tttttttt-tttt-tttt-tttt-tttttttttttt"),
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, objectId, content);
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorResource 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
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ServerGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorGet.json
+ // this example is just showing the usage of "Administrators_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc1";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerActiveDirectoryAdministratorResource
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerActiveDirectoryAdministrators();
+
+ // invoke the operation
+ string objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo";
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorResource result = await collection.GetAsync(objectId);
+
+ // 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
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_ServerGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorGet.json
+ // this example is just showing the usage of "Administrators_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc1";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerActiveDirectoryAdministratorResource
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerActiveDirectoryAdministrators();
+
+ // invoke the operation
+ string objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo";
+ bool result = await collection.ExistsAsync(objectId);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // AdministratorsListByServer
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_AdministratorsListByServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorsListByServer.json
+ // this example is just showing the usage of "Administrators_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc1";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerActiveDirectoryAdministratorResource
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerActiveDirectoryAdministrators();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlFlexibleServerActiveDirectoryAdministratorResource 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
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.cs
new file mode 100644
index 000000000000..9fc3b57b010b
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.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;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerActiveDirectoryAdministratorResource
+ {
+ // Adds an Active DIrectory Administrator for the server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_AddsAnActiveDIrectoryAdministratorForTheServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorAdd.json
+ // this example is just showing the usage of "Administrators_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerActiveDirectoryAdministratorResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerActiveDirectoryAdministratorResource, please refer to the document of PostgreSqlFlexibleServerActiveDirectoryAdministratorResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ string objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo";
+ ResourceIdentifier postgreSqlFlexibleServerActiveDirectoryAdministratorResourceId = PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, objectId);
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorResource postgreSqlFlexibleServerActiveDirectoryAdministrator = client.GetPostgreSqlFlexibleServerActiveDirectoryAdministratorResource(postgreSqlFlexibleServerActiveDirectoryAdministratorResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorCreateOrUpdateContent content = new PostgreSqlFlexibleServerActiveDirectoryAdministratorCreateOrUpdateContent()
+ {
+ PrincipalType = PostgreSqlFlexibleServerPrincipalType.User,
+ PrincipalName = "testuser1@microsoft.com",
+ TenantId = Guid.Parse("tttttttt-tttt-tttt-tttt-tttttttttttt"),
+ };
+ ArmOperation lro = await postgreSqlFlexibleServerActiveDirectoryAdministrator.UpdateAsync(WaitUntil.Completed, content);
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorResource 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
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // AdministratorDelete
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_AdministratorDelete()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorDelete.json
+ // this example is just showing the usage of "Administrators_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 PostgreSqlFlexibleServerActiveDirectoryAdministratorResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerActiveDirectoryAdministratorResource, please refer to the document of PostgreSqlFlexibleServerActiveDirectoryAdministratorResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ string objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo";
+ ResourceIdentifier postgreSqlFlexibleServerActiveDirectoryAdministratorResourceId = PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, objectId);
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorResource postgreSqlFlexibleServerActiveDirectoryAdministrator = client.GetPostgreSqlFlexibleServerActiveDirectoryAdministratorResource(postgreSqlFlexibleServerActiveDirectoryAdministratorResourceId);
+
+ // invoke the operation
+ await postgreSqlFlexibleServerActiveDirectoryAdministrator.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ServerGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ServerGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/AdministratorGet.json
+ // this example is just showing the usage of "Administrators_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 PostgreSqlFlexibleServerActiveDirectoryAdministratorResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerActiveDirectoryAdministratorResource, please refer to the document of PostgreSqlFlexibleServerActiveDirectoryAdministratorResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc1";
+ string objectId = "oooooooo-oooo-oooo-oooo-oooooooooooo";
+ ResourceIdentifier postgreSqlFlexibleServerActiveDirectoryAdministratorResourceId = PostgreSqlFlexibleServerActiveDirectoryAdministratorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, objectId);
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorResource postgreSqlFlexibleServerActiveDirectoryAdministrator = client.GetPostgreSqlFlexibleServerActiveDirectoryAdministratorResource(postgreSqlFlexibleServerActiveDirectoryAdministratorResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorResource result = await postgreSqlFlexibleServerActiveDirectoryAdministrator.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
+ PostgreSqlFlexibleServerActiveDirectoryAdministratorData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerBackupCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerBackupCollection.cs
new file mode 100644
index 000000000000..6f1dc8d67033
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerBackupCollection.cs
@@ -0,0 +1,122 @@
+// 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;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerBackupCollection
+ {
+ // Get a backup for a server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetABackupForAServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupGet.json
+ // this example is just showing the usage of "Backups_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "postgresqltestserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerBackupResource
+ PostgreSqlFlexibleServerBackupCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerBackups();
+
+ // invoke the operation
+ string backupName = "daily_20210615T160516";
+ PostgreSqlFlexibleServerBackupResource result = await collection.GetAsync(backupName);
+
+ // 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
+ PostgreSqlFlexibleServerBackupData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a backup for a server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetABackupForAServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupGet.json
+ // this example is just showing the usage of "Backups_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "postgresqltestserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerBackupResource
+ PostgreSqlFlexibleServerBackupCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerBackups();
+
+ // invoke the operation
+ string backupName = "daily_20210615T160516";
+ bool result = await collection.ExistsAsync(backupName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // List backups for a server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ListBackupsForAServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupListByServer.json
+ // this example is just showing the usage of "Backups_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "postgresqltestserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerBackupResource
+ PostgreSqlFlexibleServerBackupCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerBackups();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlFlexibleServerBackupResource 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
+ PostgreSqlFlexibleServerBackupData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerBackupResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerBackupResource.cs
new file mode 100644
index 000000000000..63e2ef95d7a2
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerBackupResource.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;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerBackupResource
+ {
+ // Get a backup for a server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetABackupForAServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/BackupGet.json
+ // this example is just showing the usage of "Backups_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 PostgreSqlFlexibleServerBackupResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerBackupResource, please refer to the document of PostgreSqlFlexibleServerBackupResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "postgresqltestserver";
+ string backupName = "daily_20210615T160516";
+ ResourceIdentifier postgreSqlFlexibleServerBackupResourceId = PostgreSqlFlexibleServerBackupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, backupName);
+ PostgreSqlFlexibleServerBackupResource postgreSqlFlexibleServerBackup = client.GetPostgreSqlFlexibleServerBackupResource(postgreSqlFlexibleServerBackupResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerBackupResource result = await postgreSqlFlexibleServerBackup.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
+ PostgreSqlFlexibleServerBackupData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs
new file mode 100644
index 000000000000..51fa2c1c2a41
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerCollection.cs
@@ -0,0 +1,647 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.Models;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerCollection
+ {
+ // Create a database as a geo-restore in geo-paired location
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateADatabaseAsAGeoRestoreInGeoPairedLocation()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateGeoRestoreWithDataEncryptionEnabled.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc5geo";
+ PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("eastus"))
+ {
+ Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned)
+ {
+ UserAssignedIdentities =
+{
+["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity"] = new UserAssignedIdentity(),
+["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"] = new UserAssignedIdentity(),
+},
+ },
+ DataEncryption = new PostgreSqlFlexibleServerDataEncryption()
+ {
+ PrimaryKeyUri = new Uri("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787"),
+ PrimaryUserAssignedIdentityId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"),
+ GeoBackupKeyUri = new Uri("https://test-geo-kv.vault.azure.net/keys/test-key1/66f57315bab34b0189daa113fbc78787"),
+ GeoBackupUserAssignedIdentityId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity",
+ KeyType = PostgreSqlFlexibleServerKeyType.AzureKeyVault,
+ },
+ SourceServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername"),
+ PointInTimeUtc = DateTimeOffset.Parse("2021-06-27T00:04:59.4078005+00:00"),
+ CreateMode = PostgreSqlFlexibleServerCreateMode.GeoRestore,
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Create a database as a point in time restore
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateADatabaseAsAPointInTimeRestore()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreatePointInTimeRestore.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc5";
+ PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("westus"))
+ {
+ SourceServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername"),
+ PointInTimeUtc = DateTimeOffset.Parse("2021-06-27T00:04:59.4078005+00:00"),
+ CreateMode = PostgreSqlFlexibleServerCreateMode.PointInTimeRestore,
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Create a new server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateANewServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreate.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc4";
+ PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("westus"))
+ {
+ Sku = new PostgreSqlFlexibleServerSku("Standard_D4s_v3", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
+ AdministratorLogin = "cloudsa",
+ AdministratorLoginPassword = "password",
+ Version = PostgreSqlFlexibleServerVersion.Ver12,
+ Storage = new PostgreSqlFlexibleServerStorage()
+ {
+ StorageSizeInGB = 512,
+ AutoGrow = StorageAutoGrow.Disabled,
+ Tier = PostgreSqlManagedDiskPerformanceTier.P20,
+ },
+ Backup = new PostgreSqlFlexibleServerBackupProperties()
+ {
+ BackupRetentionDays = 7,
+ GeoRedundantBackup = PostgreSqlFlexibleServerGeoRedundantBackupEnum.Disabled,
+ },
+ Network = new PostgreSqlFlexibleServerNetwork()
+ {
+ DelegatedSubnetResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
+ PrivateDnsZoneArmResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
+ },
+ HighAvailability = new PostgreSqlFlexibleServerHighAvailability()
+ {
+ Mode = PostgreSqlFlexibleServerHighAvailabilityMode.ZoneRedundant,
+ },
+ AvailabilityZone = "1",
+ CreateMode = PostgreSqlFlexibleServerCreateMode.Create,
+ Tags =
+{
+["ElasticServer"] = "1",
+},
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Create a new server with active directory authentication enabled
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateANewServerWithActiveDirectoryAuthenticationEnabled()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateWithAadAuthEnabled.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc4";
+ PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("westus"))
+ {
+ Sku = new PostgreSqlFlexibleServerSku("Standard_D4s_v3", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
+ AdministratorLogin = "cloudsa",
+ AdministratorLoginPassword = "password",
+ Version = PostgreSqlFlexibleServerVersion.Ver12,
+ Storage = new PostgreSqlFlexibleServerStorage()
+ {
+ StorageSizeInGB = 512,
+ AutoGrow = StorageAutoGrow.Disabled,
+ Tier = PostgreSqlManagedDiskPerformanceTier.P20,
+ },
+ AuthConfig = new PostgreSqlFlexibleServerAuthConfig()
+ {
+ ActiveDirectoryAuth = PostgreSqlFlexibleServerActiveDirectoryAuthEnum.Enabled,
+ PasswordAuth = PostgreSqlFlexibleServerPasswordAuthEnum.Enabled,
+ TenantId = Guid.Parse("tttttt-tttt-tttt-tttt-tttttttttttt"),
+ },
+ DataEncryption = new PostgreSqlFlexibleServerDataEncryption()
+ {
+ KeyType = PostgreSqlFlexibleServerKeyType.SystemManaged,
+ },
+ Backup = new PostgreSqlFlexibleServerBackupProperties()
+ {
+ BackupRetentionDays = 7,
+ GeoRedundantBackup = PostgreSqlFlexibleServerGeoRedundantBackupEnum.Disabled,
+ },
+ Network = new PostgreSqlFlexibleServerNetwork()
+ {
+ DelegatedSubnetResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
+ PrivateDnsZoneArmResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
+ },
+ HighAvailability = new PostgreSqlFlexibleServerHighAvailability()
+ {
+ Mode = PostgreSqlFlexibleServerHighAvailabilityMode.ZoneRedundant,
+ },
+ AvailabilityZone = "1",
+ CreateMode = PostgreSqlFlexibleServerCreateMode.Create,
+ Tags =
+{
+["ElasticServer"] = "1",
+},
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerCreateReplica
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_ServerCreateReplica()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateReplica.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc5rep";
+ PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("westus"))
+ {
+ Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned)
+ {
+ UserAssignedIdentities =
+{
+["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"] = new UserAssignedIdentity(),
+},
+ },
+ DataEncryption = new PostgreSqlFlexibleServerDataEncryption()
+ {
+ PrimaryKeyUri = new Uri("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787"),
+ PrimaryUserAssignedIdentityId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"),
+ GeoBackupKeyUri = new Uri(""),
+ GeoBackupUserAssignedIdentityId = "",
+ KeyType = PostgreSqlFlexibleServerKeyType.AzureKeyVault,
+ },
+ SourceServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/sourcepgservername"),
+ PointInTimeUtc = DateTimeOffset.Parse("2021-06-27T00:04:59.4078005+00:00"),
+ CreateMode = PostgreSqlFlexibleServerCreateMode.Replica,
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerCreateReviveDropped
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_ServerCreateReviveDropped()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateReviveDropped.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc5-rev";
+ PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("westus"))
+ {
+ SourceServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBforPostgreSQL/flexibleServers/pgtestsvc5"),
+ PointInTimeUtc = DateTimeOffset.Parse("2023-04-27T00:04:59.4078005+00:00"),
+ CreateMode = PostgreSqlFlexibleServerCreateMode.ReviveDropped,
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerCreateWithDataEncryptionEnabled
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_ServerCreateWithDataEncryptionEnabled()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCreateWithDataEncryptionEnabled.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc4";
+ PostgreSqlFlexibleServerData data = new PostgreSqlFlexibleServerData(new AzureLocation("westus"))
+ {
+ Sku = new PostgreSqlFlexibleServerSku("Standard_D4s_v3", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
+ Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned)
+ {
+ UserAssignedIdentities =
+{
+["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"] = new UserAssignedIdentity(),
+},
+ },
+ AdministratorLogin = "cloudsa",
+ AdministratorLoginPassword = "password",
+ Version = PostgreSqlFlexibleServerVersion.Ver12,
+ Storage = new PostgreSqlFlexibleServerStorage()
+ {
+ StorageSizeInGB = 512,
+ AutoGrow = StorageAutoGrow.Disabled,
+ },
+ DataEncryption = new PostgreSqlFlexibleServerDataEncryption()
+ {
+ PrimaryKeyUri = new Uri("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787"),
+ PrimaryUserAssignedIdentityId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"),
+ GeoBackupKeyUri = new Uri(""),
+ GeoBackupUserAssignedIdentityId = "",
+ KeyType = PostgreSqlFlexibleServerKeyType.AzureKeyVault,
+ },
+ Backup = new PostgreSqlFlexibleServerBackupProperties()
+ {
+ BackupRetentionDays = 7,
+ GeoRedundantBackup = PostgreSqlFlexibleServerGeoRedundantBackupEnum.Disabled,
+ },
+ Network = new PostgreSqlFlexibleServerNetwork()
+ {
+ DelegatedSubnetResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/test-vnet-subnet"),
+ PrivateDnsZoneArmResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourcegroups/testrg/providers/Microsoft.Network/privateDnsZones/test-private-dns-zone.postgres.database.azure.com"),
+ },
+ HighAvailability = new PostgreSqlFlexibleServerHighAvailability()
+ {
+ Mode = PostgreSqlFlexibleServerHighAvailabilityMode.ZoneRedundant,
+ },
+ AvailabilityZone = "1",
+ CreateMode = PostgreSqlFlexibleServerCreateMode.Create,
+ Tags =
+{
+["ElasticServer"] = "1",
+},
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, data);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ServerGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGet.json
+ // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc1";
+ PostgreSqlFlexibleServerResource result = await collection.GetAsync(serverName);
+
+ // 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_ServerGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGet.json
+ // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc1";
+ bool result = await collection.ExistsAsync(serverName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // ServerGetWithVnet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ServerGetWithVnet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGetWithVnet.json
+ // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc4";
+ PostgreSqlFlexibleServerResource result = await collection.GetAsync(serverName);
+
+ // 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerGetWithVnet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_ServerGetWithVnet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGetWithVnet.json
+ // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc4";
+ bool result = await collection.ExistsAsync(serverName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // ServerListByResourceGroup
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ServerListByResourceGroup()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerListByResourceGroup.json
+ // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ReplicasListByServer
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetReplicas_ReplicasListByServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ReplicasListByServer.json
+ // this example is just showing the usage of "Replicas_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerResource
+ PostgreSqlFlexibleServerCollection collection = resourceGroupResource.GetPostgreSqlFlexibleServers();
+
+ // invoke the operation and iterate over the result
+ string serverName = "sourcepgservername";
+ await foreach (PostgreSqlFlexibleServerResource item in collection.GetReplicasAsync(serverName))
+ {
+ // 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
+ PostgreSqlFlexibleServerData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerConfigurationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerConfigurationCollection.cs
new file mode 100644
index 000000000000..fce6949afb5e
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerConfigurationCollection.cs
@@ -0,0 +1,164 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerConfigurationCollection
+ {
+ // ConfigurationList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ConfigurationList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationListByServer.json
+ // this example is just showing the usage of "Configurations_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerConfigurationResource
+ PostgreSqlFlexibleServerConfigurationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerConfigurations();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlFlexibleServerConfigurationResource 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
+ PostgreSqlFlexibleServerConfigurationData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ConfigurationGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ConfigurationGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationGet.json
+ // this example is just showing the usage of "Configurations_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerConfigurationResource
+ PostgreSqlFlexibleServerConfigurationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerConfigurations();
+
+ // invoke the operation
+ string configurationName = "array_nulls";
+ PostgreSqlFlexibleServerConfigurationResource result = await collection.GetAsync(configurationName);
+
+ // 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
+ PostgreSqlFlexibleServerConfigurationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ConfigurationGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_ConfigurationGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationGet.json
+ // this example is just showing the usage of "Configurations_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerConfigurationResource
+ PostgreSqlFlexibleServerConfigurationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerConfigurations();
+
+ // invoke the operation
+ string configurationName = "array_nulls";
+ bool result = await collection.ExistsAsync(configurationName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Update a user configuration
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_UpdateAUserConfiguration()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationUpdate.json
+ // this example is just showing the usage of "Configurations_Put" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerConfigurationResource
+ PostgreSqlFlexibleServerConfigurationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerConfigurations();
+
+ // invoke the operation
+ string configurationName = "event_scheduler";
+ PostgreSqlFlexibleServerConfigurationData data = new PostgreSqlFlexibleServerConfigurationData()
+ {
+ Value = "on",
+ Source = "user-override",
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, configurationName, data);
+ PostgreSqlFlexibleServerConfigurationResource 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
+ PostgreSqlFlexibleServerConfigurationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerConfigurationResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerConfigurationResource.cs
new file mode 100644
index 000000000000..4f46abf4d161
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerConfigurationResource.cs
@@ -0,0 +1,90 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerConfigurationResource
+ {
+ // ConfigurationGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ConfigurationGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationGet.json
+ // this example is just showing the usage of "Configurations_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 PostgreSqlFlexibleServerConfigurationResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerConfigurationResource, please refer to the document of PostgreSqlFlexibleServerConfigurationResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ string configurationName = "array_nulls";
+ ResourceIdentifier postgreSqlFlexibleServerConfigurationResourceId = PostgreSqlFlexibleServerConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, configurationName);
+ PostgreSqlFlexibleServerConfigurationResource postgreSqlFlexibleServerConfiguration = client.GetPostgreSqlFlexibleServerConfigurationResource(postgreSqlFlexibleServerConfigurationResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerConfigurationResource result = await postgreSqlFlexibleServerConfiguration.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
+ PostgreSqlFlexibleServerConfigurationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Update a user configuration
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_UpdateAUserConfiguration()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ConfigurationUpdate.json
+ // this example is just showing the usage of "Configurations_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 PostgreSqlFlexibleServerConfigurationResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerConfigurationResource, please refer to the document of PostgreSqlFlexibleServerConfigurationResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ string configurationName = "event_scheduler";
+ ResourceIdentifier postgreSqlFlexibleServerConfigurationResourceId = PostgreSqlFlexibleServerConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, configurationName);
+ PostgreSqlFlexibleServerConfigurationResource postgreSqlFlexibleServerConfiguration = client.GetPostgreSqlFlexibleServerConfigurationResource(postgreSqlFlexibleServerConfigurationResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerConfigurationData data = new PostgreSqlFlexibleServerConfigurationData()
+ {
+ Value = "on",
+ Source = "user-override",
+ };
+ ArmOperation lro = await postgreSqlFlexibleServerConfiguration.UpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlFlexibleServerConfigurationResource 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
+ PostgreSqlFlexibleServerConfigurationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerDatabaseCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerDatabaseCollection.cs
new file mode 100644
index 000000000000..06adde43546c
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerDatabaseCollection.cs
@@ -0,0 +1,164 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerDatabaseCollection
+ {
+ // Create a database
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateADatabase()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseCreate.json
+ // this example is just showing the usage of "Databases_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerDatabaseResource
+ PostgreSqlFlexibleServerDatabaseCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerDatabases();
+
+ // invoke the operation
+ string databaseName = "db1";
+ PostgreSqlFlexibleServerDatabaseData data = new PostgreSqlFlexibleServerDatabaseData()
+ {
+ Charset = "utf8",
+ Collation = "en_US.utf8",
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, databaseName, data);
+ PostgreSqlFlexibleServerDatabaseResource 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
+ PostgreSqlFlexibleServerDatabaseData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a database
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetADatabase()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseGet.json
+ // this example is just showing the usage of "Databases_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerDatabaseResource
+ PostgreSqlFlexibleServerDatabaseCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerDatabases();
+
+ // invoke the operation
+ string databaseName = "db1";
+ PostgreSqlFlexibleServerDatabaseResource result = await collection.GetAsync(databaseName);
+
+ // 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
+ PostgreSqlFlexibleServerDatabaseData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a database
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetADatabase()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseGet.json
+ // this example is just showing the usage of "Databases_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerDatabaseResource
+ PostgreSqlFlexibleServerDatabaseCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerDatabases();
+
+ // invoke the operation
+ string databaseName = "db1";
+ bool result = await collection.ExistsAsync(databaseName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // List databases in a server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ListDatabasesInAServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabasesListByServer.json
+ // this example is just showing the usage of "Databases_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerDatabaseResource
+ PostgreSqlFlexibleServerDatabaseCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerDatabases();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlFlexibleServerDatabaseResource 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
+ PostgreSqlFlexibleServerDatabaseData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerDatabaseResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerDatabaseResource.cs
new file mode 100644
index 000000000000..41c9b31286ab
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerDatabaseResource.cs
@@ -0,0 +1,118 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerDatabaseResource
+ {
+ // Create a database
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_CreateADatabase()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseCreate.json
+ // this example is just showing the usage of "Databases_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerDatabaseResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerDatabaseResource, please refer to the document of PostgreSqlFlexibleServerDatabaseResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string databaseName = "db1";
+ ResourceIdentifier postgreSqlFlexibleServerDatabaseResourceId = PostgreSqlFlexibleServerDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName);
+ PostgreSqlFlexibleServerDatabaseResource postgreSqlFlexibleServerDatabase = client.GetPostgreSqlFlexibleServerDatabaseResource(postgreSqlFlexibleServerDatabaseResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerDatabaseData data = new PostgreSqlFlexibleServerDatabaseData()
+ {
+ Charset = "utf8",
+ Collation = "en_US.utf8",
+ };
+ ArmOperation lro = await postgreSqlFlexibleServerDatabase.UpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlFlexibleServerDatabaseResource 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
+ PostgreSqlFlexibleServerDatabaseData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Delete a database
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_DeleteADatabase()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseDelete.json
+ // this example is just showing the usage of "Databases_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 PostgreSqlFlexibleServerDatabaseResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerDatabaseResource, please refer to the document of PostgreSqlFlexibleServerDatabaseResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string databaseName = "db1";
+ ResourceIdentifier postgreSqlFlexibleServerDatabaseResourceId = PostgreSqlFlexibleServerDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName);
+ PostgreSqlFlexibleServerDatabaseResource postgreSqlFlexibleServerDatabase = client.GetPostgreSqlFlexibleServerDatabaseResource(postgreSqlFlexibleServerDatabaseResourceId);
+
+ // invoke the operation
+ await postgreSqlFlexibleServerDatabase.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // Get a database
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetADatabase()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/DatabaseGet.json
+ // this example is just showing the usage of "Databases_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 PostgreSqlFlexibleServerDatabaseResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerDatabaseResource, please refer to the document of PostgreSqlFlexibleServerDatabaseResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ string databaseName = "db1";
+ ResourceIdentifier postgreSqlFlexibleServerDatabaseResourceId = PostgreSqlFlexibleServerDatabaseResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, databaseName);
+ PostgreSqlFlexibleServerDatabaseResource postgreSqlFlexibleServerDatabase = client.GetPostgreSqlFlexibleServerDatabaseResource(postgreSqlFlexibleServerDatabaseResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerDatabaseResource result = await postgreSqlFlexibleServerDatabase.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
+ PostgreSqlFlexibleServerDatabaseData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerFirewallRuleCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerFirewallRuleCollection.cs
new file mode 100644
index 000000000000..de5714383984
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerFirewallRuleCollection.cs
@@ -0,0 +1,161 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Net;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerFirewallRuleCollection
+ {
+ // FirewallRuleCreate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_FirewallRuleCreate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleCreate.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerFirewallRuleResource
+ PostgreSqlFlexibleServerFirewallRuleCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerFirewallRules();
+
+ // invoke the operation
+ string firewallRuleName = "rule1";
+ PostgreSqlFlexibleServerFirewallRuleData data = new PostgreSqlFlexibleServerFirewallRuleData(IPAddress.Parse("0.0.0.0"), IPAddress.Parse("255.255.255.255"));
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, firewallRuleName, data);
+ PostgreSqlFlexibleServerFirewallRuleResource 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
+ PostgreSqlFlexibleServerFirewallRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // FirewallRuleList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_FirewallRuleList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleGet.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerFirewallRuleResource
+ PostgreSqlFlexibleServerFirewallRuleCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerFirewallRules();
+
+ // invoke the operation
+ string firewallRuleName = "rule1";
+ PostgreSqlFlexibleServerFirewallRuleResource result = await collection.GetAsync(firewallRuleName);
+
+ // 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
+ PostgreSqlFlexibleServerFirewallRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // FirewallRuleList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_FirewallRuleList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleGet.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerFirewallRuleResource
+ PostgreSqlFlexibleServerFirewallRuleCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerFirewallRules();
+
+ // invoke the operation
+ string firewallRuleName = "rule1";
+ bool result = await collection.ExistsAsync(firewallRuleName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // FirewallRuleList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_FirewallRuleList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleListByServer.json
+ // this example is just showing the usage of "FirewallRules_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlFlexibleServerFirewallRuleResource
+ PostgreSqlFlexibleServerFirewallRuleCollection collection = postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerFirewallRules();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlFlexibleServerFirewallRuleResource 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
+ PostgreSqlFlexibleServerFirewallRuleData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerFirewallRuleResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerFirewallRuleResource.cs
new file mode 100644
index 000000000000..3a12ebab4a88
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerFirewallRuleResource.cs
@@ -0,0 +1,115 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Net;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerFirewallRuleResource
+ {
+ // FirewallRuleCreate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_FirewallRuleCreate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleCreate.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlFlexibleServerFirewallRuleResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerFirewallRuleResource, please refer to the document of PostgreSqlFlexibleServerFirewallRuleResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ string firewallRuleName = "rule1";
+ ResourceIdentifier postgreSqlFlexibleServerFirewallRuleResourceId = PostgreSqlFlexibleServerFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, firewallRuleName);
+ PostgreSqlFlexibleServerFirewallRuleResource postgreSqlFlexibleServerFirewallRule = client.GetPostgreSqlFlexibleServerFirewallRuleResource(postgreSqlFlexibleServerFirewallRuleResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerFirewallRuleData data = new PostgreSqlFlexibleServerFirewallRuleData(IPAddress.Parse("0.0.0.0"), IPAddress.Parse("255.255.255.255"));
+ ArmOperation lro = await postgreSqlFlexibleServerFirewallRule.UpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlFlexibleServerFirewallRuleResource 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
+ PostgreSqlFlexibleServerFirewallRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // FirewallRuleDelete
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_FirewallRuleDelete()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleDelete.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlFlexibleServerFirewallRuleResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerFirewallRuleResource, please refer to the document of PostgreSqlFlexibleServerFirewallRuleResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ string firewallRuleName = "rule1";
+ ResourceIdentifier postgreSqlFlexibleServerFirewallRuleResourceId = PostgreSqlFlexibleServerFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, firewallRuleName);
+ PostgreSqlFlexibleServerFirewallRuleResource postgreSqlFlexibleServerFirewallRule = client.GetPostgreSqlFlexibleServerFirewallRuleResource(postgreSqlFlexibleServerFirewallRuleResourceId);
+
+ // invoke the operation
+ await postgreSqlFlexibleServerFirewallRule.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // FirewallRuleList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_FirewallRuleList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/FirewallRuleGet.json
+ // this example is just showing the usage of "FirewallRules_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 PostgreSqlFlexibleServerFirewallRuleResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerFirewallRuleResource, please refer to the document of PostgreSqlFlexibleServerFirewallRuleResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ string firewallRuleName = "rule1";
+ ResourceIdentifier postgreSqlFlexibleServerFirewallRuleResourceId = PostgreSqlFlexibleServerFirewallRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, firewallRuleName);
+ PostgreSqlFlexibleServerFirewallRuleResource postgreSqlFlexibleServerFirewallRule = client.GetPostgreSqlFlexibleServerFirewallRuleResource(postgreSqlFlexibleServerFirewallRuleResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerFirewallRuleResource result = await postgreSqlFlexibleServerFirewallRule.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
+ PostgreSqlFlexibleServerFirewallRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerResource.cs
new file mode 100644
index 000000000000..8428494bd42e
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlFlexibleServerResource.cs
@@ -0,0 +1,645 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.Models;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlFlexibleServerResource
+ {
+ // ServerCapabilitiesList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetServerCapabilities_ServerCapabilitiesList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerCapabilities.json
+ // this example is just showing the usage of "ServerCapabilities_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlFlexibleServerCapabilityProperties item in postgreSqlFlexibleServer.GetServerCapabilitiesAsync())
+ {
+ Console.WriteLine($"Succeeded: {item}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ServerUpdate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_ServerUpdate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdate.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerPatch patch = new PostgreSqlFlexibleServerPatch()
+ {
+ Sku = new PostgreSqlFlexibleServerSku("Standard_D8s_v3", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
+ AdministratorLoginPassword = "newpassword",
+ Storage = new PostgreSqlFlexibleServerStorage()
+ {
+ StorageSizeInGB = 1024,
+ AutoGrow = StorageAutoGrow.Enabled,
+ Tier = PostgreSqlManagedDiskPerformanceTier.P30,
+ },
+ Backup = new PostgreSqlFlexibleServerBackupProperties()
+ {
+ BackupRetentionDays = 20,
+ },
+ CreateMode = PostgreSqlFlexibleServerCreateModeForUpdate.Update,
+ };
+ ArmOperation lro = await postgreSqlFlexibleServer.UpdateAsync(WaitUntil.Completed, patch);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerUpdateWithAadAuthEnabled
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_ServerUpdateWithAadAuthEnabled()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithAadAuthEnabled.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerPatch patch = new PostgreSqlFlexibleServerPatch()
+ {
+ Sku = new PostgreSqlFlexibleServerSku("Standard_D8s_v3", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
+ AdministratorLoginPassword = "newpassword",
+ Storage = new PostgreSqlFlexibleServerStorage()
+ {
+ StorageSizeInGB = 1024,
+ AutoGrow = StorageAutoGrow.Disabled,
+ Tier = PostgreSqlManagedDiskPerformanceTier.P30,
+ },
+ Backup = new PostgreSqlFlexibleServerBackupProperties()
+ {
+ BackupRetentionDays = 20,
+ },
+ AuthConfig = new PostgreSqlFlexibleServerAuthConfig()
+ {
+ ActiveDirectoryAuth = PostgreSqlFlexibleServerActiveDirectoryAuthEnum.Enabled,
+ PasswordAuth = PostgreSqlFlexibleServerPasswordAuthEnum.Enabled,
+ TenantId = Guid.Parse("tttttt-tttt-tttt-tttt-tttttttttttt"),
+ },
+ CreateMode = PostgreSqlFlexibleServerCreateModeForUpdate.Update,
+ };
+ ArmOperation lro = await postgreSqlFlexibleServer.UpdateAsync(WaitUntil.Completed, patch);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerUpdateWithCustomerMaintenanceWindow
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_ServerUpdateWithCustomerMaintenanceWindow()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithCustomerMaintenanceWindow.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerPatch patch = new PostgreSqlFlexibleServerPatch()
+ {
+ MaintenanceWindow = new PostgreSqlFlexibleServerMaintenanceWindow()
+ {
+ CustomWindow = "Enabled",
+ StartHour = 8,
+ StartMinute = 0,
+ DayOfWeek = 0,
+ },
+ CreateMode = PostgreSqlFlexibleServerCreateModeForUpdate.Update,
+ };
+ ArmOperation lro = await postgreSqlFlexibleServer.UpdateAsync(WaitUntil.Completed, patch);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerUpdateWithDataEncryptionEnabled
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_ServerUpdateWithDataEncryptionEnabled()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithDataEncryptionEnabled.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerPatch patch = new PostgreSqlFlexibleServerPatch()
+ {
+ Sku = new PostgreSqlFlexibleServerSku("Standard_D8s_v3", PostgreSqlFlexibleServerSkuTier.GeneralPurpose),
+ Identity = new PostgreSqlFlexibleServerUserAssignedIdentity(PostgreSqlFlexibleServerIdentityType.UserAssigned)
+ {
+ UserAssignedIdentities =
+{
+["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity"] = new UserAssignedIdentity(),
+["/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"] = new UserAssignedIdentity(),
+},
+ },
+ AdministratorLoginPassword = "newpassword",
+ Backup = new PostgreSqlFlexibleServerBackupProperties()
+ {
+ BackupRetentionDays = 20,
+ },
+ DataEncryption = new PostgreSqlFlexibleServerDataEncryption()
+ {
+ PrimaryKeyUri = new Uri("https://test-kv.vault.azure.net/keys/test-key1/77f57315bab34b0189daa113fbc78787"),
+ PrimaryUserAssignedIdentityId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-usermanagedidentity"),
+ GeoBackupKeyUri = new Uri("https://test-geo-kv.vault.azure.net/keys/test-key1/66f57315bab34b0189daa113fbc78787"),
+ GeoBackupUserAssignedIdentityId = "/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testresourcegroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/test-geo-usermanagedidentity",
+ KeyType = PostgreSqlFlexibleServerKeyType.AzureKeyVault,
+ },
+ CreateMode = PostgreSqlFlexibleServerCreateModeForUpdate.Update,
+ };
+ ArmOperation lro = await postgreSqlFlexibleServer.UpdateAsync(WaitUntil.Completed, patch);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerUpdateWithMajorVersionUpgrade
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_ServerUpdateWithMajorVersionUpgrade()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerUpdateWithMajorVersionUpgrade.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerPatch patch = new PostgreSqlFlexibleServerPatch()
+ {
+ Version = PostgreSqlFlexibleServerVersion.Ver14,
+ CreateMode = PostgreSqlFlexibleServerCreateModeForUpdate.Update,
+ };
+ ArmOperation lro = await postgreSqlFlexibleServer.UpdateAsync(WaitUntil.Completed, patch);
+ PostgreSqlFlexibleServerResource 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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerDelete
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_ServerDelete()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerDelete.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ await postgreSqlFlexibleServer.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ServerGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ServerGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGet.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc1";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerResource result = await postgreSqlFlexibleServer.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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerGetWithVnet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ServerGetWithVnet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerGetWithVnet.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerResource result = await postgreSqlFlexibleServer.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
+ PostgreSqlFlexibleServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetPostgreSqlFlexibleServers_ServerList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerList.json
+ // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
+ SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlFlexibleServerResource item in subscriptionResource.GetPostgreSqlFlexibleServersAsync())
+ {
+ // 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
+ PostgreSqlFlexibleServerData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ServerRestart
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Restart_ServerRestart()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerRestart.json
+ // this example is just showing the usage of "Servers_Restart" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ await postgreSqlFlexibleServer.RestartAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ServerRestartWithFailover
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Restart_ServerRestartWithFailover()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerRestartWithFailover.json
+ // this example is just showing the usage of "Servers_Restart" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerRestartParameter postgreSqlFlexibleServerRestartParameter = new PostgreSqlFlexibleServerRestartParameter()
+ {
+ RestartWithFailover = true,
+ FailoverMode = PostgreSqlFlexibleServerFailoverMode.ForcedFailover,
+ };
+ await postgreSqlFlexibleServer.RestartAsync(WaitUntil.Completed, postgreSqlFlexibleServerRestartParameter: postgreSqlFlexibleServerRestartParameter);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ServerStart
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Start_ServerStart()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerStart.json
+ // this example is just showing the usage of "Servers_Start" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ await postgreSqlFlexibleServer.StartAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ServerStop
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Stop_ServerStop()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/ServerStop.json
+ // this example is just showing the usage of "Servers_Stop" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ await postgreSqlFlexibleServer.StopAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // CheckMigrationNameAvailability
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CheckPostgreSqlMigrationNameAvailability_CheckMigrationNameAvailability()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckMigrationNameAvailability.json
+ // this example is just showing the usage of "CheckMigrationNameAvailability" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string targetDbServerName = "testtarget";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlCheckMigrationNameAvailabilityContent content = new PostgreSqlCheckMigrationNameAvailabilityContent("name1", new ResourceType("Microsoft.DBforPostgreSQL/flexibleServers/migrations"));
+ PostgreSqlCheckMigrationNameAvailabilityContent result = await postgreSqlFlexibleServer.CheckPostgreSqlMigrationNameAvailabilityAsync(content);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // List all server log files for a server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetPostgreSqlFlexibleServerLogFiles_ListAllServerLogFilesForAServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LogFilesListByServer.json
+ // this example is just showing the usage of "LogFiles_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "postgresqltestsvc1";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlFlexibleServerLogFile item in postgreSqlFlexibleServer.GetPostgreSqlFlexibleServerLogFilesAsync())
+ {
+ Console.WriteLine($"Succeeded: {item}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // Sample_Prebackup
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task TriggerLtrPreBackupFlexibleServer_SamplePrebackup()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionPreBackup.json
+ // this example is just showing the usage of "FlexibleServer_TriggerLtrPreBackup" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "rgLongTermRetention";
+ string serverName = "pgsqlltrtestserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerLtrPreBackupContent content = new PostgreSqlFlexibleServerLtrPreBackupContent(new PostgreSqlFlexibleServerBackupSettings("backup1"));
+ PostgreSqlFlexibleServerLtrPreBackupResult result = await postgreSqlFlexibleServer.TriggerLtrPreBackupFlexibleServerAsync(content);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Sample_ExecuteBackup
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task StartLtrBackupFlexibleServer_SampleExecuteBackup()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionBackup.json
+ // this example is just showing the usage of "FlexibleServer_StartLtrBackup" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "rgLongTermRetention";
+ string serverName = "pgsqlltrtestserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerLtrBackupContent content = new PostgreSqlFlexibleServerLtrBackupContent(new PostgreSqlFlexibleServerBackupSettings("backup1"), new PostgreSqlFlexibleServerBackupStoreDetails(new string[]
+ {
+"sasuri"
+ }));
+ ArmOperation lro = await postgreSqlFlexibleServer.StartLtrBackupFlexibleServerAsync(WaitUntil.Completed, content);
+ PostgreSqlFlexibleServerLtrBackupResult result = lro.Value;
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlLtrServerBackupOperationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlLtrServerBackupOperationCollection.cs
new file mode 100644
index 000000000000..a2769c985b45
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlLtrServerBackupOperationCollection.cs
@@ -0,0 +1,122 @@
+// 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;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlLtrServerBackupOperationCollection
+ {
+ // Sample
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_Sample()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationGet.json
+ // this example is just showing the usage of "ltrBackupOperations_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "rgLongTermRetention";
+ string serverName = "pgsqlltrtestserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlLtrServerBackupOperationResource
+ PostgreSqlLtrServerBackupOperationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlLtrServerBackupOperations();
+
+ // invoke the operation
+ string backupName = "backup1";
+ PostgreSqlLtrServerBackupOperationResource result = await collection.GetAsync(backupName);
+
+ // 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
+ PostgreSqlLtrServerBackupOperationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Sample
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_Sample()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationGet.json
+ // this example is just showing the usage of "ltrBackupOperations_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "rgLongTermRetention";
+ string serverName = "pgsqlltrtestserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlLtrServerBackupOperationResource
+ PostgreSqlLtrServerBackupOperationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlLtrServerBackupOperations();
+
+ // invoke the operation
+ string backupName = "backup1";
+ bool result = await collection.ExistsAsync(backupName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Sample List of Long Tern Retention Operations by Flexible Server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_SampleListOfLongTernRetentionOperationsByFlexibleServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationListByServer.json
+ // this example is just showing the usage of "ltrBackupOperations_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "rgLongTermRetention";
+ string serverName = "pgsqlltrtestserver";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlLtrServerBackupOperationResource
+ PostgreSqlLtrServerBackupOperationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlLtrServerBackupOperations();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlLtrServerBackupOperationResource 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
+ PostgreSqlLtrServerBackupOperationData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlLtrServerBackupOperationResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlLtrServerBackupOperationResource.cs
new file mode 100644
index 000000000000..740f0e8d51b8
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlLtrServerBackupOperationResource.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;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlLtrServerBackupOperationResource
+ {
+ // Sample
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_Sample()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/LongTermRetentionOperationGet.json
+ // this example is just showing the usage of "ltrBackupOperations_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 PostgreSqlLtrServerBackupOperationResource created on azure
+ // for more information of creating PostgreSqlLtrServerBackupOperationResource, please refer to the document of PostgreSqlLtrServerBackupOperationResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "rgLongTermRetention";
+ string serverName = "pgsqlltrtestserver";
+ string backupName = "backup1";
+ ResourceIdentifier postgreSqlLtrServerBackupOperationResourceId = PostgreSqlLtrServerBackupOperationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, backupName);
+ PostgreSqlLtrServerBackupOperationResource postgreSqlLtrServerBackupOperation = client.GetPostgreSqlLtrServerBackupOperationResource(postgreSqlLtrServerBackupOperationResourceId);
+
+ // invoke the operation
+ PostgreSqlLtrServerBackupOperationResource result = await postgreSqlLtrServerBackupOperation.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
+ PostgreSqlLtrServerBackupOperationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlMigrationCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlMigrationCollection.cs
new file mode 100644
index 000000000000..f95efbe08309
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlMigrationCollection.cs
@@ -0,0 +1,222 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlMigrationCollection
+ {
+ // Migrations Create by passing user names
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_MigrationsCreateByPassingUserNames()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Create_With_Other_Users.json
+ // this example is just showing the usage of "Migrations_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string targetDbServerName = "testtarget";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlMigrationResource
+ PostgreSqlMigrationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlMigrations();
+
+ // invoke the operation
+ string migrationName = "testmigration";
+ PostgreSqlMigrationData data = new PostgreSqlMigrationData(new AzureLocation("westus"))
+ {
+ MigrationMode = PostgreSqlMigrationMode.Offline,
+ SourceDbServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource"),
+ SecretParameters = new PostgreSqlMigrationSecretParameters(new PostgreSqlMigrationAdminCredentials("xxxxxxxx", "xxxxxxxx"))
+ {
+ SourceServerUsername = "newadmin@testsource",
+ TargetServerUsername = "targetadmin",
+ },
+ DbsToMigrate =
+{
+"db1","db2","db3","db4"
+},
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, migrationName, data);
+ PostgreSqlMigrationResource 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
+ PostgreSqlMigrationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Migrations_Create
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_MigrationsCreate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Create.json
+ // this example is just showing the usage of "Migrations_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string targetDbServerName = "testtarget";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlMigrationResource
+ PostgreSqlMigrationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlMigrations();
+
+ // invoke the operation
+ string migrationName = "testmigration";
+ PostgreSqlMigrationData data = new PostgreSqlMigrationData(new AzureLocation("westus"))
+ {
+ MigrationMode = PostgreSqlMigrationMode.Offline,
+ SourceDbServerResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.DBForPostgreSql/servers/testsource"),
+ SecretParameters = new PostgreSqlMigrationSecretParameters(new PostgreSqlMigrationAdminCredentials("xxxxxxxx", "xxxxxxxx")),
+ DbsToMigrate =
+{
+"db1","db2","db3","db4"
+},
+ OverwriteDbsInTarget = PostgreSqlMigrationOverwriteDbsInTarget.True,
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, migrationName, data);
+ PostgreSqlMigrationResource 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
+ PostgreSqlMigrationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Migrations_Get
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_MigrationsGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Get.json
+ // this example is just showing the usage of "Migrations_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string targetDbServerName = "testtarget";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlMigrationResource
+ PostgreSqlMigrationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlMigrations();
+
+ // invoke the operation
+ string migrationName = "testmigration";
+ PostgreSqlMigrationResource result = await collection.GetAsync(migrationName);
+
+ // 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
+ PostgreSqlMigrationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Migrations_Get
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_MigrationsGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Get.json
+ // this example is just showing the usage of "Migrations_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 PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string targetDbServerName = "testtarget";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlMigrationResource
+ PostgreSqlMigrationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlMigrations();
+
+ // invoke the operation
+ string migrationName = "testmigration";
+ bool result = await collection.ExistsAsync(migrationName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Migrations_ListByTargetServer
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_MigrationsListByTargetServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_ListByTargetServer.json
+ // this example is just showing the usage of "Migrations_ListByTargetServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlFlexibleServerResource created on azure
+ // for more information of creating PostgreSqlFlexibleServerResource, please refer to the document of PostgreSqlFlexibleServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string targetDbServerName = "testtarget";
+ ResourceIdentifier postgreSqlFlexibleServerResourceId = PostgreSqlFlexibleServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName);
+ PostgreSqlFlexibleServerResource postgreSqlFlexibleServer = client.GetPostgreSqlFlexibleServerResource(postgreSqlFlexibleServerResourceId);
+
+ // get the collection of this PostgreSqlMigrationResource
+ PostgreSqlMigrationCollection collection = postgreSqlFlexibleServer.GetPostgreSqlMigrations();
+
+ // invoke the operation and iterate over the result
+ PostgreSqlMigrationListFilter? migrationListFilter = PostgreSqlMigrationListFilter.All;
+ await foreach (PostgreSqlMigrationResource item in collection.GetAllAsync(migrationListFilter: migrationListFilter))
+ {
+ // 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
+ PostgreSqlMigrationData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlMigrationResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlMigrationResource.cs
new file mode 100644
index 000000000000..9a77beeed9e7
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlMigrationResource.cs
@@ -0,0 +1,153 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_PostgreSqlMigrationResource
+ {
+ // Migrations_Get
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_MigrationsGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Get.json
+ // this example is just showing the usage of "Migrations_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 PostgreSqlMigrationResource created on azure
+ // for more information of creating PostgreSqlMigrationResource, please refer to the document of PostgreSqlMigrationResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string targetDbServerName = "testtarget";
+ string migrationName = "testmigration";
+ ResourceIdentifier postgreSqlMigrationResourceId = PostgreSqlMigrationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName, migrationName);
+ PostgreSqlMigrationResource postgreSqlMigration = client.GetPostgreSqlMigrationResource(postgreSqlMigrationResourceId);
+
+ // invoke the operation
+ PostgreSqlMigrationResource result = await postgreSqlMigration.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
+ PostgreSqlMigrationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Cancel migration
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_CancelMigration()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Cancel.json
+ // this example is just showing the usage of "Migrations_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 PostgreSqlMigrationResource created on azure
+ // for more information of creating PostgreSqlMigrationResource, please refer to the document of PostgreSqlMigrationResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string targetDbServerName = "testtarget";
+ string migrationName = "testmigration";
+ ResourceIdentifier postgreSqlMigrationResourceId = PostgreSqlMigrationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName, migrationName);
+ PostgreSqlMigrationResource postgreSqlMigration = client.GetPostgreSqlMigrationResource(postgreSqlMigrationResourceId);
+
+ // invoke the operation
+ PostgreSqlMigrationPatch patch = new PostgreSqlMigrationPatch()
+ {
+ Cancel = PostgreSqlMigrationCancel.True,
+ };
+ PostgreSqlMigrationResource result = await postgreSqlMigration.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
+ PostgreSqlMigrationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Migrations_Update
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_MigrationsUpdate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Update.json
+ // this example is just showing the usage of "Migrations_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 PostgreSqlMigrationResource created on azure
+ // for more information of creating PostgreSqlMigrationResource, please refer to the document of PostgreSqlMigrationResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string targetDbServerName = "testtarget";
+ string migrationName = "testmigration";
+ ResourceIdentifier postgreSqlMigrationResourceId = PostgreSqlMigrationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName, migrationName);
+ PostgreSqlMigrationResource postgreSqlMigration = client.GetPostgreSqlMigrationResource(postgreSqlMigrationResourceId);
+
+ // invoke the operation
+ PostgreSqlMigrationPatch patch = new PostgreSqlMigrationPatch()
+ {
+ SetupLogicalReplicationOnSourceDbIfNeeded = PostgreSqlMigrationLogicalReplicationOnSourceDb.True,
+ };
+ PostgreSqlMigrationResource result = await postgreSqlMigration.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
+ PostgreSqlMigrationData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Migrations_Delete
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_MigrationsDelete()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/Migrations_Delete.json
+ // this example is just showing the usage of "Migrations_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 PostgreSqlMigrationResource created on azure
+ // for more information of creating PostgreSqlMigrationResource, please refer to the document of PostgreSqlMigrationResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string targetDbServerName = "testtarget";
+ string migrationName = "testmigration";
+ ResourceIdentifier postgreSqlMigrationResourceId = PostgreSqlMigrationResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, targetDbServerName, migrationName);
+ PostgreSqlMigrationResource postgreSqlMigration = client.GetPostgreSqlMigrationResource(postgreSqlMigrationResourceId);
+
+ // invoke the operation
+ await postgreSqlMigration.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateEndpointConnectionCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateEndpointConnectionCollection.cs
new file mode 100644
index 000000000000..3d6ac24429fa
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateEndpointConnectionCollection.cs
@@ -0,0 +1,164 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+using Azure.ResourceManager.PostgreSql.Models;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlPrivateEndpointConnectionCollection
+ {
+ // Gets private endpoint connection.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetsPrivateEndpointConnection()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json
+ // this example is just showing the usage of "PrivateEndpointConnections_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlPrivateEndpointConnectionResource
+ PostgreSqlPrivateEndpointConnectionCollection collection = postgreSqlServer.GetPostgreSqlPrivateEndpointConnections();
+
+ // invoke the operation
+ string privateEndpointConnectionName = "private-endpoint-connection-name";
+ PostgreSqlPrivateEndpointConnectionResource 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
+ PostgreSqlPrivateEndpointConnectionData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Gets private endpoint connection.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetsPrivateEndpointConnection()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json
+ // this example is just showing the usage of "PrivateEndpointConnections_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlPrivateEndpointConnectionResource
+ PostgreSqlPrivateEndpointConnectionCollection collection = postgreSqlServer.GetPostgreSqlPrivateEndpointConnections();
+
+ // invoke the operation
+ string privateEndpointConnectionName = "private-endpoint-connection-name";
+ bool result = await collection.ExistsAsync(privateEndpointConnectionName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Approve or reject a private endpoint connection with a given name.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_ApproveOrRejectAPrivateEndpointConnectionWithAGivenName()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdate.json
+ // this example is just showing the usage of "PrivateEndpointConnections_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlPrivateEndpointConnectionResource
+ PostgreSqlPrivateEndpointConnectionCollection collection = postgreSqlServer.GetPostgreSqlPrivateEndpointConnections();
+
+ // invoke the operation
+ string privateEndpointConnectionName = "private-endpoint-connection-name";
+ PostgreSqlPrivateEndpointConnectionData data = new PostgreSqlPrivateEndpointConnectionData()
+ {
+ ConnectionState = new PostgreSqlPrivateLinkServiceConnectionStateProperty("Approved", "Approved by johndoe@contoso.com"),
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data);
+ PostgreSqlPrivateEndpointConnectionResource 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
+ PostgreSqlPrivateEndpointConnectionData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Gets list of private endpoint connections on a server.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_GetsListOfPrivateEndpointConnectionsOnAServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionList.json
+ // this example is just showing the usage of "PrivateEndpointConnections_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlPrivateEndpointConnectionResource
+ PostgreSqlPrivateEndpointConnectionCollection collection = postgreSqlServer.GetPostgreSqlPrivateEndpointConnections();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlPrivateEndpointConnectionResource 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
+ PostgreSqlPrivateEndpointConnectionData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateEndpointConnectionResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateEndpointConnectionResource.cs
new file mode 100644
index 000000000000..c69ce8d02e4e
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateEndpointConnectionResource.cs
@@ -0,0 +1,123 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+using Azure.ResourceManager.PostgreSql.Models;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlPrivateEndpointConnectionResource
+ {
+ // Gets private endpoint connection.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetsPrivateEndpointConnection()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionGet.json
+ // this example is just showing the usage of "PrivateEndpointConnections_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 PostgreSqlPrivateEndpointConnectionResource created on azure
+ // for more information of creating PostgreSqlPrivateEndpointConnectionResource, please refer to the document of PostgreSqlPrivateEndpointConnectionResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ string privateEndpointConnectionName = "private-endpoint-connection-name";
+ ResourceIdentifier postgreSqlPrivateEndpointConnectionResourceId = PostgreSqlPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, privateEndpointConnectionName);
+ PostgreSqlPrivateEndpointConnectionResource postgreSqlPrivateEndpointConnection = client.GetPostgreSqlPrivateEndpointConnectionResource(postgreSqlPrivateEndpointConnectionResourceId);
+
+ // invoke the operation
+ PostgreSqlPrivateEndpointConnectionResource result = await postgreSqlPrivateEndpointConnection.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
+ PostgreSqlPrivateEndpointConnectionData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Deletes a private endpoint connection with a given name.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_DeletesAPrivateEndpointConnectionWithAGivenName()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionDelete.json
+ // this example is just showing the usage of "PrivateEndpointConnections_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 PostgreSqlPrivateEndpointConnectionResource created on azure
+ // for more information of creating PostgreSqlPrivateEndpointConnectionResource, please refer to the document of PostgreSqlPrivateEndpointConnectionResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ string privateEndpointConnectionName = "private-endpoint-connection-name";
+ ResourceIdentifier postgreSqlPrivateEndpointConnectionResourceId = PostgreSqlPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, privateEndpointConnectionName);
+ PostgreSqlPrivateEndpointConnectionResource postgreSqlPrivateEndpointConnection = client.GetPostgreSqlPrivateEndpointConnectionResource(postgreSqlPrivateEndpointConnectionResourceId);
+
+ // invoke the operation
+ await postgreSqlPrivateEndpointConnection.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // Update private endpoint connection Tags
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_UpdatePrivateEndpointConnectionTags()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateEndpointConnectionUpdateTags.json
+ // this example is just showing the usage of "PrivateEndpointConnections_UpdateTags" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlPrivateEndpointConnectionResource created on azure
+ // for more information of creating PostgreSqlPrivateEndpointConnectionResource, please refer to the document of PostgreSqlPrivateEndpointConnectionResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ string privateEndpointConnectionName = "private-endpoint-connection-name";
+ ResourceIdentifier postgreSqlPrivateEndpointConnectionResourceId = PostgreSqlPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, privateEndpointConnectionName);
+ PostgreSqlPrivateEndpointConnectionResource postgreSqlPrivateEndpointConnection = client.GetPostgreSqlPrivateEndpointConnectionResource(postgreSqlPrivateEndpointConnectionResourceId);
+
+ // invoke the operation
+ PostgreSqlPrivateEndpointConnectionPatch patch = new PostgreSqlPrivateEndpointConnectionPatch()
+ {
+ Tags =
+{
+["key1"] = "val1",
+["key2"] = "val2",
+["key3"] = "val3",
+},
+ };
+ ArmOperation lro = await postgreSqlPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, patch);
+ PostgreSqlPrivateEndpointConnectionResource 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
+ PostgreSqlPrivateEndpointConnectionData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateLinkResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateLinkResource.cs
new file mode 100644
index 000000000000..b6df7e81e6fd
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateLinkResource.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;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlPrivateLinkResource
+ {
+ // Gets a private link resource for PostgreSQL.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetsAPrivateLinkResourceForPostgreSQL()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json
+ // this example is just showing the usage of "PrivateLinkResources_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 PostgreSqlPrivateLinkResource created on azure
+ // for more information of creating PostgreSqlPrivateLinkResource, please refer to the document of PostgreSqlPrivateLinkResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ string groupName = "plr";
+ ResourceIdentifier postgreSqlPrivateLinkResourceId = PostgreSqlPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, groupName);
+ PostgreSqlPrivateLinkResource postgreSqlPrivateLinkResource = client.GetPostgreSqlPrivateLinkResource(postgreSqlPrivateLinkResourceId);
+
+ // invoke the operation
+ PostgreSqlPrivateLinkResource result = await postgreSqlPrivateLinkResource.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
+ PostgreSqlPrivateLinkResourceData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateLinkResourceCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateLinkResourceCollection.cs
new file mode 100644
index 000000000000..2ad5a19787e9
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlPrivateLinkResourceCollection.cs
@@ -0,0 +1,122 @@
+// 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;
+using Azure.ResourceManager.PostgreSql;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlPrivateLinkResourceCollection
+ {
+ // Gets private link resources for PostgreSQL.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_GetsPrivateLinkResourcesForPostgreSQL()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesList.json
+ // this example is just showing the usage of "PrivateLinkResources_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlPrivateLinkResource
+ PostgreSqlPrivateLinkResourceCollection collection = postgreSqlServer.GetPostgreSqlPrivateLinkResources();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlPrivateLinkResource 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
+ PostgreSqlPrivateLinkResourceData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // Gets a private link resource for PostgreSQL.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetsAPrivateLinkResourceForPostgreSQL()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json
+ // this example is just showing the usage of "PrivateLinkResources_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlPrivateLinkResource
+ PostgreSqlPrivateLinkResourceCollection collection = postgreSqlServer.GetPostgreSqlPrivateLinkResources();
+
+ // invoke the operation
+ string groupName = "plr";
+ PostgreSqlPrivateLinkResource result = await collection.GetAsync(groupName);
+
+ // 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
+ PostgreSqlPrivateLinkResourceData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Gets a private link resource for PostgreSQL.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetsAPrivateLinkResourceForPostgreSQL()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2018-06-01/examples/PrivateLinkResourcesGet.json
+ // this example is just showing the usage of "PrivateLinkResources_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "Default";
+ string serverName = "test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlPrivateLinkResource
+ PostgreSqlPrivateLinkResourceCollection collection = postgreSqlServer.GetPostgreSqlPrivateLinkResources();
+
+ // invoke the operation
+ string groupName = "plr";
+ bool result = await collection.ExistsAsync(groupName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerAdministratorResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerAdministratorResource.cs
new file mode 100644
index 000000000000..92fd03305708
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerAdministratorResource.cs
@@ -0,0 +1,118 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+using Azure.ResourceManager.PostgreSql.Models;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlServerAdministratorResource
+ {
+ // ServerAdministratorGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ServerAdministratorGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminGet.json
+ // this example is just showing the usage of "ServerAdministrators_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 PostgreSqlServerAdministratorResource created on azure
+ // for more information of creating PostgreSqlServerAdministratorResource, please refer to the document of PostgreSqlServerAdministratorResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlServerAdministratorResourceId = PostgreSqlServerAdministratorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerAdministratorResource postgreSqlServerAdministrator = client.GetPostgreSqlServerAdministratorResource(postgreSqlServerAdministratorResourceId);
+
+ // invoke the operation
+ PostgreSqlServerAdministratorResource result = await postgreSqlServerAdministrator.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
+ PostgreSqlServerAdministratorData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerAdministratorCreate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_ServerAdministratorCreate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminCreateUpdate.json
+ // this example is just showing the usage of "ServerAdministrators_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 PostgreSqlServerAdministratorResource created on azure
+ // for more information of creating PostgreSqlServerAdministratorResource, please refer to the document of PostgreSqlServerAdministratorResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlServerAdministratorResourceId = PostgreSqlServerAdministratorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerAdministratorResource postgreSqlServerAdministrator = client.GetPostgreSqlServerAdministratorResource(postgreSqlServerAdministratorResourceId);
+
+ // invoke the operation
+ PostgreSqlServerAdministratorData data = new PostgreSqlServerAdministratorData()
+ {
+ AdministratorType = PostgreSqlAdministratorType.ActiveDirectory,
+ LoginAccountName = "bob@contoso.com",
+ SecureId = Guid.Parse("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"),
+ TenantId = Guid.Parse("c6b82b90-a647-49cb-8a62-0d2d3cb7ac7c"),
+ };
+ ArmOperation lro = await postgreSqlServerAdministrator.CreateOrUpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlServerAdministratorResource 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
+ PostgreSqlServerAdministratorData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerAdministratorsDelete
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_ServerAdministratorsDelete()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerAdminDelete.json
+ // this example is just showing the usage of "ServerAdministrators_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 PostgreSqlServerAdministratorResource created on azure
+ // for more information of creating PostgreSqlServerAdministratorResource, please refer to the document of PostgreSqlServerAdministratorResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlServerAdministratorResourceId = PostgreSqlServerAdministratorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerAdministratorResource postgreSqlServerAdministrator = client.GetPostgreSqlServerAdministratorResource(postgreSqlServerAdministratorResourceId);
+
+ // invoke the operation
+ await postgreSqlServerAdministrator.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerCollection.cs
new file mode 100644
index 000000000000..74fbe57fcddd
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerCollection.cs
@@ -0,0 +1,357 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+using Azure.ResourceManager.PostgreSql.Models;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlServerCollection
+ {
+ // Create a database as a point in time restore
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateADatabaseAsAPointInTimeRestore()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreatePointInTimeRestore.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TargetResourceGroup";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlServerResource
+ PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
+
+ // invoke the operation
+ string serverName = "targetserver";
+ PostgreSqlServerCreateOrUpdateContent content = new PostgreSqlServerCreateOrUpdateContent(new PostgreSqlServerPropertiesForRestore(new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver"), DateTimeOffset.Parse("2017-12-14T00:00:37.467Z")), new AzureLocation("brazilsouth"))
+ {
+ Sku = new PostgreSqlSku("B_Gen5_2")
+ {
+ Tier = PostgreSqlSkuTier.Basic,
+ Capacity = 2,
+ Family = "Gen5",
+ },
+ Tags =
+{
+["ElasticServer"] = "1",
+},
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, content);
+ PostgreSqlServerResource 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
+ PostgreSqlServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Create a new server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateANewServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreate.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlServerResource
+ PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc4";
+ PostgreSqlServerCreateOrUpdateContent content = new PostgreSqlServerCreateOrUpdateContent(new PostgreSqlServerPropertiesForDefaultCreate("cloudsa", "")
+ {
+ SslEnforcement = PostgreSqlSslEnforcementEnum.Enabled,
+ MinimalTlsVersion = PostgreSqlMinimalTlsVersionEnum.Tls1_2,
+ StorageProfile = new PostgreSqlStorageProfile()
+ {
+ BackupRetentionDays = 7,
+ GeoRedundantBackup = PostgreSqlGeoRedundantBackup.Disabled,
+ StorageInMB = 128000,
+ },
+ }, new AzureLocation("westus"))
+ {
+ Sku = new PostgreSqlSku("B_Gen5_2")
+ {
+ Tier = PostgreSqlSkuTier.Basic,
+ Capacity = 2,
+ Family = "Gen5",
+ },
+ Tags =
+{
+["ElasticServer"] = "1",
+},
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, content);
+ PostgreSqlServerResource 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
+ PostgreSqlServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Create a replica server
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateAReplicaServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateReplicaMode.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup_WestCentralUS";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlServerResource
+ PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
+
+ // invoke the operation
+ string serverName = "testserver-replica1";
+ PostgreSqlServerCreateOrUpdateContent content = new PostgreSqlServerCreateOrUpdateContent(new PostgreSqlServerPropertiesForReplica(new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup_WestCentralUS/providers/Microsoft.DBforPostgreSQL/servers/testserver-master")), new AzureLocation("westcentralus"))
+ {
+ Sku = new PostgreSqlSku("GP_Gen5_2")
+ {
+ Tier = PostgreSqlSkuTier.GeneralPurpose,
+ Capacity = 2,
+ Family = "Gen5",
+ },
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, content);
+ PostgreSqlServerResource 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
+ PostgreSqlServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Create a server as a geo restore
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateAServerAsAGeoRestore()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerCreateGeoRestoreMode.json
+ // this example is just showing the usage of "Servers_Create" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TargetResourceGroup";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlServerResource
+ PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
+
+ // invoke the operation
+ string serverName = "targetserver";
+ PostgreSqlServerCreateOrUpdateContent content = new PostgreSqlServerCreateOrUpdateContent(new PostgreSqlServerPropertiesForGeoRestore(new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/SourceResourceGroup/providers/Microsoft.DBforPostgreSQL/servers/sourceserver")), new AzureLocation("westus"))
+ {
+ Sku = new PostgreSqlSku("GP_Gen5_2")
+ {
+ Tier = PostgreSqlSkuTier.GeneralPurpose,
+ Capacity = 2,
+ Family = "Gen5",
+ },
+ Tags =
+{
+["ElasticServer"] = "1",
+},
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, serverName, content);
+ PostgreSqlServerResource 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
+ PostgreSqlServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ServerGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json
+ // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlServerResource
+ PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc1";
+ PostgreSqlServerResource result = await collection.GetAsync(serverName);
+
+ // 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
+ PostgreSqlServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_ServerGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json
+ // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlServerResource
+ PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
+
+ // invoke the operation
+ string serverName = "pgtestsvc1";
+ bool result = await collection.ExistsAsync(serverName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // ServerListByResourceGroup
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ServerListByResourceGroup()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerListByResourceGroup.json
+ // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlServerResource
+ PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlServerResource 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
+ PostgreSqlServerData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ReplicasListByServer
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetReplicas_ReplicasListByServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ReplicasListByServer.json
+ // this example is just showing the usage of "Replicas_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup_WestCentralUS";
+ ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName);
+ ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId);
+
+ // get the collection of this PostgreSqlServerResource
+ PostgreSqlServerCollection collection = resourceGroupResource.GetPostgreSqlServers();
+
+ // invoke the operation and iterate over the result
+ string serverName = "testserver-master";
+ await foreach (PostgreSqlServerResource item in collection.GetReplicasAsync(serverName))
+ {
+ // 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
+ PostgreSqlServerData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerKeyCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerKeyCollection.cs
new file mode 100644
index 000000000000..7aadc6043331
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerKeyCollection.cs
@@ -0,0 +1,165 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+using Azure.ResourceManager.PostgreSql.Models;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlServerKeyCollection
+ {
+ // List the keys for a PostgreSQL Server.
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ListTheKeysForAPostgreSQLServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyList.json
+ // this example is just showing the usage of "ServerKeys_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlServerKeyResource
+ PostgreSqlServerKeyCollection collection = postgreSqlServer.GetPostgreSqlServerKeys();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlServerKeyResource 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
+ PostgreSqlServerKeyData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // Get the PostgreSQL Server key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetThePostgreSQLServerKey()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json
+ // this example is just showing the usage of "ServerKeys_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlServerKeyResource
+ PostgreSqlServerKeyCollection collection = postgreSqlServer.GetPostgreSqlServerKeys();
+
+ // invoke the operation
+ string keyName = "someVault_someKey_01234567890123456789012345678901";
+ PostgreSqlServerKeyResource result = await collection.GetAsync(keyName);
+
+ // 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
+ PostgreSqlServerKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get the PostgreSQL Server key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetThePostgreSQLServerKey()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json
+ // this example is just showing the usage of "ServerKeys_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlServerKeyResource
+ PostgreSqlServerKeyCollection collection = postgreSqlServer.GetPostgreSqlServerKeys();
+
+ // invoke the operation
+ string keyName = "someVault_someKey_01234567890123456789012345678901";
+ bool result = await collection.ExistsAsync(keyName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Creates or updates a PostgreSQL Server key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreatesOrUpdatesAPostgreSQLServerKey()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json
+ // this example is just showing the usage of "ServerKeys_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlServerKeyResource
+ PostgreSqlServerKeyCollection collection = postgreSqlServer.GetPostgreSqlServerKeys();
+
+ // invoke the operation
+ string keyName = "someVault_someKey_01234567890123456789012345678901";
+ PostgreSqlServerKeyData data = new PostgreSqlServerKeyData()
+ {
+ ServerKeyType = PostgreSqlServerKeyType.AzureKeyVault,
+ Uri = new Uri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"),
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, keyName, data);
+ PostgreSqlServerKeyResource 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
+ PostgreSqlServerKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerKeyResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerKeyResource.cs
new file mode 100644
index 000000000000..dab6192a125b
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerKeyResource.cs
@@ -0,0 +1,119 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+using Azure.ResourceManager.PostgreSql.Models;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlServerKeyResource
+ {
+ // Get the PostgreSQL Server key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetThePostgreSQLServerKey()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyGet.json
+ // this example is just showing the usage of "ServerKeys_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 PostgreSqlServerKeyResource created on azure
+ // for more information of creating PostgreSqlServerKeyResource, please refer to the document of PostgreSqlServerKeyResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ string keyName = "someVault_someKey_01234567890123456789012345678901";
+ ResourceIdentifier postgreSqlServerKeyResourceId = PostgreSqlServerKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, keyName);
+ PostgreSqlServerKeyResource postgreSqlServerKey = client.GetPostgreSqlServerKeyResource(postgreSqlServerKeyResourceId);
+
+ // invoke the operation
+ PostgreSqlServerKeyResource result = await postgreSqlServerKey.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
+ PostgreSqlServerKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Creates or updates a PostgreSQL Server key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_CreatesOrUpdatesAPostgreSQLServerKey()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyCreateOrUpdate.json
+ // this example is just showing the usage of "ServerKeys_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 PostgreSqlServerKeyResource created on azure
+ // for more information of creating PostgreSqlServerKeyResource, please refer to the document of PostgreSqlServerKeyResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ string keyName = "someVault_someKey_01234567890123456789012345678901";
+ ResourceIdentifier postgreSqlServerKeyResourceId = PostgreSqlServerKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, keyName);
+ PostgreSqlServerKeyResource postgreSqlServerKey = client.GetPostgreSqlServerKeyResource(postgreSqlServerKeyResourceId);
+
+ // invoke the operation
+ PostgreSqlServerKeyData data = new PostgreSqlServerKeyData()
+ {
+ ServerKeyType = PostgreSqlServerKeyType.AzureKeyVault,
+ Uri = new Uri("https://someVault.vault.azure.net/keys/someKey/01234567890123456789012345678901"),
+ };
+ ArmOperation lro = await postgreSqlServerKey.UpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlServerKeyResource 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
+ PostgreSqlServerKeyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Delete the PostgreSQL Server key
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_DeleteThePostgreSQLServerKey()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2020-01-01/examples/ServerKeyDelete.json
+ // this example is just showing the usage of "ServerKeys_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 PostgreSqlServerKeyResource created on azure
+ // for more information of creating PostgreSqlServerKeyResource, please refer to the document of PostgreSqlServerKeyResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "testserver";
+ string keyName = "someVault_someKey_01234567890123456789012345678901";
+ ResourceIdentifier postgreSqlServerKeyResourceId = PostgreSqlServerKeyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, keyName);
+ PostgreSqlServerKeyResource postgreSqlServerKey = client.GetPostgreSqlServerKeyResource(postgreSqlServerKeyResourceId);
+
+ // invoke the operation
+ await postgreSqlServerKey.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerResource.cs
new file mode 100644
index 000000000000..ed008efe8e30
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerResource.cs
@@ -0,0 +1,293 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+using Azure.ResourceManager.PostgreSql.Models;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlServerResource
+ {
+ // ServerUpdate
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_ServerUpdate()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerUpdate.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // invoke the operation
+ PostgreSqlServerPatch patch = new PostgreSqlServerPatch()
+ {
+ AdministratorLoginPassword = "",
+ SslEnforcement = PostgreSqlSslEnforcementEnum.Enabled,
+ MinimalTlsVersion = PostgreSqlMinimalTlsVersionEnum.Tls1_2,
+ };
+ ArmOperation lro = await postgreSqlServer.UpdateAsync(WaitUntil.Completed, patch);
+ PostgreSqlServerResource 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
+ PostgreSqlServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerDelete
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_ServerDelete()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerDelete.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // invoke the operation
+ await postgreSqlServer.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ServerGet
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_ServerGet()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerGet.json
+ // this example is just showing the usage of "Servers_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc1";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // invoke the operation
+ PostgreSqlServerResource result = await postgreSqlServer.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
+ PostgreSqlServerData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // ServerList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetPostgreSqlServers_ServerList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerList.json
+ // this example is just showing the usage of "Servers_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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
+ SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlServerResource item in subscriptionResource.GetPostgreSqlServersAsync())
+ {
+ // 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
+ PostgreSqlServerData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ServerRestart
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Restart_ServerRestart()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerRestart.json
+ // this example is just showing the usage of "Servers_Restart" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // invoke the operation
+ await postgreSqlServer.RestartAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ConfigurationList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task UpdateConfigurations_ConfigurationList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ConfigurationsUpdateByServer.json
+ // this example is just showing the usage of "ServerParameters_ListUpdateConfigurations" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // invoke the operation
+ PostgreSqlConfigurationList value = new PostgreSqlConfigurationList();
+ ArmOperation lro = await postgreSqlServer.UpdateConfigurationsAsync(WaitUntil.Completed, value);
+ PostgreSqlConfigurationList result = lro.Value;
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // LogFileList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetLogFiles_LogFileList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/LogFileListByServer.json
+ // this example is just showing the usage of "LogFiles_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlLogFile item in postgreSqlServer.GetLogFilesAsync())
+ {
+ Console.WriteLine($"Succeeded: {item}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // ReplicasListByServer
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetRecoverableServer_ReplicasListByServer()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/RecoverableServersGet.json
+ // this example is just showing the usage of "RecoverableServers_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "testrg";
+ string serverName = "pgtestsvc4";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // invoke the operation
+ PostgreSqlRecoverableServerResourceData result = await postgreSqlServer.GetRecoverableServerAsync();
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // PerformanceTiersList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetServerBasedPerformanceTiers_PerformanceTiersList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/PerformanceTiersListByServer.json
+ // this example is just showing the usage of "ServerBasedPerformanceTier_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "testserver";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlPerformanceTierProperties item in postgreSqlServer.GetServerBasedPerformanceTiersAsync())
+ {
+ Console.WriteLine($"Succeeded: {item}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerSecurityAlertPolicyCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerSecurityAlertPolicyCollection.cs
new file mode 100644
index 000000000000..fe2ade8a83d3
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerSecurityAlertPolicyCollection.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;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+using Azure.ResourceManager.PostgreSql.Models;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlServerSecurityAlertPolicyCollection
+ {
+ // Get a server's threat detection policy
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetAServerSThreatDetectionPolicy()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json
+ // this example is just showing the usage of "ServerSecurityAlertPolicies_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "securityalert-4799";
+ string serverName = "securityalert-6440";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlServerSecurityAlertPolicyResource
+ PostgreSqlServerSecurityAlertPolicyCollection collection = postgreSqlServer.GetPostgreSqlServerSecurityAlertPolicies();
+
+ // invoke the operation
+ PostgreSqlSecurityAlertPolicyName securityAlertPolicyName = PostgreSqlSecurityAlertPolicyName.Default;
+ PostgreSqlServerSecurityAlertPolicyResource result = await collection.GetAsync(securityAlertPolicyName);
+
+ // 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
+ PostgreSqlServerSecurityAlertPolicyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Get a server's threat detection policy
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetAServerSThreatDetectionPolicy()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json
+ // this example is just showing the usage of "ServerSecurityAlertPolicies_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "securityalert-4799";
+ string serverName = "securityalert-6440";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlServerSecurityAlertPolicyResource
+ PostgreSqlServerSecurityAlertPolicyCollection collection = postgreSqlServer.GetPostgreSqlServerSecurityAlertPolicies();
+
+ // invoke the operation
+ PostgreSqlSecurityAlertPolicyName securityAlertPolicyName = PostgreSqlSecurityAlertPolicyName.Default;
+ bool result = await collection.ExistsAsync(securityAlertPolicyName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Update a server's threat detection policy with all parameters
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_UpdateAServerSThreatDetectionPolicyWithAllParameters()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json
+ // this example is just showing the usage of "ServerSecurityAlertPolicies_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "securityalert-4799";
+ string serverName = "securityalert-6440";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlServerSecurityAlertPolicyResource
+ PostgreSqlServerSecurityAlertPolicyCollection collection = postgreSqlServer.GetPostgreSqlServerSecurityAlertPolicies();
+
+ // invoke the operation
+ PostgreSqlSecurityAlertPolicyName securityAlertPolicyName = PostgreSqlSecurityAlertPolicyName.Default;
+ PostgreSqlServerSecurityAlertPolicyData data = new PostgreSqlServerSecurityAlertPolicyData()
+ {
+ State = PostgreSqlServerSecurityAlertPolicyState.Enabled,
+ DisabledAlerts =
+{
+"Access_Anomaly","Usage_Anomaly"
+},
+ EmailAddresses =
+{
+"testSecurityAlert@microsoft.com"
+},
+ SendToEmailAccountAdmins = true,
+ StorageEndpoint = "https://mystorage.blob.core.windows.net",
+ StorageAccountAccessKey = "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==",
+ RetentionDays = 5,
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, securityAlertPolicyName, data);
+ PostgreSqlServerSecurityAlertPolicyResource 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
+ PostgreSqlServerSecurityAlertPolicyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Update a server's threat detection policy with minimal parameters
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_UpdateAServerSThreatDetectionPolicyWithMinimalParameters()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json
+ // this example is just showing the usage of "ServerSecurityAlertPolicies_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "securityalert-4799";
+ string serverName = "securityalert-6440";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlServerSecurityAlertPolicyResource
+ PostgreSqlServerSecurityAlertPolicyCollection collection = postgreSqlServer.GetPostgreSqlServerSecurityAlertPolicies();
+
+ // invoke the operation
+ PostgreSqlSecurityAlertPolicyName securityAlertPolicyName = PostgreSqlSecurityAlertPolicyName.Default;
+ PostgreSqlServerSecurityAlertPolicyData data = new PostgreSqlServerSecurityAlertPolicyData()
+ {
+ State = PostgreSqlServerSecurityAlertPolicyState.Disabled,
+ SendToEmailAccountAdmins = true,
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, securityAlertPolicyName, data);
+ PostgreSqlServerSecurityAlertPolicyResource 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
+ PostgreSqlServerSecurityAlertPolicyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // List the server's threat detection policies
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ListTheServerSThreatDetectionPolicies()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsListByServer.json
+ // this example is just showing the usage of "ServerSecurityAlertPolicies_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "securityalert-4799";
+ string serverName = "securityalert-6440";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlServerSecurityAlertPolicyResource
+ PostgreSqlServerSecurityAlertPolicyCollection collection = postgreSqlServer.GetPostgreSqlServerSecurityAlertPolicies();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlServerSecurityAlertPolicyResource 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
+ PostgreSqlServerSecurityAlertPolicyData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerSecurityAlertPolicyResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerSecurityAlertPolicyResource.cs
new file mode 100644
index 000000000000..92a7931197a1
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlServerSecurityAlertPolicyResource.cs
@@ -0,0 +1,140 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+using Azure.ResourceManager.PostgreSql.Models;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlServerSecurityAlertPolicyResource
+ {
+ // Get a server's threat detection policy
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetAServerSThreatDetectionPolicy()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsGet.json
+ // this example is just showing the usage of "ServerSecurityAlertPolicies_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 PostgreSqlServerSecurityAlertPolicyResource created on azure
+ // for more information of creating PostgreSqlServerSecurityAlertPolicyResource, please refer to the document of PostgreSqlServerSecurityAlertPolicyResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "securityalert-4799";
+ string serverName = "securityalert-6440";
+ PostgreSqlSecurityAlertPolicyName securityAlertPolicyName = PostgreSqlSecurityAlertPolicyName.Default;
+ ResourceIdentifier postgreSqlServerSecurityAlertPolicyResourceId = PostgreSqlServerSecurityAlertPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, securityAlertPolicyName);
+ PostgreSqlServerSecurityAlertPolicyResource postgreSqlServerSecurityAlertPolicy = client.GetPostgreSqlServerSecurityAlertPolicyResource(postgreSqlServerSecurityAlertPolicyResourceId);
+
+ // invoke the operation
+ PostgreSqlServerSecurityAlertPolicyResource result = await postgreSqlServerSecurityAlertPolicy.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
+ PostgreSqlServerSecurityAlertPolicyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Update a server's threat detection policy with all parameters
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_UpdateAServerSThreatDetectionPolicyWithAllParameters()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMax.json
+ // this example is just showing the usage of "ServerSecurityAlertPolicies_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 PostgreSqlServerSecurityAlertPolicyResource created on azure
+ // for more information of creating PostgreSqlServerSecurityAlertPolicyResource, please refer to the document of PostgreSqlServerSecurityAlertPolicyResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "securityalert-4799";
+ string serverName = "securityalert-6440";
+ PostgreSqlSecurityAlertPolicyName securityAlertPolicyName = PostgreSqlSecurityAlertPolicyName.Default;
+ ResourceIdentifier postgreSqlServerSecurityAlertPolicyResourceId = PostgreSqlServerSecurityAlertPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, securityAlertPolicyName);
+ PostgreSqlServerSecurityAlertPolicyResource postgreSqlServerSecurityAlertPolicy = client.GetPostgreSqlServerSecurityAlertPolicyResource(postgreSqlServerSecurityAlertPolicyResourceId);
+
+ // invoke the operation
+ PostgreSqlServerSecurityAlertPolicyData data = new PostgreSqlServerSecurityAlertPolicyData()
+ {
+ State = PostgreSqlServerSecurityAlertPolicyState.Enabled,
+ DisabledAlerts =
+{
+"Access_Anomaly","Usage_Anomaly"
+},
+ EmailAddresses =
+{
+"testSecurityAlert@microsoft.com"
+},
+ SendToEmailAccountAdmins = true,
+ StorageEndpoint = "https://mystorage.blob.core.windows.net",
+ StorageAccountAccessKey = "sdlfkjabc+sdlfkjsdlkfsjdfLDKFTERLKFDFKLjsdfksjdflsdkfD2342309432849328476458/3RSD==",
+ RetentionDays = 5,
+ };
+ ArmOperation lro = await postgreSqlServerSecurityAlertPolicy.UpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlServerSecurityAlertPolicyResource 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
+ PostgreSqlServerSecurityAlertPolicyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Update a server's threat detection policy with minimal parameters
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_UpdateAServerSThreatDetectionPolicyWithMinimalParameters()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/ServerSecurityAlertsCreateMin.json
+ // this example is just showing the usage of "ServerSecurityAlertPolicies_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 PostgreSqlServerSecurityAlertPolicyResource created on azure
+ // for more information of creating PostgreSqlServerSecurityAlertPolicyResource, please refer to the document of PostgreSqlServerSecurityAlertPolicyResource
+ string subscriptionId = "00000000-1111-2222-3333-444444444444";
+ string resourceGroupName = "securityalert-4799";
+ string serverName = "securityalert-6440";
+ PostgreSqlSecurityAlertPolicyName securityAlertPolicyName = PostgreSqlSecurityAlertPolicyName.Default;
+ ResourceIdentifier postgreSqlServerSecurityAlertPolicyResourceId = PostgreSqlServerSecurityAlertPolicyResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, securityAlertPolicyName);
+ PostgreSqlServerSecurityAlertPolicyResource postgreSqlServerSecurityAlertPolicy = client.GetPostgreSqlServerSecurityAlertPolicyResource(postgreSqlServerSecurityAlertPolicyResourceId);
+
+ // invoke the operation
+ PostgreSqlServerSecurityAlertPolicyData data = new PostgreSqlServerSecurityAlertPolicyData()
+ {
+ State = PostgreSqlServerSecurityAlertPolicyState.Disabled,
+ SendToEmailAccountAdmins = true,
+ };
+ ArmOperation lro = await postgreSqlServerSecurityAlertPolicy.UpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlServerSecurityAlertPolicyResource 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
+ PostgreSqlServerSecurityAlertPolicyData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlVirtualNetworkRuleCollection.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlVirtualNetworkRuleCollection.cs
new file mode 100644
index 000000000000..9a77a4760dff
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlVirtualNetworkRuleCollection.cs
@@ -0,0 +1,164 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlVirtualNetworkRuleCollection
+ {
+ // Gets a virtual network rule
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetsAVirtualNetworkRule()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json
+ // this example is just showing the usage of "VirtualNetworkRules_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "vnet-test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlVirtualNetworkRuleResource
+ PostgreSqlVirtualNetworkRuleCollection collection = postgreSqlServer.GetPostgreSqlVirtualNetworkRules();
+
+ // invoke the operation
+ string virtualNetworkRuleName = "vnet-firewall-rule";
+ PostgreSqlVirtualNetworkRuleResource result = await collection.GetAsync(virtualNetworkRuleName);
+
+ // 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
+ PostgreSqlVirtualNetworkRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Gets a virtual network rule
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Exists_GetsAVirtualNetworkRule()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json
+ // this example is just showing the usage of "VirtualNetworkRules_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "vnet-test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlVirtualNetworkRuleResource
+ PostgreSqlVirtualNetworkRuleCollection collection = postgreSqlServer.GetPostgreSqlVirtualNetworkRules();
+
+ // invoke the operation
+ string virtualNetworkRuleName = "vnet-firewall-rule";
+ bool result = await collection.ExistsAsync(virtualNetworkRuleName);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // Create or update a virtual network rule
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CreateOrUpdate_CreateOrUpdateAVirtualNetworkRule()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json
+ // this example is just showing the usage of "VirtualNetworkRules_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 PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "vnet-test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlVirtualNetworkRuleResource
+ PostgreSqlVirtualNetworkRuleCollection collection = postgreSqlServer.GetPostgreSqlVirtualNetworkRules();
+
+ // invoke the operation
+ string virtualNetworkRuleName = "vnet-firewall-rule";
+ PostgreSqlVirtualNetworkRuleData data = new PostgreSqlVirtualNetworkRuleData()
+ {
+ VirtualNetworkSubnetId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"),
+ IgnoreMissingVnetServiceEndpoint = false,
+ };
+ ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, virtualNetworkRuleName, data);
+ PostgreSqlVirtualNetworkRuleResource 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
+ PostgreSqlVirtualNetworkRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // List virtual network rules
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task GetAll_ListVirtualNetworkRules()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesList.json
+ // this example is just showing the usage of "VirtualNetworkRules_ListByServer" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this PostgreSqlServerResource created on azure
+ // for more information of creating PostgreSqlServerResource, please refer to the document of PostgreSqlServerResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "vnet-test-svr";
+ ResourceIdentifier postgreSqlServerResourceId = PostgreSqlServerResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName);
+ PostgreSqlServerResource postgreSqlServer = client.GetPostgreSqlServerResource(postgreSqlServerResourceId);
+
+ // get the collection of this PostgreSqlVirtualNetworkRuleResource
+ PostgreSqlVirtualNetworkRuleCollection collection = postgreSqlServer.GetPostgreSqlVirtualNetworkRules();
+
+ // invoke the operation and iterate over the result
+ await foreach (PostgreSqlVirtualNetworkRuleResource 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
+ PostgreSqlVirtualNetworkRuleData resourceData = item.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlVirtualNetworkRuleResource.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlVirtualNetworkRuleResource.cs
new file mode 100644
index 000000000000..ae16b246c287
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_PostgreSqlVirtualNetworkRuleResource.cs
@@ -0,0 +1,118 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Threading.Tasks;
+using Azure;
+using Azure.Core;
+using Azure.Identity;
+using Azure.ResourceManager;
+using Azure.ResourceManager.PostgreSql;
+
+namespace Azure.ResourceManager.PostgreSql.Samples
+{
+ public partial class Sample_PostgreSqlVirtualNetworkRuleResource
+ {
+ // Gets a virtual network rule
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Get_GetsAVirtualNetworkRule()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesGet.json
+ // this example is just showing the usage of "VirtualNetworkRules_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 PostgreSqlVirtualNetworkRuleResource created on azure
+ // for more information of creating PostgreSqlVirtualNetworkRuleResource, please refer to the document of PostgreSqlVirtualNetworkRuleResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "vnet-test-svr";
+ string virtualNetworkRuleName = "vnet-firewall-rule";
+ ResourceIdentifier postgreSqlVirtualNetworkRuleResourceId = PostgreSqlVirtualNetworkRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, virtualNetworkRuleName);
+ PostgreSqlVirtualNetworkRuleResource postgreSqlVirtualNetworkRule = client.GetPostgreSqlVirtualNetworkRuleResource(postgreSqlVirtualNetworkRuleResourceId);
+
+ // invoke the operation
+ PostgreSqlVirtualNetworkRuleResource result = await postgreSqlVirtualNetworkRule.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
+ PostgreSqlVirtualNetworkRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Create or update a virtual network rule
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Update_CreateOrUpdateAVirtualNetworkRule()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesCreateOrUpdate.json
+ // this example is just showing the usage of "VirtualNetworkRules_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 PostgreSqlVirtualNetworkRuleResource created on azure
+ // for more information of creating PostgreSqlVirtualNetworkRuleResource, please refer to the document of PostgreSqlVirtualNetworkRuleResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "vnet-test-svr";
+ string virtualNetworkRuleName = "vnet-firewall-rule";
+ ResourceIdentifier postgreSqlVirtualNetworkRuleResourceId = PostgreSqlVirtualNetworkRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, virtualNetworkRuleName);
+ PostgreSqlVirtualNetworkRuleResource postgreSqlVirtualNetworkRule = client.GetPostgreSqlVirtualNetworkRuleResource(postgreSqlVirtualNetworkRuleResourceId);
+
+ // invoke the operation
+ PostgreSqlVirtualNetworkRuleData data = new PostgreSqlVirtualNetworkRuleData()
+ {
+ VirtualNetworkSubnetId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/TestGroup/providers/Microsoft.Network/virtualNetworks/testvnet/subnets/testsubnet"),
+ IgnoreMissingVnetServiceEndpoint = false,
+ };
+ ArmOperation lro = await postgreSqlVirtualNetworkRule.UpdateAsync(WaitUntil.Completed, data);
+ PostgreSqlVirtualNetworkRuleResource 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
+ PostgreSqlVirtualNetworkRuleData resourceData = result.Data;
+ // for demo we just print out the id
+ Console.WriteLine($"Succeeded on id: {resourceData.Id}");
+ }
+
+ // Delete a virtual network rule
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task Delete_DeleteAVirtualNetworkRule()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/stable/2017-12-01/examples/VirtualNetworkRulesDelete.json
+ // this example is just showing the usage of "VirtualNetworkRules_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 PostgreSqlVirtualNetworkRuleResource created on azure
+ // for more information of creating PostgreSqlVirtualNetworkRuleResource, please refer to the document of PostgreSqlVirtualNetworkRuleResource
+ string subscriptionId = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ string resourceGroupName = "TestGroup";
+ string serverName = "vnet-test-svr";
+ string virtualNetworkRuleName = "vnet-firewall-rule";
+ ResourceIdentifier postgreSqlVirtualNetworkRuleResourceId = PostgreSqlVirtualNetworkRuleResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, serverName, virtualNetworkRuleName);
+ PostgreSqlVirtualNetworkRuleResource postgreSqlVirtualNetworkRule = client.GetPostgreSqlVirtualNetworkRuleResource(postgreSqlVirtualNetworkRuleResourceId);
+
+ // invoke the operation
+ await postgreSqlVirtualNetworkRule.DeleteAsync(WaitUntil.Completed);
+
+ Console.WriteLine($"Succeeded");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs
new file mode 100644
index 000000000000..4af48973f373
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs
@@ -0,0 +1,139 @@
+// 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;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+using Azure.ResourceManager.PostgreSql.FlexibleServers.Models;
+using Azure.ResourceManager.Resources;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_SubscriptionResourceExtensions
+ {
+ // CapabilitiesList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task ExecuteLocationBasedCapabilities_CapabilitiesList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CapabilitiesByLocation.json
+ // this example is just showing the usage of "LocationBasedCapabilities_Execute" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
+ SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
+
+ // invoke the operation and iterate over the result
+ AzureLocation locationName = new AzureLocation("westus");
+ await foreach (PostgreSqlFlexibleServerCapabilityProperties item in subscriptionResource.ExecuteLocationBasedCapabilitiesAsync(locationName))
+ {
+ Console.WriteLine($"Succeeded: {item}");
+ }
+
+ Console.WriteLine($"Succeeded");
+ }
+
+ // NameAvailability
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CheckPostgreSqlFlexibleServerNameAvailability_NameAvailability()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckNameAvailability.json
+ // this example is just showing the usage of "CheckNameAvailability_Execute" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
+ SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
+
+ // invoke the operation
+ PostgreSqlFlexibleServerNameAvailabilityContent content = new PostgreSqlFlexibleServerNameAvailabilityContent("name1")
+ {
+ ResourceType = new ResourceType("Microsoft.DBforPostgreSQL/flexibleServers"),
+ };
+ PostgreSqlFlexibleServerNameAvailabilityResult result = await subscriptionResource.CheckPostgreSqlFlexibleServerNameAvailabilityAsync(content);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // NameAvailability
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task CheckPostgreSqlFlexibleServerNameAvailabilityWithLocation_NameAvailability()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/CheckNameAvailabilityLocationBased.json
+ // this example is just showing the usage of "CheckNameAvailabilityWithLocation_Execute" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
+ SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
+
+ // invoke the operation
+ AzureLocation locationName = new AzureLocation("westus");
+ PostgreSqlFlexibleServerNameAvailabilityContent content = new PostgreSqlFlexibleServerNameAvailabilityContent("name1")
+ {
+ ResourceType = new ResourceType("Microsoft.DBforPostgreSQL/flexibleServers"),
+ };
+ PostgreSqlFlexibleServerNameAvailabilityResult result = await subscriptionResource.CheckPostgreSqlFlexibleServerNameAvailabilityWithLocationAsync(locationName, content);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+
+ // VirtualNetworkSubnetUsageList
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task ExecuteVirtualNetworkSubnetUsage_VirtualNetworkSubnetUsageList()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/VirtualNetworkSubnetUsage.json
+ // this example is just showing the usage of "VirtualNetworkSubnetUsage_Execute" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "ffffffff-ffff-ffff-ffff-ffffffffffff";
+ ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId);
+ SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId);
+
+ // invoke the operation
+ AzureLocation locationName = new AzureLocation("westus");
+ PostgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter = new PostgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter()
+ {
+ VirtualNetworkArmResourceId = new ResourceIdentifier("/subscriptions/ffffffff-ffff-ffff-ffff-ffffffffffff/resourceGroups/testrg/providers/Microsoft.Network/virtualNetworks/testvnet"),
+ };
+ PostgreSqlFlexibleServerVirtualNetworkSubnetUsageResult result = await subscriptionResource.ExecuteVirtualNetworkSubnetUsageAsync(locationName, postgreSqlFlexibleServerVirtualNetworkSubnetUsageParameter);
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_TenantResourceExtensions.cs
new file mode 100644
index 000000000000..4f3c1938176e
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/Generated/Samples/Sample_TenantResourceExtensions.cs
@@ -0,0 +1,42 @@
+// 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;
+using Azure.ResourceManager.PostgreSql.FlexibleServers;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Samples
+{
+ public partial class Sample_TenantResourceExtensions
+ {
+ // GetPrivateDnsZoneSuffix
+ [NUnit.Framework.Test]
+ [NUnit.Framework.Ignore("Only verifying that the sample builds")]
+ public async Task ExecuteGetPrivateDnsZoneSuffix_GetPrivateDnsZoneSuffix()
+ {
+ // Generated from example definition: specification/postgresql/resource-manager/Microsoft.DBforPostgreSQL/preview/2023-03-01-preview/examples/GetPrivateDnsZoneSuffix.json
+ // this example is just showing the usage of "GetPrivateDnsZoneSuffix_Execute" operation, for the dependent resources, they will have to be created separately.
+
+ // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line
+ TokenCredential cred = new DefaultAzureCredential();
+ // authenticate your client
+ ArmClient client = new ArmClient(cred);
+
+ // this example assumes you already have this TenantResource created on azure
+ // for more information of creating TenantResource, please refer to the document of TenantResource
+ var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current;
+
+ // invoke the operation
+ string result = await tenantResource.ExecuteGetPrivateDnsZoneSuffixAsync();
+
+ Console.WriteLine($"Succeeded: {result}");
+ }
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/autorest.tests.md b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/autorest.tests.md
new file mode 100644
index 000000000000..c21001d47d11
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/samples/autorest.tests.md
@@ -0,0 +1,13 @@
+# Generated code configuration
+
+Run `dotnet build /t:GenerateTests` to generate code.
+
+# Azure.ResourceManager.PostgreSql.Tests
+
+> see https://aka.ms/autorest
+``` yaml
+require: ../src/autorest.md
+include-x-ms-examples-original-file: true
+testgen:
+ sample: true
+```
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Custom/Models/PostgreSqlMinimalTlsVersionEnum.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Custom/Models/PostgreSqlMinimalTlsVersionEnum.cs
index 2a11fb88202a..940ef60a967f 100644
--- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Custom/Models/PostgreSqlMinimalTlsVersionEnum.cs
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Custom/Models/PostgreSqlMinimalTlsVersionEnum.cs
@@ -7,52 +7,21 @@
using System.ComponentModel;
using Azure.Core;
-[assembly:CodeGenSuppressType("PostgreSqlMinimalTlsVersionEnum")]
namespace Azure.ResourceManager.PostgreSql.Models
{
/// Enforce a minimal Tls version for the server.
public readonly partial struct PostgreSqlMinimalTlsVersionEnum : IEquatable
{
- private readonly string _value;
-
- /// Initializes a new instance of .
- /// is null.
- public PostgreSqlMinimalTlsVersionEnum(string value)
- {
- _value = value ?? throw new ArgumentNullException(nameof(value));
- }
#pragma warning disable CA1707
- private const string Tls1_0Value = "TLS1_0";
- private const string Tls1_1Value = "TLS1_1";
- private const string Tls1_2Value = "TLS1_2";
- private const string TLSEnforcementDisabledValue = "TLSEnforcementDisabled";
-
/// TLS1_0.
+ [CodeGenMember("TLS10")]
public static PostgreSqlMinimalTlsVersionEnum Tls1_0 { get; } = new PostgreSqlMinimalTlsVersionEnum(Tls1_0Value);
/// TLS1_1.
+ [CodeGenMember("TLS11")]
public static PostgreSqlMinimalTlsVersionEnum Tls1_1 { get; } = new PostgreSqlMinimalTlsVersionEnum(Tls1_1Value);
/// TLS1_2.
+ [CodeGenMember("TLS12")]
public static PostgreSqlMinimalTlsVersionEnum Tls1_2 { get; } = new PostgreSqlMinimalTlsVersionEnum(Tls1_2Value);
#pragma warning restore CA1707
- /// TLSEnforcementDisabled.
- public static PostgreSqlMinimalTlsVersionEnum TLSEnforcementDisabled { get; } = new PostgreSqlMinimalTlsVersionEnum(TLSEnforcementDisabledValue);
- /// Determines if two values are the same.
- public static bool operator ==(PostgreSqlMinimalTlsVersionEnum left, PostgreSqlMinimalTlsVersionEnum right) => left.Equals(right);
- /// Determines if two values are not the same.
- public static bool operator !=(PostgreSqlMinimalTlsVersionEnum left, PostgreSqlMinimalTlsVersionEnum right) => !left.Equals(right);
- /// Converts a string to a .
- public static implicit operator PostgreSqlMinimalTlsVersionEnum(string value) => new PostgreSqlMinimalTlsVersionEnum(value);
-
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override bool Equals(object obj) => obj is PostgreSqlMinimalTlsVersionEnum other && Equals(other);
- ///
- public bool Equals(PostgreSqlMinimalTlsVersionEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
-
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override int GetHashCode() => _value?.GetHashCode() ?? 0;
- ///
- public override string ToString() => _value;
}
}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Custom/Models/PostgreSqlServerVersion.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Custom/Models/PostgreSqlServerVersion.cs
index 1b57d6608b08..1b1a70ef6158 100644
--- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Custom/Models/PostgreSqlServerVersion.cs
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Custom/Models/PostgreSqlServerVersion.cs
@@ -7,58 +7,30 @@
using System.ComponentModel;
using Azure.Core;
-[assembly:CodeGenSuppressType("PostgreSqlServerVersion")]
namespace Azure.ResourceManager.PostgreSql.Models
{
/// The version of a server.
public readonly partial struct PostgreSqlServerVersion : IEquatable
{
- private readonly string _value;
-
- /// Initializes a new instance of .
- /// is null.
- public PostgreSqlServerVersion(string value)
- {
- _value = value ?? throw new ArgumentNullException(nameof(value));
- }
#pragma warning disable CA1707
- private const string Ver9_5Value = "9.5";
- private const string Ver9_6Value = "9.6";
- private const string Ver10Value = "10";
- private const string Ver10_0Value = "10.0";
- private const string Ver10_2Value = "10.2";
- private const string Ver11Value = "11";
-
/// 9.5.
+ [CodeGenMember("NinePointFive")]
public static PostgreSqlServerVersion Ver9_5 { get; } = new PostgreSqlServerVersion(Ver9_5Value);
/// 9.6.
+ [CodeGenMember("NinePointSix")]
public static PostgreSqlServerVersion Ver9_6 { get; } = new PostgreSqlServerVersion(Ver9_6Value);
/// 10.
+ [CodeGenMember("Ten")]
public static PostgreSqlServerVersion Ver10 { get; } = new PostgreSqlServerVersion(Ver10Value);
/// 10.0.
+ [CodeGenMember("TenPointZero")]
public static PostgreSqlServerVersion Ver10_0 { get; } = new PostgreSqlServerVersion(Ver10_0Value);
/// 10.2.
+ [CodeGenMember("TenPointTwo")]
public static PostgreSqlServerVersion Ver10_2 { get; } = new PostgreSqlServerVersion(Ver10_2Value);
/// 11.
+ [CodeGenMember("Eleven")]
public static PostgreSqlServerVersion Ver11 { get; } = new PostgreSqlServerVersion(Ver11Value);
#pragma warning restore CA1707
- /// Determines if two values are the same.
- public static bool operator ==(PostgreSqlServerVersion left, PostgreSqlServerVersion right) => left.Equals(right);
- /// Determines if two values are not the same.
- public static bool operator !=(PostgreSqlServerVersion left, PostgreSqlServerVersion right) => !left.Equals(right);
- /// Converts a string to a .
- public static implicit operator PostgreSqlServerVersion(string value) => new PostgreSqlServerVersion(value);
-
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override bool Equals(object obj) => obj is PostgreSqlServerVersion other && Equals(other);
- ///
- public bool Equals(PostgreSqlServerVersion other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
-
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override int GetHashCode() => _value?.GetHashCode() ?? 0;
- ///
- public override string ToString() => _value;
}
}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Models/PostgreSqlMinimalTlsVersionEnum.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Models/PostgreSqlMinimalTlsVersionEnum.cs
new file mode 100644
index 000000000000..3e85a3b2022d
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Models/PostgreSqlMinimalTlsVersionEnum.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.ResourceManager.PostgreSql.Models
+{
+ /// Enforce a minimal Tls version for the server.
+ public readonly partial struct PostgreSqlMinimalTlsVersionEnum : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public PostgreSqlMinimalTlsVersionEnum(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string Tls1_0Value = "TLS1_0";
+ private const string Tls1_1Value = "TLS1_1";
+ private const string Tls1_2Value = "TLS1_2";
+ private const string TLSEnforcementDisabledValue = "TLSEnforcementDisabled";
+ /// TLSEnforcementDisabled.
+ public static PostgreSqlMinimalTlsVersionEnum TLSEnforcementDisabled { get; } = new PostgreSqlMinimalTlsVersionEnum(TLSEnforcementDisabledValue);
+ /// Determines if two values are the same.
+ public static bool operator ==(PostgreSqlMinimalTlsVersionEnum left, PostgreSqlMinimalTlsVersionEnum right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(PostgreSqlMinimalTlsVersionEnum left, PostgreSqlMinimalTlsVersionEnum right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator PostgreSqlMinimalTlsVersionEnum(string value) => new PostgreSqlMinimalTlsVersionEnum(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is PostgreSqlMinimalTlsVersionEnum other && Equals(other);
+ ///
+ public bool Equals(PostgreSqlMinimalTlsVersionEnum other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Models/PostgreSqlServerVersion.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Models/PostgreSqlServerVersion.cs
new file mode 100644
index 000000000000..4e6230fd5a91
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSql/Generated/Models/PostgreSqlServerVersion.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.ResourceManager.PostgreSql.Models
+{
+ /// The version of a server.
+ public readonly partial struct PostgreSqlServerVersion : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public PostgreSqlServerVersion(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string Ver9_5Value = "9.5";
+ private const string Ver9_6Value = "9.6";
+ private const string Ver10Value = "10";
+ private const string Ver10_0Value = "10.0";
+ private const string Ver10_2Value = "10.2";
+ private const string Ver11Value = "11";
+ /// Determines if two values are the same.
+ public static bool operator ==(PostgreSqlServerVersion left, PostgreSqlServerVersion right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(PostgreSqlServerVersion left, PostgreSqlServerVersion right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator PostgreSqlServerVersion(string value) => new PostgreSqlServerVersion(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is PostgreSqlServerVersion other && Equals(other);
+ ///
+ public bool Equals(PostgreSqlServerVersion other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Custom/Models/PostgreSqlFlexibleServerVersion.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Custom/Models/PostgreSqlFlexibleServerVersion.cs
index 9c9293de51fa..15b6cfad13f8 100644
--- a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Custom/Models/PostgreSqlFlexibleServerVersion.cs
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Custom/Models/PostgreSqlFlexibleServerVersion.cs
@@ -7,51 +7,25 @@
using System.ComponentModel;
using Azure.Core;
-[assembly:CodeGenSuppressType("PostgreSqlFlexibleServerVersion")]
namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Models
{
/// The version of a server.
public readonly partial struct PostgreSqlFlexibleServerVersion : IEquatable
{
- private readonly string _value;
-
- /// Initializes a new instance of .
- /// is null.
- public PostgreSqlFlexibleServerVersion(string value)
- {
- _value = value ?? throw new ArgumentNullException(nameof(value));
- }
-
- private const string Ver14Value = "14";
- private const string Ver13Value = "13";
- private const string Ver12Value = "12";
- private const string Ver11Value = "11";
-
+ /// 15.
+ [CodeGenMember("Fifteen")]
+ public static PostgreSqlFlexibleServerVersion Ver15 { get; } = new PostgreSqlFlexibleServerVersion(Ver15Value);
/// 14.
+ [CodeGenMember("Fourteen")]
public static PostgreSqlFlexibleServerVersion Ver14 { get; } = new PostgreSqlFlexibleServerVersion(Ver14Value);
/// 13.
+ [CodeGenMember("Thirteen")]
public static PostgreSqlFlexibleServerVersion Ver13 { get; } = new PostgreSqlFlexibleServerVersion(Ver13Value);
/// 12.
+ [CodeGenMember("Twelve")]
public static PostgreSqlFlexibleServerVersion Ver12 { get; } = new PostgreSqlFlexibleServerVersion(Ver12Value);
/// 11.
+ [CodeGenMember("Eleven")]
public static PostgreSqlFlexibleServerVersion Ver11 { get; } = new PostgreSqlFlexibleServerVersion(Ver11Value);
- /// Determines if two values are the same.
- public static bool operator ==(PostgreSqlFlexibleServerVersion left, PostgreSqlFlexibleServerVersion right) => left.Equals(right);
- /// Determines if two values are not the same.
- public static bool operator !=(PostgreSqlFlexibleServerVersion left, PostgreSqlFlexibleServerVersion right) => !left.Equals(right);
- /// Converts a string to a .
- public static implicit operator PostgreSqlFlexibleServerVersion(string value) => new PostgreSqlFlexibleServerVersion(value);
-
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override bool Equals(object obj) => obj is PostgreSqlFlexibleServerVersion other && Equals(other);
- ///
- public bool Equals(PostgreSqlFlexibleServerVersion other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
-
- ///
- [EditorBrowsable(EditorBrowsableState.Never)]
- public override int GetHashCode() => _value?.GetHashCode() ?? 0;
- ///
- public override string ToString() => _value;
}
}
diff --git a/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerVersion.cs b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerVersion.cs
new file mode 100644
index 000000000000..78241a06877a
--- /dev/null
+++ b/sdk/postgresql/Azure.ResourceManager.PostgreSql/src/PostgreSqlFlexibleServers/Generated/Models/PostgreSqlFlexibleServerVersion.cs
@@ -0,0 +1,49 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.ComponentModel;
+
+namespace Azure.ResourceManager.PostgreSql.FlexibleServers.Models
+{
+ /// The version of a server.
+ public readonly partial struct PostgreSqlFlexibleServerVersion : IEquatable
+ {
+ private readonly string _value;
+
+ /// Initializes a new instance of .
+ /// is null.
+ public PostgreSqlFlexibleServerVersion(string value)
+ {
+ _value = value ?? throw new ArgumentNullException(nameof(value));
+ }
+
+ private const string Ver15Value = "15";
+ private const string Ver14Value = "14";
+ private const string Ver13Value = "13";
+ private const string Ver12Value = "12";
+ private const string Ver11Value = "11";
+ /// Determines if two values are the same.
+ public static bool operator ==(PostgreSqlFlexibleServerVersion left, PostgreSqlFlexibleServerVersion right) => left.Equals(right);
+ /// Determines if two values are not the same.
+ public static bool operator !=(PostgreSqlFlexibleServerVersion left, PostgreSqlFlexibleServerVersion right) => !left.Equals(right);
+ /// Converts a string to a .
+ public static implicit operator PostgreSqlFlexibleServerVersion(string value) => new PostgreSqlFlexibleServerVersion(value);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override bool Equals(object obj) => obj is PostgreSqlFlexibleServerVersion other && Equals(other);
+ ///
+ public bool Equals(PostgreSqlFlexibleServerVersion other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase);
+
+ ///
+ [EditorBrowsable(EditorBrowsableState.Never)]
+ public override int GetHashCode() => _value?.GetHashCode() ?? 0;
+ ///
+ public override string ToString() => _value;
+ }
+}