diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_DryrunCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_DryrunCollection.cs new file mode 100644 index 000000000000..4199812f5006 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_DryrunCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker.Samples +{ + public partial class Sample_DryrunCollection + { + // ListDryrun + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListDryrun() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ListDryrun.json + // this example is just showing the usage of "Linkers_ListDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DryrunResource + string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + DryrunCollection collection = client.GetDryruns(scopeId); + + // invoke the operation and iterate over the result + await foreach (DryrunResource 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 + DryrunResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetDryrun + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDryrun() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/GetDryrun.json + // this example is just showing the usage of "Linkers_GetDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DryrunResource + string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + DryrunCollection collection = client.GetDryruns(scopeId); + + // invoke the operation + string dryrunName = "dryrunName"; + DryrunResource result = await collection.GetAsync(dryrunName); + + // 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 + DryrunResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetDryrun + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetDryrun() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/GetDryrun.json + // this example is just showing the usage of "Linkers_GetDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DryrunResource + string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + DryrunCollection collection = client.GetDryruns(scopeId); + + // invoke the operation + string dryrunName = "dryrunName"; + bool result = await collection.ExistsAsync(dryrunName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GetDryrun + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetDryrun() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/GetDryrun.json + // this example is just showing the usage of "Linkers_GetDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DryrunResource + string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + DryrunCollection collection = client.GetDryruns(scopeId); + + // invoke the operation + string dryrunName = "dryrunName"; + NullableResponse response = await collection.GetIfExistsAsync(dryrunName); + DryrunResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DryrunResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // PutDryrun + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PutDryrun() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PutDryrun.json + // this example is just showing the usage of "Linkers_CreateDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this DryrunResource + string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); + DryrunCollection collection = client.GetDryruns(scopeId); + + // invoke the operation + string dryrunName = "dryrunName"; + DryrunResourceData data = new DryrunResourceData() + { + Parameters = new CreateOrUpdateDryrunParameters() + { + TargetService = new AzureResourceInfo() + { + Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"), + }, + AuthInfo = new SecretAuthInfo() + { + Name = "name", + SecretInfo = new RawValueSecretInfo() + { + Value = "secret", + }, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dryrunName, data); + DryrunResource 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 + DryrunResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_DryrunResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_DryrunResource.cs new file mode 100644 index 000000000000..5a0c4a1bf1ad --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_DryrunResource.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.Core; +using Azure.Identity; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker.Samples +{ + public partial class Sample_DryrunResource + { + // GetDryrun + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetDryrun() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/GetDryrun.json + // this example is just showing the usage of "Linkers_GetDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DryrunResource created on azure + // for more information of creating DryrunResource, please refer to the document of DryrunResource + string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; + string dryrunName = "dryrunName"; + ResourceIdentifier dryrunResourceId = DryrunResource.CreateResourceIdentifier(resourceUri, dryrunName); + DryrunResource dryrun = client.GetDryrunResource(dryrunResourceId); + + // invoke the operation + DryrunResource result = await dryrun.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 + DryrunResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PatchDryrun + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PatchDryrun() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PatchDryrun.json + // this example is just showing the usage of "Linkers_UpdateDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DryrunResource created on azure + // for more information of creating DryrunResource, please refer to the document of DryrunResource + string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; + string dryrunName = "dryrunName"; + ResourceIdentifier dryrunResourceId = DryrunResource.CreateResourceIdentifier(resourceUri, dryrunName); + DryrunResource dryrun = client.GetDryrunResource(dryrunResourceId); + + // invoke the operation + DryrunPatch patch = new DryrunPatch() + { + Parameters = new CreateOrUpdateDryrunParameters() + { + TargetService = new AzureResourceInfo() + { + Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"), + }, + AuthInfo = new SecretAuthInfo() + { + Name = "name", + SecretInfo = new RawValueSecretInfo() + { + Value = "secret", + }, + }, + }, + }; + ArmOperation lro = await dryrun.UpdateAsync(WaitUntil.Completed, patch); + DryrunResource 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 + DryrunResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteDryrun + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteDryrun() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/DeleteDryrun.json + // this example is just showing the usage of "Linkers_DeleteDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DryrunResource created on azure + // for more information of creating DryrunResource, please refer to the document of DryrunResource + string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; + string dryrunName = "dryrunName"; + ResourceIdentifier dryrunResourceId = DryrunResource.CreateResourceIdentifier(resourceUri, dryrunName); + DryrunResource dryrun = client.GetDryrunResource(dryrunResourceId); + + // invoke the operation + await dryrun.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResourceCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerCollection.cs similarity index 58% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResourceCollection.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerCollection.cs index e6fc68244a46..54b815d1f552 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResourceCollection.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerCollection.cs @@ -13,14 +13,14 @@ namespace Azure.ResourceManager.ServiceLinker.Samples { - public partial class Sample_LinkerResourceCollection + public partial class Sample_LinkerCollection { - // LinkList + // LinkerList [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetAll_LinkList() + public async Task GetAll_LinkerList() { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/LinkList.json + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/LinkerList.json // this example is just showing the usage of "Linker_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 @@ -34,7 +34,7 @@ public async Task GetAll_LinkList() // get the collection of this LinkerResource string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - LinkerResourceCollection collection = client.GetLinkerResources(scopeId); + LinkerCollection collection = client.GetLinkers(scopeId); // invoke the operation and iterate over the result await foreach (LinkerResource item in collection.GetAllAsync()) @@ -49,12 +49,12 @@ public async Task GetAll_LinkList() Console.WriteLine($"Succeeded"); } - // Link + // Linker [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_Link() + public async Task Get_Linker() { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/Link.json + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/Linker.json // this example is just showing the usage of "Linker_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 @@ -68,7 +68,7 @@ public async Task Get_Link() // get the collection of this LinkerResource string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - LinkerResourceCollection collection = client.GetLinkerResources(scopeId); + LinkerCollection collection = client.GetLinkers(scopeId); // invoke the operation string linkerName = "linkName"; @@ -81,12 +81,12 @@ public async Task Get_Link() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // Link + // Linker [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Exists_Link() + public async Task Exists_Linker() { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/Link.json + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/Linker.json // this example is just showing the usage of "Linker_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 @@ -100,7 +100,7 @@ public async Task Exists_Link() // get the collection of this LinkerResource string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - LinkerResourceCollection collection = client.GetLinkerResources(scopeId); + LinkerCollection collection = client.GetLinkers(scopeId); // invoke the operation string linkerName = "linkName"; @@ -109,12 +109,12 @@ public async Task Exists_Link() Console.WriteLine($"Succeeded: {result}"); } - // Link + // Linker [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task GetIfExists_Link() + public async Task GetIfExists_Linker() { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/Link.json + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/Linker.json // this example is just showing the usage of "Linker_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 @@ -128,7 +128,7 @@ public async Task GetIfExists_Link() // get the collection of this LinkerResource string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - LinkerResourceCollection collection = client.GetLinkerResources(scopeId); + LinkerCollection collection = client.GetLinkers(scopeId); // invoke the operation string linkerName = "linkName"; @@ -149,12 +149,12 @@ public async Task GetIfExists_Link() } } - // PutLink + // PutLinker [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_PutLink() + public async Task CreateOrUpdate_PutLinker() { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PutLink.json + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PutLinker.json // this example is just showing the usage of "Linker_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 @@ -168,7 +168,7 @@ public async Task CreateOrUpdate_PutLink() // get the collection of this LinkerResource string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - LinkerResourceCollection collection = client.GetLinkerResources(scopeId); + LinkerCollection collection = client.GetLinkers(scopeId); // invoke the operation string linkerName = "linkName"; @@ -186,97 +186,10 @@ public async Task CreateOrUpdate_PutLink() Value = "secret", }, }, - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, linkerName, data); - LinkerResource 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 - LinkerResourceData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // PutLinkWithSecretStore - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_PutLinkWithSecretStore() - { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PutLinkWithSecretStore.json - // this example is just showing the usage of "Linker_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 ArmResource created on azure - // for more information of creating ArmResource, please refer to the document of ArmResource - - // get the collection of this LinkerResource - string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; - ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - LinkerResourceCollection collection = client.GetLinkerResources(scopeId); - - // invoke the operation - string linkerName = "linkName"; - LinkerResourceData data = new LinkerResourceData() - { - TargetService = new AzureResourceInfo() + VnetSolution = new VnetSolution() { - Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"), - }, - AuthInfo = new SecretAuthInfo(), - SecretStoreKeyVaultId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv"), - }; - ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, linkerName, data); - LinkerResource 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 - LinkerResourceData resourceData = result.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - // PutLinkWithServiceEndpoint - [NUnit.Framework.Test] - [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task CreateOrUpdate_PutLinkWithServiceEndpoint() - { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PutLinkWithServiceEndpoint.json - // this example is just showing the usage of "Linker_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 ArmResource created on azure - // for more information of creating ArmResource, please refer to the document of ArmResource - - // get the collection of this LinkerResource - string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; - ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/{0}", resourceUri)); - LinkerResourceCollection collection = client.GetLinkerResources(scopeId); - - // invoke the operation - string linkerName = "linkName"; - LinkerResourceData data = new LinkerResourceData() - { - TargetService = new AzureResourceInfo() - { - Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DBforPostgreSQL/servers/test-pg/databases/test-db"), - }, - AuthInfo = new SecretAuthInfo() - { - Name = "name", - SecretInfo = new KeyVaultSecretUriSecretInfo() - { - Value = "https://vault-name.vault.azure.net/secrets/secret-name/00000000000000000000000000000000", - }, + SolutionType = VnetSolutionType.ServiceEndpoint, }, - SolutionType = VnetSolutionType.ServiceEndpoint, }; ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, linkerName, data); LinkerResource result = lro.Value; diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResource.cs index 9b68c70adeb2..05b5f43ff487 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResource.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LinkerResource.cs @@ -15,12 +15,12 @@ namespace Azure.ResourceManager.ServiceLinker.Samples { public partial class Sample_LinkerResource { - // Link + // Linker [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Get_Link() + public async Task Get_Linker() { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/Link.json + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/Linker.json // this example is just showing the usage of "Linker_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 @@ -33,10 +33,10 @@ public async Task Get_Link() string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; string linkerName = "linkName"; ResourceIdentifier linkerResourceId = LinkerResource.CreateResourceIdentifier(resourceUri, linkerName); - LinkerResource linkerResource = client.GetLinkerResource(linkerResourceId); + LinkerResource linker = client.GetLinkerResource(linkerResourceId); // invoke the operation - LinkerResource result = await linkerResource.GetAsync(); + LinkerResource result = await linker.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 @@ -45,12 +45,12 @@ public async Task Get_Link() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // DeleteLink + // DeleteLinker [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Delete_DeleteLink() + public async Task Delete_DeleteLinker() { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/DeleteLink.json + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/DeleteLinker.json // this example is just showing the usage of "Linker_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 @@ -63,20 +63,20 @@ public async Task Delete_DeleteLink() string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; string linkerName = "linkName"; ResourceIdentifier linkerResourceId = LinkerResource.CreateResourceIdentifier(resourceUri, linkerName); - LinkerResource linkerResource = client.GetLinkerResource(linkerResourceId); + LinkerResource linker = client.GetLinkerResource(linkerResourceId); // invoke the operation - await linkerResource.DeleteAsync(WaitUntil.Completed); + await linker.DeleteAsync(WaitUntil.Completed); Console.WriteLine($"Succeeded"); } - // PatchLink + // PatchLinker [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Update_PatchLink() + public async Task Update_PatchLinker() { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/PatchLink.json + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PatchLinker.json // this example is just showing the usage of "Linker_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 @@ -89,10 +89,10 @@ public async Task Update_PatchLink() string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; string linkerName = "linkName"; ResourceIdentifier linkerResourceId = LinkerResource.CreateResourceIdentifier(resourceUri, linkerName); - LinkerResource linkerResource = client.GetLinkerResource(linkerResourceId); + LinkerResource linker = client.GetLinkerResource(linkerResourceId); // invoke the operation - LinkerResourcePatch patch = new LinkerResourcePatch() + LinkerPatch patch = new LinkerPatch() { TargetService = new AzureResourceInfo() { @@ -100,7 +100,7 @@ public async Task Update_PatchLink() }, AuthInfo = new ServicePrincipalSecretAuthInfo("name", Guid.Parse("id"), "secret"), }; - ArmOperation lro = await linkerResource.UpdateAsync(WaitUntil.Completed, patch); + ArmOperation lro = await linker.UpdateAsync(WaitUntil.Completed, patch); LinkerResource result = lro.Value; // the variable result is a resource, you could call other operations on this instance as well @@ -110,12 +110,12 @@ public async Task Update_PatchLink() Console.WriteLine($"Succeeded on id: {resourceData.Id}"); } - // ValidateLinkSuccess + // ValidateLinkerSuccess [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] - public async Task Validate_ValidateLinkSuccess() + public async Task Validate_ValidateLinkerSuccess() { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/ValidateLinkSuccess.json + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ValidateLinkerSuccess.json // this example is just showing the usage of "Linker_Validate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -128,10 +128,10 @@ public async Task Validate_ValidateLinkSuccess() string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; string linkerName = "linkName"; ResourceIdentifier linkerResourceId = LinkerResource.CreateResourceIdentifier(resourceUri, linkerName); - LinkerResource linkerResource = client.GetLinkerResource(linkerResourceId); + LinkerResource linker = client.GetLinkerResource(linkerResourceId); // invoke the operation - ArmOperation lro = await linkerResource.ValidateAsync(WaitUntil.Completed); + ArmOperation lro = await linker.ValidateAsync(WaitUntil.Completed); LinkerValidateOperationResult result = lro.Value; Console.WriteLine($"Succeeded: {result}"); @@ -142,7 +142,7 @@ public async Task Validate_ValidateLinkSuccess() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetConfigurations_GetConfiguration() { - // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/stable/2022-05-01/examples/GetConfigurations.json + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/GetConfigurations.json // this example is just showing the usage of "Linker_ListConfigurations" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -150,15 +150,48 @@ public async Task GetConfigurations_GetConfiguration() // authenticate your client ArmClient client = new ArmClient(cred); + // this example assumes you already have this LinkerResource created on azure + // for more information of creating LinkerResource, please refer to the document of LinkerResource + string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.App/containerApps/test-app"; + string linkerName = "linkName"; + ResourceIdentifier linkerResourceId = LinkerResource.CreateResourceIdentifier(resourceUri, linkerName); + LinkerResource linker = client.GetLinkerResource(linkerResourceId); + + // invoke the operation + ConfigurationResult result = await linker.GetConfigurationsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // GenerateConfiguration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GenerateConfigurations_GenerateConfiguration() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/LinkerGenerateConfigurations.json + // this example is just showing the usage of "Linkers_GenerateConfigurations" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + // this example assumes you already have this LinkerResource created on azure // for more information of creating LinkerResource, please refer to the document of LinkerResource string resourceUri = "subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.Web/sites/test-app"; string linkerName = "linkName"; ResourceIdentifier linkerResourceId = LinkerResource.CreateResourceIdentifier(resourceUri, linkerName); - LinkerResource linkerResource = client.GetLinkerResource(linkerResourceId); + LinkerResource linker = client.GetLinkerResource(linkerResourceId); // invoke the operation - SourceConfigurationResult result = await linkerResource.GetConfigurationsAsync(); + ConfigurationInfo info = new ConfigurationInfo() + { + CustomizedKeys = +{ +["ASL_DocumentDb_ConnectionString"] = "MyConnectionstring", +}, + }; + ConfigurationResult result = await linker.GenerateConfigurationsAsync(info: info); Console.WriteLine($"Succeeded: {result}"); } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationConnectorCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationConnectorCollection.cs new file mode 100644 index 000000000000..7a6ce80e5e53 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationConnectorCollection.cs @@ -0,0 +1,213 @@ +// 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.Resources; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker.Samples +{ + public partial class Sample_LocationConnectorCollection + { + // ConnectorList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ConnectorList() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorList.json + // this example is just showing the usage of "Connector_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 ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocationConnectorResource + AzureLocation location = new AzureLocation("westus"); + LocationConnectorCollection collection = resourceGroupResource.GetLocationConnectors(location); + + // invoke the operation and iterate over the result + await foreach (LocationConnectorResource 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 + LinkerResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Connector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_Connector() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/Connectors.json + // this example is just showing the usage of "Connector_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 = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocationConnectorResource + AzureLocation location = new AzureLocation("westus"); + LocationConnectorCollection collection = resourceGroupResource.GetLocationConnectors(location); + + // invoke the operation + string connectorName = "connectorName"; + LocationConnectorResource result = await collection.GetAsync(connectorName); + + // 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 + LinkerResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Connector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_Connector() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/Connectors.json + // this example is just showing the usage of "Connector_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 = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocationConnectorResource + AzureLocation location = new AzureLocation("westus"); + LocationConnectorCollection collection = resourceGroupResource.GetLocationConnectors(location); + + // invoke the operation + string connectorName = "connectorName"; + bool result = await collection.ExistsAsync(connectorName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Connector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_Connector() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/Connectors.json + // this example is just showing the usage of "Connector_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 = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocationConnectorResource + AzureLocation location = new AzureLocation("westus"); + LocationConnectorCollection collection = resourceGroupResource.GetLocationConnectors(location); + + // invoke the operation + string connectorName = "connectorName"; + NullableResponse response = await collection.GetIfExistsAsync(connectorName); + LocationConnectorResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + LinkerResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // PutConnector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_PutConnector() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PutConnector.json + // this example is just showing the usage of "Connector_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocationConnectorResource + AzureLocation location = new AzureLocation("westus"); + LocationConnectorCollection collection = resourceGroupResource.GetLocationConnectors(location); + + // invoke the operation + string connectorName = "connectorName"; + LinkerResourceData data = new LinkerResourceData() + { + TargetService = new AzureResourceInfo() + { + Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"), + }, + AuthInfo = new SecretAuthInfo(), + SecretStore = new LinkerSecretStore() + { + KeyVaultId = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.KeyVault/vaults/test-kv"), + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, connectorName, data); + LocationConnectorResource 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 + LinkerResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationConnectorResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationConnectorResource.cs new file mode 100644 index 000000000000..effc5fa12821 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationConnectorResource.cs @@ -0,0 +1,183 @@ +// 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.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker.Samples +{ + public partial class Sample_LocationConnectorResource + { + // Connector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_Connector() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/Connectors.json + // this example is just showing the usage of "Connector_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 LocationConnectorResource created on azure + // for more information of creating LocationConnectorResource, please refer to the document of LocationConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + AzureLocation location = new AzureLocation("westus"); + string connectorName = "connectorName"; + ResourceIdentifier locationConnectorResourceId = LocationConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, location, connectorName); + LocationConnectorResource locationConnector = client.GetLocationConnectorResource(locationConnectorResourceId); + + // invoke the operation + LocationConnectorResource result = await locationConnector.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 + LinkerResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // DeleteConnector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteConnector() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/DeleteConnector.json + // this example is just showing the usage of "Connector_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 LocationConnectorResource created on azure + // for more information of creating LocationConnectorResource, please refer to the document of LocationConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + AzureLocation location = new AzureLocation("westus"); + string connectorName = "connectorName"; + ResourceIdentifier locationConnectorResourceId = LocationConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, location, connectorName); + LocationConnectorResource locationConnector = client.GetLocationConnectorResource(locationConnectorResourceId); + + // invoke the operation + await locationConnector.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // PatchConnector + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_PatchConnector() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/PatchConnector.json + // this example is just showing the usage of "Connector_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 LocationConnectorResource created on azure + // for more information of creating LocationConnectorResource, please refer to the document of LocationConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + AzureLocation location = new AzureLocation("westus"); + string connectorName = "connectorName"; + ResourceIdentifier locationConnectorResourceId = LocationConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, location, connectorName); + LocationConnectorResource locationConnector = client.GetLocationConnectorResource(locationConnectorResourceId); + + // invoke the operation + LinkerPatch patch = new LinkerPatch() + { + TargetService = new AzureResourceInfo() + { + Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"), + }, + AuthInfo = new ServicePrincipalSecretAuthInfo("name", Guid.Parse("id"), "secret"), + }; + ArmOperation lro = await locationConnector.UpdateAsync(WaitUntil.Completed, patch); + LocationConnectorResource 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 + LinkerResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ValidateConnectorSuccess + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Validate_ValidateConnectorSuccess() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ValidateConnectorSuccess.json + // this example is just showing the usage of "Connector_Validate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this LocationConnectorResource created on azure + // for more information of creating LocationConnectorResource, please refer to the document of LocationConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + AzureLocation location = new AzureLocation("westus"); + string connectorName = "connectorName"; + ResourceIdentifier locationConnectorResourceId = LocationConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, location, connectorName); + LocationConnectorResource locationConnector = client.GetLocationConnectorResource(locationConnectorResourceId); + + // invoke the operation + ArmOperation lro = await locationConnector.ValidateAsync(WaitUntil.Completed); + LinkerValidateOperationResult result = lro.Value; + + Console.WriteLine($"Succeeded: {result}"); + } + + // GenerateConfiguration + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GenerateConfigurations_GenerateConfiguration() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/GenerateConfigurations.json + // this example is just showing the usage of "Connector_GenerateConfigurations" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this LocationConnectorResource created on azure + // for more information of creating LocationConnectorResource, please refer to the document of LocationConnectorResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + AzureLocation location = new AzureLocation("westus"); + string connectorName = "connectorName"; + ResourceIdentifier locationConnectorResourceId = LocationConnectorResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, location, connectorName); + LocationConnectorResource locationConnector = client.GetLocationConnectorResource(locationConnectorResourceId); + + // invoke the operation + ConfigurationInfo info = new ConfigurationInfo() + { + CustomizedKeys = +{ +["ASL_DocumentDb_ConnectionString"] = "MyConnectionstring", +}, + }; + ConfigurationResult result = await locationConnector.GenerateConfigurationsAsync(info: info); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationDryrunCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationDryrunCollection.cs new file mode 100644 index 000000000000..5a2325b44606 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationDryrunCollection.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker.Samples +{ + public partial class Sample_LocationDryrunCollection + { + // ConnectorDryrunList + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ConnectorDryrunList() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunList.json + // this example is just showing the usage of "Connector_ListDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocationDryrunResource + AzureLocation location = new AzureLocation("westus"); + LocationDryrunCollection collection = resourceGroupResource.GetLocationDryruns(location); + + // invoke the operation and iterate over the result + await foreach (LocationDryrunResource 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 + DryrunResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ConnectorDryrunGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ConnectorDryrunGet() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunGet.json + // this example is just showing the usage of "Connector_GetDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocationDryrunResource + AzureLocation location = new AzureLocation("westus"); + LocationDryrunCollection collection = resourceGroupResource.GetLocationDryruns(location); + + // invoke the operation + string dryrunName = "dryrunName"; + LocationDryrunResource result = await collection.GetAsync(dryrunName); + + // 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 + DryrunResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ConnectorDryrunGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ConnectorDryrunGet() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunGet.json + // this example is just showing the usage of "Connector_GetDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocationDryrunResource + AzureLocation location = new AzureLocation("westus"); + LocationDryrunCollection collection = resourceGroupResource.GetLocationDryruns(location); + + // invoke the operation + string dryrunName = "dryrunName"; + bool result = await collection.ExistsAsync(dryrunName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ConnectorDryrunGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ConnectorDryrunGet() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunGet.json + // this example is just showing the usage of "Connector_GetDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocationDryrunResource + AzureLocation location = new AzureLocation("westus"); + LocationDryrunCollection collection = resourceGroupResource.GetLocationDryruns(location); + + // invoke the operation + string dryrunName = "dryrunName"; + NullableResponse response = await collection.GetIfExistsAsync(dryrunName); + LocationDryrunResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DryrunResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ConnectorDryrunCreate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ConnectorDryrunCreate() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunCreate.json + // this example is just showing the usage of "Connector_CreateDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this LocationDryrunResource + AzureLocation location = new AzureLocation("westus"); + LocationDryrunCollection collection = resourceGroupResource.GetLocationDryruns(location); + + // invoke the operation + string dryrunName = "dryrunName"; + DryrunResourceData data = new DryrunResourceData() + { + Parameters = new CreateOrUpdateDryrunParameters() + { + TargetService = new AzureResourceInfo() + { + Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"), + }, + AuthInfo = new SecretAuthInfo() + { + Name = "name", + SecretInfo = new RawValueSecretInfo() + { + Value = "secret", + }, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, dryrunName, data); + LocationDryrunResource 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 + DryrunResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationDryrunResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationDryrunResource.cs new file mode 100644 index 000000000000..7dc993a7b4ad --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationDryrunResource.cs @@ -0,0 +1,129 @@ +// 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.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker.Samples +{ + public partial class Sample_LocationDryrunResource + { + // ConnectorDryrunGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ConnectorDryrunGet() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunGet.json + // this example is just showing the usage of "Connector_GetDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this LocationDryrunResource created on azure + // for more information of creating LocationDryrunResource, please refer to the document of LocationDryrunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + AzureLocation location = new AzureLocation("westus"); + string dryrunName = "dryrunName"; + ResourceIdentifier locationDryrunResourceId = LocationDryrunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, location, dryrunName); + LocationDryrunResource locationDryrun = client.GetLocationDryrunResource(locationDryrunResourceId); + + // invoke the operation + LocationDryrunResource result = await locationDryrun.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 + DryrunResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ConnectorDryrunUpdate + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ConnectorDryrunUpdate() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunUpdate.json + // this example is just showing the usage of "Connector_UpdateDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this LocationDryrunResource created on azure + // for more information of creating LocationDryrunResource, please refer to the document of LocationDryrunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + AzureLocation location = new AzureLocation("westus"); + string dryrunName = "dryrunName"; + ResourceIdentifier locationDryrunResourceId = LocationDryrunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, location, dryrunName); + LocationDryrunResource locationDryrun = client.GetLocationDryrunResource(locationDryrunResourceId); + + // invoke the operation + DryrunPatch patch = new DryrunPatch() + { + Parameters = new CreateOrUpdateDryrunParameters() + { + TargetService = new AzureResourceInfo() + { + Id = new ResourceIdentifier("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/test-rg/providers/Microsoft.DocumentDb/databaseAccounts/test-acc/mongodbDatabases/test-db"), + }, + AuthInfo = new SecretAuthInfo() + { + Name = "name", + SecretInfo = new RawValueSecretInfo() + { + Value = "secret", + }, + }, + }, + }; + ArmOperation lro = await locationDryrun.UpdateAsync(WaitUntil.Completed, patch); + LocationDryrunResource 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 + DryrunResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ConnectorDryrunDelete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ConnectorDryrunDelete() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConnectorDryrunDelete.json + // this example is just showing the usage of "Connector_DeleteDryrun" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this LocationDryrunResource created on azure + // for more information of creating LocationDryrunResource, please refer to the document of LocationDryrunResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "test-rg"; + AzureLocation location = new AzureLocation("westus"); + string dryrunName = "dryrunName"; + ResourceIdentifier locationDryrunResourceId = LocationDryrunResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, location, dryrunName); + LocationDryrunResource locationDryrun = client.GetLocationDryrunResource(locationDryrunResourceId); + + // invoke the operation + await locationDryrun.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_TenantResourceExtensions.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_TenantResourceExtensions.cs new file mode 100644 index 000000000000..12bf0630e92a --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_TenantResourceExtensions.cs @@ -0,0 +1,44 @@ +// 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.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker.Samples +{ + public partial class Sample_TenantResourceExtensions + { + // GetConfigurationNames + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetConfigurationNames_GetConfigurationNames() + { + // Generated from example definition: specification/servicelinker/resource-manager/Microsoft.ServiceLinker/preview/2023-04-01-preview/examples/ConfigurationNamesList.json + // this example is just showing the usage of "ConfigurationNames_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 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 and iterate over the result + await foreach (ConfigurationNameItem item in tenantResource.GetConfigurationNamesAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/ArmServiceLinkerModelFactory.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/ArmServiceLinkerModelFactory.cs index 7dde325c0c3a..4e2d01881164 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/ArmServiceLinkerModelFactory.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/ArmServiceLinkerModelFactory.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using Azure.Core; using Azure.ResourceManager.Models; @@ -16,6 +17,81 @@ namespace Azure.ResourceManager.ServiceLinker.Models /// Model factory for models. public static partial class ArmServiceLinkerModelFactory { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// + /// the result of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// the preview of the operations for creation. + /// The provisioning state. + /// A new instance for mocking. + public static DryrunResourceData DryrunResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DryrunParameters parameters = null, IEnumerable prerequisiteResults = null, IEnumerable operationPreviews = null, string provisioningState = null) + { + prerequisiteResults ??= new List(); + operationPreviews ??= new List(); + + return new DryrunResourceData( + id, + name, + resourceType, + systemData, + parameters, + prerequisiteResults?.ToList(), + operationPreviews?.ToList(), + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The operation name. + /// The operation type. + /// The description of the operation. + /// The action defined by RBAC, refer https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format. + /// The scope of the operation, refer https://docs.microsoft.com/azure/role-based-access-control/scope-overview. + /// A new instance for mocking. + public static DryrunOperationPreview DryrunOperationPreview(string name = null, DryrunPreviewOperationType? operationType = null, string description = null, string action = null, string scope = null) + { + return new DryrunOperationPreview( + name, + operationType, + description, + action, + scope, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// + /// the result of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// the preview of the operations for creation. + /// The provisioning state. + /// A new instance for mocking. + public static DryrunPatch DryrunPatch(DryrunParameters parameters = null, IEnumerable prerequisiteResults = null, IEnumerable operationPreviews = null, string provisioningState = null) + { + prerequisiteResults ??= new List(); + operationPreviews ??= new List(); + + return new DryrunPatch(parameters, prerequisiteResults?.ToList(), operationPreviews?.ToList(), provisioningState, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -24,20 +100,22 @@ public static partial class ArmServiceLinkerModelFactory /// /// The target service properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , , and . /// /// /// The authentication type. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , , , , and . /// /// The application client type. /// The provisioning state. - /// The VNet solution. - /// An option to store secret value in secure place. + /// The VNet solution. + /// An option to store secret value in secure place. /// connection scope in source service. + /// The network solution. + /// The connection information consumed by applications, including secrets, connection strings. /// A new instance for mocking. - public static LinkerResourceData LinkerResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, TargetServiceBaseInfo targetService = null, AuthBaseInfo authInfo = null, LinkerClientType? clientType = null, string provisioningState = null, VnetSolutionType? solutionType = null, ResourceIdentifier secretStoreKeyVaultId = null, string scope = null) + public static LinkerResourceData LinkerResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, TargetServiceBaseInfo targetService = null, AuthBaseInfo authInfo = null, LinkerClientType? clientType = null, string provisioningState = null, VnetSolution vnetSolution = null, LinkerSecretStore secretStore = null, string scope = null, PublicNetworkSolution publicNetworkSolution = null, ConfigurationInfo configurationInfo = null) { return new LinkerResourceData( id, @@ -48,50 +126,81 @@ public static LinkerResourceData LinkerResourceData(ResourceIdentifier id = null authInfo, clientType, provisioningState, - solutionType != null ? new VnetSolution(solutionType, serializedAdditionalRawData: null) : null, - secretStoreKeyVaultId != null ? new LinkerSecretStore(secretStoreKeyVaultId, serializedAdditionalRawData: null) : null, + vnetSolution, + secretStore, scope, + publicNetworkSolution, + configurationInfo, serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . + /// The dapr component version. + /// The dapr component type. + /// The name of a secret store dapr to retrieve secret. + /// Additional dapr metadata. + /// The dapr component scopes. + /// The runtime version supported by the properties. + /// The direction supported by the dapr binding component. + /// A new instance for mocking. + public static DaprProperties DaprProperties(string version = null, string componentType = null, string secretStoreComponent = null, IEnumerable metadata = null, IEnumerable scopes = null, string runtimeVersion = null, DaprBindingComponentDirection? bindingComponentDirection = null) + { + metadata ??= new List(); + scopes ??= new List(); + + return new DaprProperties( + version, + componentType, + secretStoreComponent, + metadata?.ToList(), + scopes?.ToList(), + runtimeVersion, + bindingComponentDirection, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . /// /// The target service properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , , and . /// /// /// The authentication type. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , , , , and . /// /// The application client type. /// The provisioning state. - /// The VNet solution. - /// An option to store secret value in secure place. + /// The VNet solution. + /// An option to store secret value in secure place. /// connection scope in source service. - /// A new instance for mocking. - public static LinkerResourcePatch LinkerResourcePatch(TargetServiceBaseInfo targetService = null, AuthBaseInfo authInfo = null, LinkerClientType? clientType = null, string provisioningState = null, VnetSolutionType? solutionType = null, ResourceIdentifier secretStoreKeyVaultId = null, string scope = null) + /// The network solution. + /// The connection information consumed by applications, including secrets, connection strings. + /// A new instance for mocking. + public static LinkerPatch LinkerPatch(TargetServiceBaseInfo targetService = null, AuthBaseInfo authInfo = null, LinkerClientType? clientType = null, string provisioningState = null, VnetSolution vnetSolution = null, LinkerSecretStore secretStore = null, string scope = null, PublicNetworkSolution publicNetworkSolution = null, ConfigurationInfo configurationInfo = null) { - return new LinkerResourcePatch( + return new LinkerPatch( targetService, authInfo, clientType, provisioningState, - solutionType != null ? new VnetSolution(solutionType, serializedAdditionalRawData: null) : null, - secretStoreKeyVaultId != null ? new LinkerSecretStore(secretStoreKeyVaultId, serializedAdditionalRawData: null) : null, + vnetSolution, + secretStore, scope, + publicNetworkSolution, + configurationInfo, serializedAdditionalRawData: null); } /// Initializes a new instance of . - /// Validated linker id. + /// Validated Linker id. /// Validation operation status. /// The linker name. /// A boolean value indicating whether the connection is available or not. /// The start time of the validation report. /// The end time of the validation report. - /// The resource id of the linker source application. + /// The resource id of the Linker source application. /// The resource Id of target service. /// The authentication type. /// The detail of validation result. @@ -132,23 +241,140 @@ public static LinkerValidationResultItemInfo LinkerValidationResultItemInfo(stri serializedAdditionalRawData: null); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The configuration properties for source resource. - /// A new instance for mocking. - public static SourceConfigurationResult SourceConfigurationResult(IEnumerable configurations = null) + /// A new instance for mocking. + public static ConfigurationResult ConfigurationResult(IEnumerable configurations = null) { configurations ??= new List(); - return new SourceConfigurationResult(configurations?.ToList(), serializedAdditionalRawData: null); + return new ConfigurationResult(configurations?.ToList(), serializedAdditionalRawData: null); } /// Initializes a new instance of . /// The name of setting. /// The value of setting. + /// The type of setting. + /// The identity for key vault reference, system or user-assigned managed identity ID. + /// Descriptive information for the configuration. /// A new instance for mocking. - public static SourceConfiguration SourceConfiguration(string name = null, string value = null) + public static SourceConfiguration SourceConfiguration(string name = null, string value = null, LinkerConfigurationType? configType = null, string keyVaultReferenceIdentity = null, string description = null) + { + return new SourceConfiguration( + name, + value, + configType, + keyVaultReferenceIdentity, + description, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The target service provider name and resource name. + /// The client type for configuration names. + /// The auth type. + /// Indicates where the secrets in configuration from. Used when secrets are from Keyvault. + /// Deprecated, please use #/definitions/DaprConfigurationList instead. + /// The configuration names to be set in compute service environment. + /// A new instance for mocking. + public static ConfigurationNameItem ConfigurationNameItem(string targetService = null, LinkerClientType? clientType = null, LinkerAuthType? authType = null, SecretSourceType? secretType = null, DaprProperties daprProperties = null, IEnumerable names = null) + { + names ??= new List(); + + return new ConfigurationNameItem( + targetService, + clientType, + authType, + secretType, + daprProperties, + names?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// Description for the configuration name. + /// Represent the configuration is required or not. + /// A new instance for mocking. + public static ConfigurationName ConfigurationName(string value = null, string description = null, bool? required = null) + { + return new ConfigurationName(value, description, required, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Supported target resource type, extract from resource id, uppercase. + /// The authentication type. + /// Indicates some additional properties for dapr client type. + /// A new instance for mocking. + public static DaprConfigurationResource DaprConfigurationResource(string targetType = null, LinkerAuthType? authType = null, DaprProperties daprProperties = null) + { + return new DaprConfigurationResource(targetType, authType, daprProperties, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// The target service properties + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + /// + /// The authentication type. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , and . + /// + /// The application client type. + /// The provisioning state. + /// The VNet solution. + /// An option to store secret value in secure place. + /// connection scope in source service. + /// The network solution. + /// The connection information consumed by applications, including secrets, connection strings. + /// A new instance for mocking. + public static CreateOrUpdateDryrunParameters CreateOrUpdateDryrunParameters(TargetServiceBaseInfo targetService = null, AuthBaseInfo authInfo = null, LinkerClientType? clientType = null, string provisioningState = null, VnetSolution vnetSolution = null, LinkerSecretStore secretStore = null, string scope = null, PublicNetworkSolution publicNetworkSolution = null, ConfigurationInfo configurationInfo = null) + { + return new CreateOrUpdateDryrunParameters( + DryrunActionName.CreateOrUpdate, + serializedAdditionalRawData: null, + targetService, + authInfo, + clientType, + provisioningState, + vnetSolution, + secretStore, + scope, + publicNetworkSolution, + configurationInfo); + } + + /// Initializes a new instance of . + /// The error code. + /// The error message. + /// A new instance for mocking. + public static BasicErrorDryrunPrerequisiteResult BasicErrorDryrunPrerequisiteResult(string code = null, string message = null) + { + return new BasicErrorDryrunPrerequisiteResult(DryrunPrerequisiteResultType.BasicError, serializedAdditionalRawData: null, code, message); + } + + /// Initializes a new instance of . + /// The permission scope. + /// The permission list. + /// The recommended role to resolve permissions missing. + /// A new instance for mocking. + public static PermissionsMissingDryrunPrerequisiteResult PermissionsMissingDryrunPrerequisiteResult(string scope = null, IEnumerable permissions = null, string recommendedRole = null) + { + permissions ??= new List(); + + return new PermissionsMissingDryrunPrerequisiteResult(DryrunPrerequisiteResultType.PermissionsMissing, serializedAdditionalRawData: null, scope, permissions?.ToList(), recommendedRole); + } + + /// Initializes a new instance of . + /// The name of setting. + /// The value of setting. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static SourceConfiguration SourceConfiguration(string name, string value) { - return new SourceConfiguration(name, value, serializedAdditionalRawData: null); + return SourceConfiguration(name: name, value: value, configType: default, keyVaultReferenceIdentity: default, description: default); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunCollection.cs new file mode 100644 index 000000000000..aac36df0f116 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunCollection.cs @@ -0,0 +1,483 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDryruns method from an instance of . + /// + public partial class DryrunCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dryrunLinkersClientDiagnostics; + private readonly LinkersRestOperations _dryrunLinkersRestClient; + + /// Initializes a new instance of the class for mocking. + protected DryrunCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal DryrunCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dryrunLinkersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", DryrunResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DryrunResource.ResourceType, out string dryrunLinkersApiVersion); + _dryrunLinkersRestClient = new LinkersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dryrunLinkersApiVersion); + } + + /// + /// create a dryrun job to do necessary check before actual creation + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_CreateDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.CreateDryrunAsync(Id, dryrunName, data, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new DryrunOperationSource(Client), _dryrunLinkersClientDiagnostics, Pipeline, _dryrunLinkersRestClient.CreateCreateDryrunRequest(Id, dryrunName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// create a dryrun job to do necessary check before actual creation + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_CreateDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.CreateDryrun(Id, dryrunName, data, cancellationToken); + var operation = new ServiceLinkerArmOperation(new DryrunOperationSource(Client), _dryrunLinkersClientDiagnostics, Pipeline, _dryrunLinkersRestClient.CreateCreateDryrunRequest(Id, dryrunName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.Get"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.GetDryrunAsync(Id, dryrunName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.Get"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.GetDryrun(Id, dryrunName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// list dryrun jobs + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns + /// + /// + /// Operation Id + /// Linkers_ListDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dryrunLinkersRestClient.CreateListDryrunRequest(Id); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dryrunLinkersRestClient.CreateListDryrunNextPageRequest(nextLink, Id); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DryrunResource(Client, DryrunResourceData.DeserializeDryrunResourceData(e)), _dryrunLinkersClientDiagnostics, Pipeline, "DryrunCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// list dryrun jobs + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns + /// + /// + /// Operation Id + /// Linkers_ListDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dryrunLinkersRestClient.CreateListDryrunRequest(Id); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dryrunLinkersRestClient.CreateListDryrunNextPageRequest(nextLink, Id); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DryrunResource(Client, DryrunResourceData.DeserializeDryrunResourceData(e)), _dryrunLinkersClientDiagnostics, Pipeline, "DryrunCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.Exists"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.GetDryrunAsync(Id, dryrunName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.Exists"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.GetDryrun(Id, dryrunName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.GetDryrunAsync(Id, dryrunName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.GetDryrun(Id, dryrunName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.Serialization.cs new file mode 100644 index 000000000000..f7231ecd4f86 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.ServiceLinker +{ + public partial class DryrunResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DryrunResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DryrunResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.cs new file mode 100644 index 000000000000..7f7aa241c682 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.cs @@ -0,0 +1,350 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// A Class representing a Dryrun along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDryrunResource method. + /// Otherwise you can get one from its parent resource using the GetDryrun method. + /// + public partial class DryrunResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The resourceUri. + /// The dryrunName. + public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, string dryrunName) + { + var resourceId = $"{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dryrunLinkersClientDiagnostics; + private readonly LinkersRestOperations _dryrunLinkersRestClient; + private readonly DryrunResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ServiceLinker/dryruns"; + + /// Initializes a new instance of the class for mocking. + protected DryrunResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DryrunResource(ArmClient client, DryrunResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal DryrunResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dryrunLinkersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dryrunLinkersApiVersion); + _dryrunLinkersRestClient = new LinkersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dryrunLinkersApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DryrunResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Get"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.GetDryrunAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Get"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.GetDryrun(Id.Parent, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// delete a dryrun job + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_DeleteDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Delete"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.DeleteDryrunAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _dryrunLinkersRestClient.CreateDeleteDryrunRequestUri(Id.Parent, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ServiceLinkerArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// delete a dryrun job + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_DeleteDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Delete"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.DeleteDryrun(Id.Parent, Id.Name, cancellationToken); + var uri = _dryrunLinkersRestClient.CreateDeleteDryrunRequestUri(Id.Parent, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ServiceLinkerArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// add a dryrun job to do necessary check before actual creation + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_UpdateDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// dryrun resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Update"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.UpdateDryrunAsync(Id.Parent, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new DryrunOperationSource(Client), _dryrunLinkersClientDiagnostics, Pipeline, _dryrunLinkersRestClient.CreateUpdateDryrunRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// add a dryrun job to do necessary check before actual creation + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_UpdateDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// dryrun resource. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("DryrunResource.Update"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.UpdateDryrun(Id.Parent, Id.Name, patch, cancellationToken); + var operation = new ServiceLinkerArmOperation(new DryrunOperationSource(Client), _dryrunLinkersClientDiagnostics, Pipeline, _dryrunLinkersRestClient.CreateUpdateDryrunRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.Serialization.cs new file mode 100644 index 000000000000..a58e3c9a2b6b --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.Serialization.cs @@ -0,0 +1,261 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + public partial class DryrunResourceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunResourceData)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResourceType); + } + if (options.Format != "W" && Optional.IsDefined(SystemData)) + { + writer.WritePropertyName("systemData"u8); + JsonSerializer.Serialize(writer, SystemData); + } + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(Parameters, options); + } + if (options.Format != "W" && Optional.IsCollectionDefined(PrerequisiteResults)) + { + writer.WritePropertyName("prerequisiteResults"u8); + writer.WriteStartArray(); + foreach (var item in PrerequisiteResults) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(OperationPreviews)) + { + writer.WritePropertyName("operationPreviews"u8); + writer.WriteStartArray(); + foreach (var item in OperationPreviews) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DryrunResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDryrunResourceData(document.RootElement, options); + } + + internal static DryrunResourceData DeserializeDryrunResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + DryrunParameters parameters = default; + IReadOnlyList prerequisiteResults = default; + IReadOnlyList operationPreviews = default; + string provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = DryrunParameters.DeserializeDryrunParameters(property0.Value, options); + continue; + } + if (property0.NameEquals("prerequisiteResults"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DryrunPrerequisiteResult.DeserializeDryrunPrerequisiteResult(item, options)); + } + prerequisiteResults = array; + continue; + } + if (property0.NameEquals("operationPreviews"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DryrunOperationPreview.DeserializeDryrunOperationPreview(item, options)); + } + operationPreviews = array; + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DryrunResourceData( + id, + name, + type, + systemData, + parameters, + prerequisiteResults ?? new ChangeTrackingList(), + operationPreviews ?? new ChangeTrackingList(), + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DryrunResourceData)} does not support writing '{options.Format}' format."); + } + } + + DryrunResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDryrunResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DryrunResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.cs new file mode 100644 index 000000000000..40f63c8b4934 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// A class representing the DryrunResource data model. + /// a dryrun job resource + /// + public partial class DryrunResourceData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DryrunResourceData() + { + PrerequisiteResults = new ChangeTrackingList(); + OperationPreviews = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// + /// the result of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// the preview of the operations for creation. + /// The provisioning state. + /// Keeps track of any properties unknown to the library. + internal DryrunResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DryrunParameters parameters, IReadOnlyList prerequisiteResults, IReadOnlyList operationPreviews, string provisioningState, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Parameters = parameters; + PrerequisiteResults = prerequisiteResults; + OperationPreviews = operationPreviews; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public DryrunParameters Parameters { get; set; } + /// + /// the result of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IReadOnlyList PrerequisiteResults { get; } + /// the preview of the operations for creation. + public IReadOnlyList OperationPreviews { get; } + /// The provisioning state. + public string ProvisioningState { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmClient.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmClient.cs index 70f5c2afafb0..9d1dafa84588 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmClient.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmClient.cs @@ -8,13 +8,19 @@ using System; using System.Threading; using System.Threading.Tasks; +using Autorest.CSharp.Core; using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ServiceLinker.Models; namespace Azure.ResourceManager.ServiceLinker.Mocking { /// A class to add extension methods to ArmClient. public partial class MockableServiceLinkerArmClient : ArmResource { + private ClientDiagnostics _dryrunLinkersClientDiagnostics; + private LinkersRestOperations _dryrunLinkersRestClient; + /// Initializes a new instance of the class for mocking. protected MockableServiceLinkerArmClient() { @@ -31,18 +37,93 @@ internal MockableServiceLinkerArmClient(ArmClient client) : this(client, Resourc { } + private ClientDiagnostics DryrunLinkersClientDiagnostics => _dryrunLinkersClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", DryrunResource.ResourceType.Namespace, Diagnostics); + private LinkersRestOperations DryrunLinkersRestClient => _dryrunLinkersRestClient ??= new LinkersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(DryrunResource.ResourceType)); + private string GetApiVersionOrNull(ResourceType resourceType) { TryGetApiVersion(resourceType, out string apiVersion); return apiVersion; } + /// Gets a collection of DryrunResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of DryrunResources and their operations over a DryrunResource. + public virtual DryrunCollection GetDryruns(ResourceIdentifier scope) + { + return new DryrunCollection(Client, scope); + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of dryrun. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetDryrunAsync(ResourceIdentifier scope, string dryrunName, CancellationToken cancellationToken = default) + { + return await GetDryruns(scope).GetAsync(dryrunName, cancellationToken).ConfigureAwait(false); + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// The name of dryrun. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetDryrun(ResourceIdentifier scope, string dryrunName, CancellationToken cancellationToken = default) + { + return GetDryruns(scope).Get(dryrunName, cancellationToken); + } + /// Gets a collection of LinkerResources in the ArmClient. /// The scope that the resource will apply against. /// An object representing collection of LinkerResources and their operations over a LinkerResource. - public virtual LinkerResourceCollection GetLinkerResources(ResourceIdentifier scope) + public virtual LinkerCollection GetLinkers(ResourceIdentifier scope) { - return new LinkerResourceCollection(Client, scope); + return new LinkerCollection(Client, scope); } /// @@ -58,7 +139,7 @@ public virtual LinkerResourceCollection GetLinkerResources(ResourceIdentifier sc /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -72,9 +153,9 @@ public virtual LinkerResourceCollection GetLinkerResources(ResourceIdentifier sc /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetLinkerResourceAsync(ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + public virtual async Task> GetLinkerAsync(ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) { - return await GetLinkerResources(scope).GetAsync(linkerName, cancellationToken).ConfigureAwait(false); + return await GetLinkers(scope).GetAsync(linkerName, cancellationToken).ConfigureAwait(false); } /// @@ -90,7 +171,7 @@ public virtual async Task> GetLinkerResourceAsync(Resou /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -104,9 +185,112 @@ public virtual async Task> GetLinkerResourceAsync(Resou /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetLinkerResource(ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + public virtual Response GetLinker(ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + { + return GetLinkers(scope).Get(linkerName, cancellationToken); + } + + /// + /// List the dapr configuration supported by Service Connector. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/daprConfigurations + /// + /// + /// Operation Id + /// Linkers_ListDaprConfigurations + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetDaprConfigurationsLinkersAsync(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DryrunLinkersRestClient.CreateListDaprConfigurationsRequest(scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DryrunLinkersRestClient.CreateListDaprConfigurationsNextPageRequest(nextLink, scope); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DaprConfigurationResource.DeserializeDaprConfigurationResource(e), DryrunLinkersClientDiagnostics, Pipeline, "MockableServiceLinkerArmClient.GetDaprConfigurationsLinkers", "value", "nextLink", cancellationToken); + } + + /// + /// List the dapr configuration supported by Service Connector. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/daprConfigurations + /// + /// + /// Operation Id + /// Linkers_ListDaprConfigurations + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetDaprConfigurationsLinkers(ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(scope, nameof(scope)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => DryrunLinkersRestClient.CreateListDaprConfigurationsRequest(scope); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => DryrunLinkersRestClient.CreateListDaprConfigurationsNextPageRequest(nextLink, scope); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DaprConfigurationResource.DeserializeDaprConfigurationResource(e), DryrunLinkersClientDiagnostics, Pipeline, "MockableServiceLinkerArmClient.GetDaprConfigurationsLinkers", "value", "nextLink", cancellationToken); + } + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LocationDryrunResource GetLocationDryrunResource(ResourceIdentifier id) + { + LocationDryrunResource.ValidateResourceId(id); + return new LocationDryrunResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual DryrunResource GetDryrunResource(ResourceIdentifier id) + { + DryrunResource.ValidateResourceId(id); + return new DryrunResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual LocationConnectorResource GetLocationConnectorResource(ResourceIdentifier id) { - return GetLinkerResources(scope).Get(linkerName, cancellationToken); + LocationConnectorResource.ValidateResourceId(id); + return new LocationConnectorResource(Client, id); } /// diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmResource.cs index 3ab29c77b49b..968d81b0c480 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmResource.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmResource.cs @@ -35,9 +35,9 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// Gets a collection of LinkerResources in the ArmResource. /// An object representing collection of LinkerResources and their operations over a LinkerResource. - public virtual LinkerResourceCollection GetLinkerResources() + public virtual LinkerCollection GetLinkers() { - return GetCachedClient(client => new LinkerResourceCollection(client, Id)); + return GetCachedClient(client => new LinkerCollection(client, Id)); } /// @@ -53,7 +53,7 @@ public virtual LinkerResourceCollection GetLinkerResources() /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -66,9 +66,9 @@ public virtual LinkerResourceCollection GetLinkerResources() /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual async Task> GetLinkerResourceAsync(string linkerName, CancellationToken cancellationToken = default) + public virtual async Task> GetLinkerAsync(string linkerName, CancellationToken cancellationToken = default) { - return await GetLinkerResources().GetAsync(linkerName, cancellationToken).ConfigureAwait(false); + return await GetLinkers().GetAsync(linkerName, cancellationToken).ConfigureAwait(false); } /// @@ -84,7 +84,7 @@ public virtual async Task> GetLinkerResourceAsync(strin /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -97,9 +97,9 @@ public virtual async Task> GetLinkerResourceAsync(strin /// is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public virtual Response GetLinkerResource(string linkerName, CancellationToken cancellationToken = default) + public virtual Response GetLinker(string linkerName, CancellationToken cancellationToken = default) { - return GetLinkerResources().Get(linkerName, cancellationToken); + return GetLinkers().Get(linkerName, cancellationToken); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerResourceGroupResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerResourceGroupResource.cs new file mode 100644 index 000000000000..5d257c85dd5a --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerResourceGroupResource.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableServiceLinkerResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableServiceLinkerResourceGroupResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableServiceLinkerResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of LocationDryrunResources in the ResourceGroupResource. + /// The name of Azure region. + /// An object representing collection of LocationDryrunResources and their operations over a LocationDryrunResource. + public virtual LocationDryrunCollection GetLocationDryruns(AzureLocation location) + { + return new LocationDryrunCollection(Client, Id, location); + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLocationDryrunAsync(AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + return await GetLocationDryruns(location).GetAsync(dryrunName, cancellationToken).ConfigureAwait(false); + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLocationDryrun(AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + return GetLocationDryruns(location).Get(dryrunName, cancellationToken); + } + + /// Gets a collection of LocationConnectorResources in the ResourceGroupResource. + /// The name of Azure region. + /// An object representing collection of LocationConnectorResources and their operations over a LocationConnectorResource. + public virtual LocationConnectorCollection GetLocationConnectors(AzureLocation location) + { + return new LocationConnectorCollection(Client, Id, location); + } + + /// + /// Returns Connector resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetLocationConnectorAsync(AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + return await GetLocationConnectors(location).GetAsync(connectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns Connector resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetLocationConnector(AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + return GetLocationConnectors(location).Get(connectorName, cancellationToken); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerTenantResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerTenantResource.cs new file mode 100644 index 000000000000..42359db48951 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerTenantResource.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker.Mocking +{ + /// A class to add extension methods to TenantResource. + public partial class MockableServiceLinkerTenantResource : ArmResource + { + private ClientDiagnostics _configurationNamesClientDiagnostics; + private ConfigurationNamesRestOperations _configurationNamesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableServiceLinkerTenantResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal MockableServiceLinkerTenantResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ConfigurationNamesClientDiagnostics => _configurationNamesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ConfigurationNamesRestOperations ConfigurationNamesRestClient => _configurationNamesRestClient ??= new ConfigurationNamesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// + /// + /// Request Path + /// /providers/Microsoft.ServiceLinker/configurationNames + /// + /// + /// Operation Id + /// ConfigurationNames_List + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetConfigurationNamesAsync(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationNamesRestClient.CreateListRequest(filter, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfigurationNamesRestClient.CreateListNextPageRequest(nextLink, filter, skipToken); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ConfigurationNameItem.DeserializeConfigurationNameItem(e), ConfigurationNamesClientDiagnostics, Pipeline, "MockableServiceLinkerTenantResource.GetConfigurationNames", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// + /// + /// Request Path + /// /providers/Microsoft.ServiceLinker/configurationNames + /// + /// + /// Operation Id + /// ConfigurationNames_List + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetConfigurationNames(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationNamesRestClient.CreateListRequest(filter, skipToken); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ConfigurationNamesRestClient.CreateListNextPageRequest(nextLink, filter, skipToken); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ConfigurationNameItem.DeserializeConfigurationNameItem(e), ConfigurationNamesClientDiagnostics, Pipeline, "MockableServiceLinkerTenantResource.GetConfigurationNames", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs index c1f30b097150..f21e07a2bdb9 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs @@ -9,7 +9,9 @@ using System.Threading; using System.Threading.Tasks; using Azure.Core; +using Azure.ResourceManager.Resources; using Azure.ResourceManager.ServiceLinker.Mocking; +using Azure.ResourceManager.ServiceLinker.Models; namespace Azure.ResourceManager.ServiceLinker { @@ -26,22 +28,128 @@ private static MockableServiceLinkerArmResource GetMockableServiceLinkerArmResou return resource.GetCachedClient(client => new MockableServiceLinkerArmResource(client, resource.Id)); } + private static MockableServiceLinkerResourceGroupResource GetMockableServiceLinkerResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableServiceLinkerResourceGroupResource(client, resource.Id)); + } + + private static MockableServiceLinkerTenantResource GetMockableServiceLinkerTenantResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableServiceLinkerTenantResource(client, resource.Id)); + } + + /// + /// Gets a collection of DryrunResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// is null. + /// An object representing collection of DryrunResources and their operations over a DryrunResource. + public static DryrunCollection GetDryruns(this ArmClient client, ResourceIdentifier scope) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableServiceLinkerArmClient(client).GetDryruns(scope); + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetDryrunAsync(this ArmClient client, ResourceIdentifier scope, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(client, nameof(client)); + + return await GetMockableServiceLinkerArmClient(client).GetDryrunAsync(scope, dryrunName, cancellationToken).ConfigureAwait(false); + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Linkers_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetDryrun(this ArmClient client, ResourceIdentifier scope, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableServiceLinkerArmClient(client).GetDryrun(scope, dryrunName, cancellationToken); + } + /// /// Gets a collection of LinkerResources in the ArmClient. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// The scope that the resource will apply against. /// is null. /// An object representing collection of LinkerResources and their operations over a LinkerResource. - public static LinkerResourceCollection GetLinkerResources(this ArmClient client, ResourceIdentifier scope) + public static LinkerCollection GetLinkers(this ArmClient client, ResourceIdentifier scope) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableServiceLinkerArmClient(client).GetLinkerResources(scope); + return GetMockableServiceLinkerArmClient(client).GetLinkers(scope); } /// @@ -57,7 +165,7 @@ public static LinkerResourceCollection GetLinkerResources(this ArmClient client, /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -66,7 +174,7 @@ public static LinkerResourceCollection GetLinkerResources(this ArmClient client, /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -76,11 +184,11 @@ public static LinkerResourceCollection GetLinkerResources(this ArmClient client, /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetLinkerResourceAsync(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + public static async Task> GetLinkerAsync(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(client, nameof(client)); - return await GetMockableServiceLinkerArmClient(client).GetLinkerResourceAsync(scope, linkerName, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceLinkerArmClient(client).GetLinkerAsync(scope, linkerName, cancellationToken).ConfigureAwait(false); } /// @@ -96,7 +204,7 @@ public static async Task> GetLinkerResourceAsync(this A /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -105,7 +213,7 @@ public static async Task> GetLinkerResourceAsync(this A /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -115,11 +223,140 @@ public static async Task> GetLinkerResourceAsync(this A /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetLinkerResource(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + public static Response GetLinker(this ArmClient client, ResourceIdentifier scope, string linkerName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableServiceLinkerArmClient(client).GetLinker(scope, linkerName, cancellationToken); + } + + /// + /// List the dapr configuration supported by Service Connector. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/daprConfigurations + /// + /// + /// Operation Id + /// Linkers_ListDaprConfigurations + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The cancellation token to use. + /// is null. + public static AsyncPageable GetDaprConfigurationsLinkersAsync(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableServiceLinkerArmClient(client).GetDaprConfigurationsLinkersAsync(scope, cancellationToken); + } + + /// + /// List the dapr configuration supported by Service Connector. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/daprConfigurations + /// + /// + /// Operation Id + /// Linkers_ListDaprConfigurations + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// The cancellation token to use. + /// is null. + public static Pageable GetDaprConfigurationsLinkers(this ArmClient client, ResourceIdentifier scope, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableServiceLinkerArmClient(client).GetDaprConfigurationsLinkers(scope, cancellationToken); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static LocationDryrunResource GetLocationDryrunResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableServiceLinkerArmClient(client).GetLocationDryrunResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static DryrunResource GetDryrunResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableServiceLinkerArmClient(client).GetDryrunResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static LocationConnectorResource GetLocationConnectorResource(this ArmClient client, ResourceIdentifier id) { Argument.AssertNotNull(client, nameof(client)); - return GetMockableServiceLinkerArmClient(client).GetLinkerResource(scope, linkerName, cancellationToken); + return GetMockableServiceLinkerArmClient(client).GetLocationConnectorResource(id); } /// @@ -145,17 +382,17 @@ public static LinkerResource GetLinkerResource(this ArmClient client, ResourceId /// Gets a collection of LinkerResources in the ArmResource. /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. /// is null. /// An object representing collection of LinkerResources and their operations over a LinkerResource. - public static LinkerResourceCollection GetLinkerResources(this ArmResource armResource) + public static LinkerCollection GetLinkers(this ArmResource armResource) { Argument.AssertNotNull(armResource, nameof(armResource)); - return GetMockableServiceLinkerArmResource(armResource).GetLinkerResources(); + return GetMockableServiceLinkerArmResource(armResource).GetLinkers(); } /// @@ -171,7 +408,7 @@ public static LinkerResourceCollection GetLinkerResources(this ArmResource armRe /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -180,7 +417,7 @@ public static LinkerResourceCollection GetLinkerResources(this ArmResource armRe /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -189,11 +426,11 @@ public static LinkerResourceCollection GetLinkerResources(this ArmResource armRe /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static async Task> GetLinkerResourceAsync(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) + public static async Task> GetLinkerAsync(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(armResource, nameof(armResource)); - return await GetMockableServiceLinkerArmResource(armResource).GetLinkerResourceAsync(linkerName, cancellationToken).ConfigureAwait(false); + return await GetMockableServiceLinkerArmResource(armResource).GetLinkerAsync(linkerName, cancellationToken).ConfigureAwait(false); } /// @@ -209,7 +446,7 @@ public static async Task> GetLinkerResourceAsync(this A /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -218,7 +455,7 @@ public static async Task> GetLinkerResourceAsync(this A /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. @@ -227,11 +464,271 @@ public static async Task> GetLinkerResourceAsync(this A /// or is null. /// is an empty string, and was expected to be non-empty. [ForwardsClientCalls] - public static Response GetLinkerResource(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) + public static Response GetLinker(this ArmResource armResource, string linkerName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(armResource, nameof(armResource)); - return GetMockableServiceLinkerArmResource(armResource).GetLinkerResource(linkerName, cancellationToken); + return GetMockableServiceLinkerArmResource(armResource).GetLinker(linkerName, cancellationToken); + } + + /// + /// Gets a collection of LocationDryrunResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of Azure region. + /// is null. + /// An object representing collection of LocationDryrunResources and their operations over a LocationDryrunResource. + public static LocationDryrunCollection GetLocationDryruns(this ResourceGroupResource resourceGroupResource, AzureLocation location) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableServiceLinkerResourceGroupResource(resourceGroupResource).GetLocationDryruns(location); + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetLocationDryrunAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableServiceLinkerResourceGroupResource(resourceGroupResource).GetLocationDryrunAsync(location, dryrunName, cancellationToken).ConfigureAwait(false); + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetLocationDryrun(this ResourceGroupResource resourceGroupResource, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableServiceLinkerResourceGroupResource(resourceGroupResource).GetLocationDryrun(location, dryrunName, cancellationToken); + } + + /// + /// Gets a collection of LocationConnectorResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of Azure region. + /// is null. + /// An object representing collection of LocationConnectorResources and their operations over a LocationConnectorResource. + public static LocationConnectorCollection GetLocationConnectors(this ResourceGroupResource resourceGroupResource, AzureLocation location) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableServiceLinkerResourceGroupResource(resourceGroupResource).GetLocationConnectors(location); + } + + /// + /// Returns Connector resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetLocationConnectorAsync(this ResourceGroupResource resourceGroupResource, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableServiceLinkerResourceGroupResource(resourceGroupResource).GetLocationConnectorAsync(location, connectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Returns Connector resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetLocationConnector(this ResourceGroupResource resourceGroupResource, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableServiceLinkerResourceGroupResource(resourceGroupResource).GetLocationConnector(location, connectorName, cancellationToken); + } + + /// + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// + /// + /// Request Path + /// /providers/Microsoft.ServiceLinker/configurationNames + /// + /// + /// Operation Id + /// ConfigurationNames_List + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetConfigurationNamesAsync(this TenantResource tenantResource, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableServiceLinkerTenantResource(tenantResource).GetConfigurationNamesAsync(filter, skipToken, cancellationToken); + } + + /// + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// + /// + /// Request Path + /// /providers/Microsoft.ServiceLinker/configurationNames + /// + /// + /// Operation Id + /// ConfigurationNames_List + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetConfigurationNames(this TenantResource tenantResource, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tenantResource, nameof(tenantResource)); + + return GetMockableServiceLinkerTenantResource(tenantResource).GetConfigurationNames(filter, skipToken, cancellationToken); } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerCollection.cs similarity index 80% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerCollection.cs index 23ce6c384ebd..e3eb7f32e6b7 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerCollection.cs @@ -19,30 +19,30 @@ namespace Azure.ResourceManager.ServiceLinker /// /// A class representing a collection of and their operations. /// Each in the collection will belong to the same instance of . - /// To get a instance call the GetLinkerResources method from an instance of . + /// To get a instance call the GetLinkers method from an instance of . /// - public partial class LinkerResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + public partial class LinkerCollection : ArmCollection, IEnumerable, IAsyncEnumerable { - private readonly ClientDiagnostics _linkerResourceLinkerClientDiagnostics; - private readonly LinkerRestOperations _linkerResourceLinkerRestClient; + private readonly ClientDiagnostics _linkerClientDiagnostics; + private readonly LinkerRestOperations _linkerRestClient; - /// Initializes a new instance of the class for mocking. - protected LinkerResourceCollection() + /// Initializes a new instance of the class for mocking. + protected LinkerCollection() { } - /// Initializes a new instance of the class. + /// Initializes a new instance of the class. /// The client parameters to use in these operations. /// The identifier of the parent resource that is the target of operations. - internal LinkerResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + internal LinkerCollection(ArmClient client, ResourceIdentifier id) : base(client, id) { - _linkerResourceLinkerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", LinkerResource.ResourceType.Namespace, Diagnostics); - TryGetApiVersion(LinkerResource.ResourceType, out string linkerResourceLinkerApiVersion); - _linkerResourceLinkerRestClient = new LinkerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, linkerResourceLinkerApiVersion); + _linkerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", LinkerResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(LinkerResource.ResourceType, out string linkerApiVersion); + _linkerRestClient = new LinkerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, linkerApiVersion); } /// - /// Create or update linker resource. + /// Create or update Linker resource. /// /// /// Request Path @@ -54,7 +54,7 @@ internal LinkerResourceCollection(ArmClient client, ResourceIdentifier id) : bas /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -73,12 +73,12 @@ public virtual async Task> CreateOrUpdateAsync(Wait Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.CreateOrUpdate"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.CreateOrUpdate"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.CreateOrUpdateAsync(Id, linkerName, data, cancellationToken).ConfigureAwait(false); - var operation = new ServiceLinkerArmOperation(new LinkerResourceOperationSource(Client), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateCreateOrUpdateRequest(Id, linkerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _linkerRestClient.CreateOrUpdateAsync(Id, linkerName, data, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LinkerOperationSource(Client), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateCreateOrUpdateRequest(Id, linkerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -91,7 +91,7 @@ public virtual async Task> CreateOrUpdateAsync(Wait } /// - /// Create or update linker resource. + /// Create or update Linker resource. /// /// /// Request Path @@ -103,7 +103,7 @@ public virtual async Task> CreateOrUpdateAsync(Wait /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -122,12 +122,12 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); Argument.AssertNotNull(data, nameof(data)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.CreateOrUpdate"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.CreateOrUpdate"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.CreateOrUpdate(Id, linkerName, data, cancellationToken); - var operation = new ServiceLinkerArmOperation(new LinkerResourceOperationSource(Client), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateCreateOrUpdateRequest(Id, linkerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _linkerRestClient.CreateOrUpdate(Id, linkerName, data, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LinkerOperationSource(Client), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateCreateOrUpdateRequest(Id, linkerName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -152,7 +152,7 @@ public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -168,11 +168,11 @@ public virtual async Task> GetAsync(string linkerName, { Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.Get"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.Get"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.GetAsync(Id, linkerName, cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.GetAsync(Id, linkerName, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); @@ -197,7 +197,7 @@ public virtual async Task> GetAsync(string linkerName, /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -213,11 +213,11 @@ public virtual Response Get(string linkerName, CancellationToken { Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.Get"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.Get"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Get(Id, linkerName, cancellationToken); + var response = _linkerRestClient.Get(Id, linkerName, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); @@ -230,7 +230,7 @@ public virtual Response Get(string linkerName, CancellationToken } /// - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// /// /// Request Path @@ -242,7 +242,7 @@ public virtual Response Get(string linkerName, CancellationToken /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -254,13 +254,13 @@ public virtual Response Get(string linkerName, CancellationToken /// An async collection of that may take multiple service requests to iterate over. public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _linkerResourceLinkerRestClient.CreateListRequest(Id); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _linkerResourceLinkerRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LinkerResource(Client, LinkerResourceData.DeserializeLinkerResourceData(e)), _linkerResourceLinkerClientDiagnostics, Pipeline, "LinkerResourceCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _linkerRestClient.CreateListRequest(Id); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _linkerRestClient.CreateListNextPageRequest(nextLink, Id); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LinkerResource(Client, LinkerResourceData.DeserializeLinkerResourceData(e)), _linkerClientDiagnostics, Pipeline, "LinkerCollection.GetAll", "value", "nextLink", cancellationToken); } /// - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// /// /// Request Path @@ -272,7 +272,7 @@ public virtual AsyncPageable GetAllAsync(CancellationToken cance /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -284,9 +284,9 @@ public virtual AsyncPageable GetAllAsync(CancellationToken cance /// A collection of that may take multiple service requests to iterate over. public virtual Pageable GetAll(CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _linkerResourceLinkerRestClient.CreateListRequest(Id); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _linkerResourceLinkerRestClient.CreateListNextPageRequest(nextLink, Id); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LinkerResource(Client, LinkerResourceData.DeserializeLinkerResourceData(e)), _linkerResourceLinkerClientDiagnostics, Pipeline, "LinkerResourceCollection.GetAll", "value", "nextLink", cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _linkerRestClient.CreateListRequest(Id); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _linkerRestClient.CreateListNextPageRequest(nextLink, Id); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LinkerResource(Client, LinkerResourceData.DeserializeLinkerResourceData(e)), _linkerClientDiagnostics, Pipeline, "LinkerCollection.GetAll", "value", "nextLink", cancellationToken); } /// @@ -302,7 +302,7 @@ public virtual Pageable GetAll(CancellationToken cancellationTok /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -318,11 +318,11 @@ public virtual async Task> ExistsAsync(string linkerName, Cancell { Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.Exists"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.Exists"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.GetAsync(Id, linkerName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.GetAsync(Id, linkerName, cancellationToken: cancellationToken).ConfigureAwait(false); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -345,7 +345,7 @@ public virtual async Task> ExistsAsync(string linkerName, Cancell /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -361,11 +361,11 @@ public virtual Response Exists(string linkerName, CancellationToken cancel { Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.Exists"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.Exists"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Get(Id, linkerName, cancellationToken: cancellationToken); + var response = _linkerRestClient.Get(Id, linkerName, cancellationToken: cancellationToken); return Response.FromValue(response.Value != null, response.GetRawResponse()); } catch (Exception e) @@ -388,7 +388,7 @@ public virtual Response Exists(string linkerName, CancellationToken cancel /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -404,11 +404,11 @@ public virtual async Task> GetIfExistsAsync(str { Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.GetIfExists"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.GetIfExists"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.GetAsync(Id, linkerName, cancellationToken: cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.GetAsync(Id, linkerName, cancellationToken: cancellationToken).ConfigureAwait(false); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); @@ -433,7 +433,7 @@ public virtual async Task> GetIfExistsAsync(str /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -449,11 +449,11 @@ public virtual NullableResponse GetIfExists(string linkerName, C { Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResourceCollection.GetIfExists"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerCollection.GetIfExists"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Get(Id, linkerName, cancellationToken: cancellationToken); + var response = _linkerRestClient.Get(Id, linkerName, cancellationToken: cancellationToken); if (response.Value == null) return new NoValueResponse(response.GetRawResponse()); return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs index 0bdcec9574c4..bbe82df48108 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs @@ -16,10 +16,10 @@ namespace Azure.ResourceManager.ServiceLinker { /// - /// A Class representing a LinkerResource along with the instance operations that can be performed on it. + /// A Class representing a Linker along with the instance operations that can be performed on it. /// If you have a you can construct a /// from an instance of using the GetLinkerResource method. - /// Otherwise you can get one from its parent resource using the GetLinkerResource method. + /// Otherwise you can get one from its parent resource using the GetLinker method. /// public partial class LinkerResource : ArmResource { @@ -32,8 +32,10 @@ public static ResourceIdentifier CreateResourceIdentifier(string resourceUri, st return new ResourceIdentifier(resourceId); } - private readonly ClientDiagnostics _linkerResourceLinkerClientDiagnostics; - private readonly LinkerRestOperations _linkerResourceLinkerRestClient; + private readonly ClientDiagnostics _linkerClientDiagnostics; + private readonly LinkerRestOperations _linkerRestClient; + private readonly ClientDiagnostics _dryrunLinkersClientDiagnostics; + private readonly LinkersRestOperations _dryrunLinkersRestClient; private readonly LinkerResourceData _data; /// Gets the resource type for the operations. @@ -58,9 +60,12 @@ internal LinkerResource(ArmClient client, LinkerResourceData data) : this(client /// The identifier of the resource that is the target of operations. internal LinkerResource(ArmClient client, ResourceIdentifier id) : base(client, id) { - _linkerResourceLinkerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ResourceType.Namespace, Diagnostics); - TryGetApiVersion(ResourceType, out string linkerResourceLinkerApiVersion); - _linkerResourceLinkerRestClient = new LinkerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, linkerResourceLinkerApiVersion); + _linkerClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string linkerApiVersion); + _linkerRestClient = new LinkerRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, linkerApiVersion); + _dryrunLinkersClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", DryrunResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DryrunResource.ResourceType, out string dryrunLinkersApiVersion); + _dryrunLinkersRestClient = new LinkersRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dryrunLinkersApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -100,7 +105,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -111,11 +116,11 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// The cancellation token to use. public virtual async Task> GetAsync(CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Get"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Get"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.GetAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.GetAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); @@ -140,7 +145,7 @@ public virtual async Task> GetAsync(CancellationToken c /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -151,11 +156,11 @@ public virtual async Task> GetAsync(CancellationToken c /// The cancellation token to use. public virtual Response Get(CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Get"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Get"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Get(Id.Parent, Id.Name, cancellationToken); + var response = _linkerRestClient.Get(Id.Parent, Id.Name, cancellationToken); if (response.Value == null) throw new RequestFailedException(response.GetRawResponse()); return Response.FromValue(new LinkerResource(Client, response.Value), response.GetRawResponse()); @@ -168,7 +173,7 @@ public virtual Response Get(CancellationToken cancellationToken } /// - /// Delete a link. + /// Delete a Linker. /// /// /// Request Path @@ -180,7 +185,7 @@ public virtual Response Get(CancellationToken cancellationToken /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -192,12 +197,12 @@ public virtual Response Get(CancellationToken cancellationToken /// The cancellation token to use. public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Delete"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Delete"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.DeleteAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ServiceLinkerArmOperation(_linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateDeleteRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _linkerRestClient.DeleteAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(_linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateDeleteRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -210,7 +215,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete a link. + /// Delete a Linker. /// /// /// Request Path @@ -222,7 +227,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -234,12 +239,12 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// The cancellation token to use. public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Delete"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Delete"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Delete(Id.Parent, Id.Name, cancellationToken); - var operation = new ServiceLinkerArmOperation(_linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateDeleteRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _linkerRestClient.Delete(Id.Parent, Id.Name, cancellationToken); + var operation = new ServiceLinkerArmOperation(_linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateDeleteRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletionResponse(cancellationToken); return operation; @@ -252,7 +257,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Operation to update an existing link. + /// Operation to update an existing Linker. /// /// /// Request Path @@ -264,7 +269,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -276,16 +281,16 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// Linker details. /// The cancellation token to use. /// is null. - public virtual async Task> UpdateAsync(WaitUntil waitUntil, LinkerResourcePatch patch, CancellationToken cancellationToken = default) + public virtual async Task> UpdateAsync(WaitUntil waitUntil, LinkerPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Update"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Update"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.UpdateAsync(Id.Parent, Id.Name, patch, cancellationToken).ConfigureAwait(false); - var operation = new ServiceLinkerArmOperation(new LinkerResourceOperationSource(Client), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateUpdateRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _linkerRestClient.UpdateAsync(Id.Parent, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LinkerOperationSource(Client), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateUpdateRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -298,7 +303,7 @@ public virtual async Task> UpdateAsync(WaitUntil wa } /// - /// Operation to update an existing link. + /// Operation to update an existing Linker. /// /// /// Request Path @@ -310,7 +315,7 @@ public virtual async Task> UpdateAsync(WaitUntil wa /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -322,16 +327,16 @@ public virtual async Task> UpdateAsync(WaitUntil wa /// Linker details. /// The cancellation token to use. /// is null. - public virtual ArmOperation Update(WaitUntil waitUntil, LinkerResourcePatch patch, CancellationToken cancellationToken = default) + public virtual ArmOperation Update(WaitUntil waitUntil, LinkerPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(patch, nameof(patch)); - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Update"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Update"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Update(Id.Parent, Id.Name, patch, cancellationToken); - var operation = new ServiceLinkerArmOperation(new LinkerResourceOperationSource(Client), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateUpdateRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _linkerRestClient.Update(Id.Parent, Id.Name, patch, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LinkerOperationSource(Client), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateUpdateRequest(Id.Parent, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -344,7 +349,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, LinkerRe } /// - /// Validate a link. + /// Validate a Linker. /// /// /// Request Path @@ -356,7 +361,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, LinkerRe /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -368,12 +373,12 @@ public virtual ArmOperation Update(WaitUntil waitUntil, LinkerRe /// The cancellation token to use. public virtual async Task> ValidateAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Validate"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Validate"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.ValidateAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); - var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateValidateRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = await _linkerRestClient.ValidateAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateValidateRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); return operation; @@ -386,7 +391,7 @@ public virtual async Task> ValidateA } /// - /// Validate a link. + /// Validate a Linker. /// /// /// Request Path @@ -398,7 +403,7 @@ public virtual async Task> ValidateA /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -410,12 +415,12 @@ public virtual async Task> ValidateA /// The cancellation token to use. public virtual ArmOperation Validate(WaitUntil waitUntil, CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.Validate"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.Validate"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.Validate(Id.Parent, Id.Name, cancellationToken); - var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _linkerResourceLinkerClientDiagnostics, Pipeline, _linkerResourceLinkerRestClient.CreateValidateRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + var response = _linkerRestClient.Validate(Id.Parent, Id.Name, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _linkerClientDiagnostics, Pipeline, _linkerRestClient.CreateValidateRequest(Id.Parent, Id.Name).Request, response, OperationFinalStateVia.Location); if (waitUntil == WaitUntil.Completed) operation.WaitForCompletion(cancellationToken); return operation; @@ -428,7 +433,7 @@ public virtual ArmOperation Validate(WaitUntil wa } /// - /// list source configurations for a linker. + /// list source configurations for a Linker. /// /// /// Request Path @@ -440,7 +445,7 @@ public virtual ArmOperation Validate(WaitUntil wa /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -449,13 +454,13 @@ public virtual ArmOperation Validate(WaitUntil wa /// /// /// The cancellation token to use. - public virtual async Task> GetConfigurationsAsync(CancellationToken cancellationToken = default) + public virtual async Task> GetConfigurationsAsync(CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.GetConfigurations"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.GetConfigurations"); scope.Start(); try { - var response = await _linkerResourceLinkerRestClient.ListConfigurationsAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); + var response = await _linkerRestClient.ListConfigurationsAsync(Id.Parent, Id.Name, cancellationToken).ConfigureAwait(false); return response; } catch (Exception e) @@ -466,7 +471,7 @@ public virtual async Task> GetConfigurations } /// - /// list source configurations for a linker. + /// list source configurations for a Linker. /// /// /// Request Path @@ -478,7 +483,7 @@ public virtual async Task> GetConfigurations /// /// /// Default Api Version - /// 2022-05-01 + /// 2023-04-01-preview /// /// /// Resource @@ -487,13 +492,91 @@ public virtual async Task> GetConfigurations /// /// /// The cancellation token to use. - public virtual Response GetConfigurations(CancellationToken cancellationToken = default) + public virtual Response GetConfigurations(CancellationToken cancellationToken = default) { - using var scope = _linkerResourceLinkerClientDiagnostics.CreateScope("LinkerResource.GetConfigurations"); + using var scope = _linkerClientDiagnostics.CreateScope("LinkerResource.GetConfigurations"); scope.Start(); try { - var response = _linkerResourceLinkerRestClient.ListConfigurations(Id.Parent, Id.Name, cancellationToken); + var response = _linkerRestClient.ListConfigurations(Id.Parent, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generate configurations for a Linker. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations + /// + /// + /// Operation Id + /// Linkers_GenerateConfigurations + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + public virtual async Task> GenerateConfigurationsAsync(ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("LinkerResource.GenerateConfigurations"); + scope.Start(); + try + { + var response = await _dryrunLinkersRestClient.GenerateConfigurationsAsync(Id.Parent, Id.Name, info, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generate configurations for a Linker. + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ServiceLinker/linkers/{linkerName}/generateConfigurations + /// + /// + /// Operation Id + /// Linkers_GenerateConfigurations + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + public virtual Response GenerateConfigurations(ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + using var scope = _dryrunLinkersClientDiagnostics.CreateScope("LinkerResource.GenerateConfigurations"); + scope.Start(); + try + { + var response = _dryrunLinkersRestClient.GenerateConfigurations(Id.Parent, Id.Name, info, cancellationToken); return response; } catch (Exception e) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.Serialization.cs index 8c18577daae6..b47b8cf0024d 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.Serialization.cs @@ -106,6 +106,30 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit writer.WriteNull("scope"); } } + if (Optional.IsDefined(PublicNetworkSolution)) + { + if (PublicNetworkSolution != null) + { + writer.WritePropertyName("publicNetworkSolution"u8); + writer.WriteObjectValue(PublicNetworkSolution, options); + } + else + { + writer.WriteNull("publicNetworkSolution"); + } + } + if (Optional.IsDefined(ConfigurationInfo)) + { + if (ConfigurationInfo != null) + { + writer.WritePropertyName("configurationInfo"u8); + writer.WriteObjectValue(ConfigurationInfo, options); + } + else + { + writer.WriteNull("configurationInfo"); + } + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -156,6 +180,8 @@ internal static LinkerResourceData DeserializeLinkerResourceData(JsonElement ele VnetSolution vnetSolution = default; LinkerSecretStore secretStore = default; string scope = default; + PublicNetworkSolution publicNetworkSolution = default; + ConfigurationInfo configurationInfo = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -255,6 +281,26 @@ internal static LinkerResourceData DeserializeLinkerResourceData(JsonElement ele scope = property0.Value.GetString(); continue; } + if (property0.NameEquals("publicNetworkSolution"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + publicNetworkSolution = null; + continue; + } + publicNetworkSolution = PublicNetworkSolution.DeserializePublicNetworkSolution(property0.Value, options); + continue; + } + if (property0.NameEquals("configurationInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + configurationInfo = null; + continue; + } + configurationInfo = ConfigurationInfo.DeserializeConfigurationInfo(property0.Value, options); + continue; + } } continue; } @@ -276,6 +322,8 @@ internal static LinkerResourceData DeserializeLinkerResourceData(JsonElement ele vnetSolution, secretStore, scope, + publicNetworkSolution, + configurationInfo, serializedAdditionalRawData); } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs index 8db41809168e..abd2475f1e94 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs @@ -64,20 +64,22 @@ public LinkerResourceData() /// /// The target service properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , , and . /// /// /// The authentication type. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , , , , and . /// /// The application client type. /// The provisioning state. /// The VNet solution. /// An option to store secret value in secure place. /// connection scope in source service. + /// The network solution. + /// The connection information consumed by applications, including secrets, connection strings. /// Keeps track of any properties unknown to the library. - internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope, PublicNetworkSolution publicNetworkSolution, ConfigurationInfo configurationInfo, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) { TargetService = targetService; AuthInfo = authInfo; @@ -86,19 +88,21 @@ internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType res VnetSolution = vnetSolution; SecretStore = secretStore; Scope = scope; + PublicNetworkSolution = publicNetworkSolution; + ConfigurationInfo = configurationInfo; _serializedAdditionalRawData = serializedAdditionalRawData; } /// /// The target service properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , , and . /// public TargetServiceBaseInfo TargetService { get; set; } /// /// The authentication type. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , , , , and . /// public AuthBaseInfo AuthInfo { get; set; } /// The application client type. @@ -106,34 +110,14 @@ internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType res /// The provisioning state. public string ProvisioningState { get; } /// The VNet solution. - internal VnetSolution VnetSolution { get; set; } - /// Type of VNet solution. - public VnetSolutionType? SolutionType - { - get => VnetSolution is null ? default : VnetSolution.SolutionType; - set - { - if (VnetSolution is null) - VnetSolution = new VnetSolution(); - VnetSolution.SolutionType = value; - } - } - + public VnetSolution VnetSolution { get; set; } /// An option to store secret value in secure place. - internal LinkerSecretStore SecretStore { get; set; } - /// The key vault id to store secret. - public ResourceIdentifier SecretStoreKeyVaultId - { - get => SecretStore is null ? default : SecretStore.KeyVaultId; - set - { - if (SecretStore is null) - SecretStore = new LinkerSecretStore(); - SecretStore.KeyVaultId = value; - } - } - + public LinkerSecretStore SecretStore { get; set; } /// connection scope in source service. public string Scope { get; set; } + /// The network solution. + public PublicNetworkSolution PublicNetworkSolution { get; set; } + /// The connection information consumed by applications, including secrets, connection strings. + public ConfigurationInfo ConfigurationInfo { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorCollection.cs new file mode 100644 index 000000000000..3ed7fbb390a0 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorCollection.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetLocationConnectors method from an instance of . + /// + public partial class LocationConnectorCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _locationConnectorConnectorClientDiagnostics; + private readonly ConnectorRestOperations _locationConnectorConnectorRestClient; + private readonly AzureLocation _location; + + /// Initializes a new instance of the class for mocking. + protected LocationConnectorCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + /// The name of Azure region. + internal LocationConnectorCollection(ArmClient client, ResourceIdentifier id, AzureLocation location) : base(client, id) + { + _location = location; + _locationConnectorConnectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", LocationConnectorResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(LocationConnectorResource.ResourceType, out string locationConnectorConnectorApiVersion); + _locationConnectorConnectorRestClient = new ConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, locationConnectorConnectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create or update Connector resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of resource. + /// Connector details. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string connectorName, LinkerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, data, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LocationConnectorOperationSource(Client), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update Connector resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of resource. + /// Connector details. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string connectorName, LinkerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, data, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LocationConnectorOperationSource(Client), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns Connector resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.Get"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns Connector resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.Get"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors + /// + /// + /// Operation Id + /// Connector_List + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _locationConnectorConnectorRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _locationConnectorConnectorRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location)); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LocationConnectorResource(Client, LinkerResourceData.DeserializeLinkerResourceData(e)), _locationConnectorConnectorClientDiagnostics, Pipeline, "LocationConnectorCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors + /// + /// + /// Operation Id + /// Connector_List + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _locationConnectorConnectorRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _locationConnectorConnectorRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location)); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LocationConnectorResource(Client, LinkerResourceData.DeserializeLinkerResourceData(e)), _locationConnectorConnectorClientDiagnostics, Pipeline, "LocationConnectorCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.Exists"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.Exists"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocationConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), connectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocationConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.Serialization.cs new file mode 100644 index 000000000000..0046151a883d --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.ServiceLinker +{ + public partial class LocationConnectorResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + LinkerResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + LinkerResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.cs new file mode 100644 index 000000000000..5d2c759d7d85 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.cs @@ -0,0 +1,511 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// A Class representing a LocationConnector along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetLocationConnectorResource method. + /// Otherwise you can get one from its parent resource using the GetLocationConnector method. + /// + public partial class LocationConnectorResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The location. + /// The connectorName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _locationConnectorConnectorClientDiagnostics; + private readonly ConnectorRestOperations _locationConnectorConnectorRestClient; + private readonly LinkerResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ServiceLinker/locations/connectors"; + + /// Initializes a new instance of the class for mocking. + protected LocationConnectorResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal LocationConnectorResource(ArmClient client, LinkerResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal LocationConnectorResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _locationConnectorConnectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string locationConnectorConnectorApiVersion); + _locationConnectorConnectorRestClient = new ConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, locationConnectorConnectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual LinkerResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Returns Connector resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Get"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns Connector resource for a given name. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Get"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Connector. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Delete + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Delete"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(_locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Connector. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Delete + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Delete"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + var operation = new ServiceLinkerArmOperation(_locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Operation to update an existing Connector. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Update + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Connector details. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, LinkerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Update"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LocationConnectorOperationSource(Client), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Operation to update an existing Connector. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Update + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Connector details. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, LinkerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Update"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LocationConnectorOperationSource(Client), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validate a Connector. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate + /// + /// + /// Operation Id + /// Connector_Validate + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> ValidateAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Validate"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.ValidateAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateValidateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Validate a Connector. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/validate + /// + /// + /// Operation Id + /// Connector_Validate + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Validate(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.Validate"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.Validate(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LinkerValidateOperationResultOperationSource(), _locationConnectorConnectorClientDiagnostics, Pipeline, _locationConnectorConnectorRestClient.CreateValidateRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generate configurations for a Connector. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations + /// + /// + /// Operation Id + /// Connector_GenerateConfigurations + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + public virtual async Task> GenerateConfigurationsAsync(ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.GenerateConfigurations"); + scope.Start(); + try + { + var response = await _locationConnectorConnectorRestClient.GenerateConfigurationsAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, info, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Generate configurations for a Connector. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/connectors/{connectorName}/generateConfigurations + /// + /// + /// Operation Id + /// Connector_GenerateConfigurations + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + public virtual Response GenerateConfigurations(ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + using var scope = _locationConnectorConnectorClientDiagnostics.CreateScope("LocationConnectorResource.GenerateConfigurations"); + scope.Start(); + try + { + var response = _locationConnectorConnectorRestClient.GenerateConfigurations(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, info, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunCollection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunCollection.cs new file mode 100644 index 000000000000..79963d9c95e5 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunCollection.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetLocationDryruns method from an instance of . + /// + public partial class LocationDryrunCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _locationDryrunConnectorClientDiagnostics; + private readonly ConnectorRestOperations _locationDryrunConnectorRestClient; + private readonly AzureLocation _location; + + /// Initializes a new instance of the class for mocking. + protected LocationDryrunCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + /// The name of Azure region. + internal LocationDryrunCollection(ArmClient client, ResourceIdentifier id, AzureLocation location) : base(client, id) + { + _location = location; + _locationDryrunConnectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", LocationDryrunResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(LocationDryrunResource.ResourceType, out string locationDryrunConnectorApiVersion); + _locationDryrunConnectorRestClient = new ConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, locationDryrunConnectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// create a dryrun job to do necessary check before actual creation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_CreateDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.CreateDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, data, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LocationDryrunOperationSource(Client), _locationDryrunConnectorClientDiagnostics, Pipeline, _locationDryrunConnectorRestClient.CreateCreateDryrunRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// create a dryrun job to do necessary check before actual creation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_CreateDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.CreateDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, data, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LocationDryrunOperationSource(Client), _locationDryrunConnectorClientDiagnostics, Pipeline, _locationDryrunConnectorRestClient.CreateCreateDryrunRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.Get"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.GetDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationDryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.Get"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.GetDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationDryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// list dryrun jobs + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns + /// + /// + /// Operation Id + /// Connector_ListDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _locationDryrunConnectorRestClient.CreateListDryrunRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _locationDryrunConnectorRestClient.CreateListDryrunNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location)); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new LocationDryrunResource(Client, DryrunResourceData.DeserializeDryrunResourceData(e)), _locationDryrunConnectorClientDiagnostics, Pipeline, "LocationDryrunCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// list dryrun jobs + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns + /// + /// + /// Operation Id + /// Connector_ListDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _locationDryrunConnectorRestClient.CreateListDryrunRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location)); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _locationDryrunConnectorRestClient.CreateListDryrunNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location)); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new LocationDryrunResource(Client, DryrunResourceData.DeserializeDryrunResourceData(e)), _locationDryrunConnectorClientDiagnostics, Pipeline, "LocationDryrunCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.Exists"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.GetDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.Exists"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.GetDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.GetDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocationDryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of dryrun. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunCollection.GetIfExists"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.GetDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(_location), dryrunName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new LocationDryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.Serialization.cs new file mode 100644 index 000000000000..f10309e3f737 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.ServiceLinker +{ + public partial class LocationDryrunResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + DryrunResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + DryrunResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.cs new file mode 100644 index 000000000000..f0f546e1edbc --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + /// + /// A Class representing a LocationDryrun along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetLocationDryrunResource method. + /// Otherwise you can get one from its parent resource using the GetLocationDryrun method. + /// + public partial class LocationDryrunResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The location. + /// The dryrunName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _locationDryrunConnectorClientDiagnostics; + private readonly ConnectorRestOperations _locationDryrunConnectorRestClient; + private readonly DryrunResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ServiceLinker/locations/dryruns"; + + /// Initializes a new instance of the class for mocking. + protected LocationDryrunResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal LocationDryrunResource(ArmClient client, DryrunResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal LocationDryrunResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _locationDryrunConnectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ServiceLinker", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string locationDryrunConnectorApiVersion); + _locationDryrunConnectorRestClient = new ConnectorRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, locationDryrunConnectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DryrunResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Get"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.GetDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationDryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// get a dryrun job + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_GetDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Get"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.GetDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new LocationDryrunResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// delete a dryrun job + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_DeleteDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Delete"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.DeleteDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _locationDryrunConnectorRestClient.CreateDeleteDryrunRequestUri(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ServiceLinkerArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// delete a dryrun job + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_DeleteDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Delete"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.DeleteDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, cancellationToken); + var uri = _locationDryrunConnectorRestClient.CreateDeleteDryrunRequestUri(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ServiceLinkerArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// update a dryrun job to do necessary check before actual creation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_UpdateDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// dryrun resource. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Update"); + scope.Start(); + try + { + var response = await _locationDryrunConnectorRestClient.UpdateDryrunAsync(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new ServiceLinkerArmOperation(new LocationDryrunOperationSource(Client), _locationDryrunConnectorClientDiagnostics, Pipeline, _locationDryrunConnectorRestClient.CreateUpdateDryrunRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// update a dryrun job to do necessary check before actual creation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.ServiceLinker/locations/{location}/dryruns/{dryrunName} + /// + /// + /// Operation Id + /// Connector_UpdateDryrun + /// + /// + /// Default Api Version + /// 2023-04-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// dryrun resource. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _locationDryrunConnectorClientDiagnostics.CreateScope("LocationDryrunResource.Update"); + scope.Start(); + try + { + var response = _locationDryrunConnectorRestClient.UpdateDryrun(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch, cancellationToken); + var operation = new ServiceLinkerArmOperation(new LocationDryrunOperationSource(Client), _locationDryrunConnectorClientDiagnostics, Pipeline, _locationDryrunConnectorRestClient.CreateUpdateDryrunRequest(Id.SubscriptionId, Id.ResourceGroupName, new AzureLocation(Id.Parent.Name), Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/DryrunOperationSource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/DryrunOperationSource.cs new file mode 100644 index 000000000000..882b62e44677 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/DryrunOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal class DryrunOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DryrunOperationSource(ArmClient client) + { + _client = client; + } + + DryrunResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return new DryrunResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return new DryrunResource(_client, data); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerResourceOperationSource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerOperationSource.cs similarity index 89% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerResourceOperationSource.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerOperationSource.cs index 5bba65234499..02a168f824a2 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerResourceOperationSource.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerOperationSource.cs @@ -12,11 +12,11 @@ namespace Azure.ResourceManager.ServiceLinker { - internal class LinkerResourceOperationSource : IOperationSource + internal class LinkerOperationSource : IOperationSource { private readonly ArmClient _client; - internal LinkerResourceOperationSource(ArmClient client) + internal LinkerOperationSource(ArmClient client) { _client = client; } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationConnectorOperationSource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationConnectorOperationSource.cs new file mode 100644 index 000000000000..443a68220a20 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationConnectorOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal class LocationConnectorOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal LocationConnectorOperationSource(ArmClient client) + { + _client = client; + } + + LocationConnectorResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = LinkerResourceData.DeserializeLinkerResourceData(document.RootElement); + return new LocationConnectorResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = LinkerResourceData.DeserializeLinkerResourceData(document.RootElement); + return new LocationConnectorResource(_client, data); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationDryrunOperationSource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationDryrunOperationSource.cs new file mode 100644 index 000000000000..b0b5ad39b46c --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationDryrunOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal class LocationDryrunOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal LocationDryrunOperationSource(ArmClient client) + { + _client = client; + } + + LocationDryrunResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return new LocationDryrunResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return new LocationDryrunResource(_client, data); + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.Serialization.cs new file mode 100644 index 000000000000..dddb1f945f30 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class AccessKeyInfoBase : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AccessKeyInfoBase)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Permissions)) + { + writer.WritePropertyName("permissions"u8); + writer.WriteStartArray(); + foreach (var item in Permissions) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("authType"u8); + writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AccessKeyInfoBase IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AccessKeyInfoBase)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAccessKeyInfoBase(document.RootElement, options); + } + + internal static AccessKeyInfoBase DeserializeAccessKeyInfoBase(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList permissions = default; + LinkerAuthType authType = default; + AuthMode? authMode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("permissions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new AccessKeyPermission(item.GetString())); + } + permissions = array; + continue; + } + if (property.NameEquals("authType"u8)) + { + authType = new LinkerAuthType(property.Value.GetString()); + continue; + } + if (property.NameEquals("authMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authMode = new AuthMode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AccessKeyInfoBase(authType, authMode, serializedAdditionalRawData, permissions ?? new ChangeTrackingList()); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AccessKeyInfoBase)} does not support writing '{options.Format}' format."); + } + } + + AccessKeyInfoBase IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAccessKeyInfoBase(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AccessKeyInfoBase)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.cs new file mode 100644 index 000000000000..e96f14055d0b --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The access key directly from target resource properties, which target service is Azure Resource, such as Microsoft.Storage. + public partial class AccessKeyInfoBase : AuthBaseInfo + { + /// Initializes a new instance of . + public AccessKeyInfoBase() + { + Permissions = new ChangeTrackingList(); + AuthType = LinkerAuthType.AccessKey; + } + + /// Initializes a new instance of . + /// The authentication type. + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. + /// Keeps track of any properties unknown to the library. + /// Permissions of the accessKey. `Read` and `Write` are for Azure Cosmos DB and Azure App Configuration, `Listen`, `Send` and `Manage` are for Azure Event Hub and Azure Service Bus. + internal AccessKeyInfoBase(LinkerAuthType authType, AuthMode? authMode, IDictionary serializedAdditionalRawData, IList permissions) : base(authType, authMode, serializedAdditionalRawData) + { + Permissions = permissions; + AuthType = authType; + } + + /// Permissions of the accessKey. `Read` and `Write` are for Azure Cosmos DB and Azure App Configuration, `Listen`, `Send` and `Manage` are for Azure Event Hub and Azure Service Bus. + public IList Permissions { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyPermission.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyPermission.cs new file mode 100644 index 000000000000..a8d5ff5a4e80 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyPermission.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The AccessKeyPermission. + public readonly partial struct AccessKeyPermission : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AccessKeyPermission(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ReadValue = "Read"; + private const string WriteValue = "Write"; + private const string ListenValue = "Listen"; + private const string SendValue = "Send"; + private const string ManageValue = "Manage"; + + /// Read. + public static AccessKeyPermission Read { get; } = new AccessKeyPermission(ReadValue); + /// Write. + public static AccessKeyPermission Write { get; } = new AccessKeyPermission(WriteValue); + /// Listen. + public static AccessKeyPermission Listen { get; } = new AccessKeyPermission(ListenValue); + /// Send. + public static AccessKeyPermission Send { get; } = new AccessKeyPermission(SendValue); + /// Manage. + public static AccessKeyPermission Manage { get; } = new AccessKeyPermission(ManageValue); + /// Determines if two values are the same. + public static bool operator ==(AccessKeyPermission left, AccessKeyPermission right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AccessKeyPermission left, AccessKeyPermission right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AccessKeyPermission(string value) => new AccessKeyPermission(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AccessKeyPermission other && Equals(other); + /// + public bool Equals(AccessKeyPermission 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ActionType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ActionType.cs new file mode 100644 index 000000000000..ddfcce6cf222 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ActionType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. + public readonly partial struct ActionType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ActionType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InternalValue = "Internal"; + private const string EnableValue = "enable"; + private const string OptOutValue = "optOut"; + + /// Internal. + public static ActionType Internal { get; } = new ActionType(InternalValue); + /// enable. + public static ActionType Enable { get; } = new ActionType(EnableValue); + /// optOut. + public static ActionType OptOut { get; } = new ActionType(OptOutValue); + /// Determines if two values are the same. + public static bool operator ==(ActionType left, ActionType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ActionType left, ActionType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ActionType(string value) => new ActionType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ActionType other && Equals(other); + /// + public bool Equals(ActionType 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AllowType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AllowType.cs new file mode 100644 index 000000000000..a8bdd5b38383 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AllowType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Whether to allow firewall rules. + public readonly partial struct AllowType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AllowType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "true"; + private const string FalseValue = "false"; + + /// true. + public static AllowType True { get; } = new AllowType(TrueValue); + /// false. + public static AllowType False { get; } = new AllowType(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(AllowType left, AllowType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AllowType left, AllowType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AllowType(string value) => new AllowType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AllowType other && Equals(other); + /// + public bool Equals(AllowType 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.Serialization.cs index 4f9a97274203..3c61d5da97fe 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.Serialization.cs @@ -28,6 +28,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpti writer.WriteStartObject(); writer.WritePropertyName("authType"u8); writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -70,10 +75,13 @@ internal static AuthBaseInfo DeserializeAuthBaseInfo(JsonElement element, ModelR { switch (discriminator.GetString()) { + case "accessKey": return AccessKeyInfoBase.DeserializeAccessKeyInfoBase(element, options); + case "easyAuthMicrosoftEntraID": return EasyAuthMicrosoftEntraIdAuthInfo.DeserializeEasyAuthMicrosoftEntraIdAuthInfo(element, options); case "secret": return SecretAuthInfo.DeserializeSecretAuthInfo(element, options); case "servicePrincipalCertificate": return ServicePrincipalCertificateAuthInfo.DeserializeServicePrincipalCertificateAuthInfo(element, options); case "servicePrincipalSecret": return ServicePrincipalSecretAuthInfo.DeserializeServicePrincipalSecretAuthInfo(element, options); case "systemAssignedIdentity": return SystemAssignedIdentityAuthInfo.DeserializeSystemAssignedIdentityAuthInfo(element, options); + case "userAccount": return UserAccountAuthInfo.DeserializeUserAccountAuthInfo(element, options); case "userAssignedIdentity": return UserAssignedIdentityAuthInfo.DeserializeUserAssignedIdentityAuthInfo(element, options); } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.cs index bae83d92b23a..2bd05f018ac9 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models /// /// The authentication info /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , , , , and . /// public abstract partial class AuthBaseInfo { @@ -56,14 +56,18 @@ protected AuthBaseInfo() /// Initializes a new instance of . /// The authentication type. + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. /// Keeps track of any properties unknown to the library. - internal AuthBaseInfo(LinkerAuthType authType, IDictionary serializedAdditionalRawData) + internal AuthBaseInfo(LinkerAuthType authType, AuthMode? authMode, IDictionary serializedAdditionalRawData) { AuthType = authType; + AuthMode = authMode; _serializedAdditionalRawData = serializedAdditionalRawData; } /// The authentication type. internal LinkerAuthType AuthType { get; set; } + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. + public AuthMode? AuthMode { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthMode.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthMode.cs new file mode 100644 index 000000000000..fc01cfeaa0dc --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthMode.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Indicates how to apply the authentication configuration operations. + public readonly partial struct AuthMode : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthMode(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OptInAllAuthValue = "optInAllAuth"; + private const string OptOutAllAuthValue = "optOutAllAuth"; + + /// Default authentication configuration according to the authentication type. + public static AuthMode OptInAllAuth { get; } = new AuthMode(OptInAllAuthValue); + /// Skip all authentication configuration such as enabling managed identity and granting RBAC roles. + public static AuthMode OptOutAllAuth { get; } = new AuthMode(OptOutAllAuthValue); + /// Determines if two values are the same. + public static bool operator ==(AuthMode left, AuthMode right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthMode left, AuthMode right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AuthMode(string value) => new AuthMode(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthMode other && Equals(other); + /// + public bool Equals(AuthMode 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.Serialization.cs new file mode 100644 index 000000000000..efecc37271b9 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class BasicErrorDryrunPrerequisiteResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BasicErrorDryrunPrerequisiteResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Code)) + { + writer.WritePropertyName("code"u8); + writer.WriteStringValue(Code); + } + if (Optional.IsDefined(Message)) + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResultType.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + BasicErrorDryrunPrerequisiteResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BasicErrorDryrunPrerequisiteResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBasicErrorDryrunPrerequisiteResult(document.RootElement, options); + } + + internal static BasicErrorDryrunPrerequisiteResult DeserializeBasicErrorDryrunPrerequisiteResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string code = default; + string message = default; + DryrunPrerequisiteResultType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new DryrunPrerequisiteResultType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BasicErrorDryrunPrerequisiteResult(type, serializedAdditionalRawData, code, message); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BasicErrorDryrunPrerequisiteResult)} does not support writing '{options.Format}' format."); + } + } + + BasicErrorDryrunPrerequisiteResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeBasicErrorDryrunPrerequisiteResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BasicErrorDryrunPrerequisiteResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.cs new file mode 100644 index 000000000000..db2d818c4be6 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The represent of basic error. + public partial class BasicErrorDryrunPrerequisiteResult : DryrunPrerequisiteResult + { + /// Initializes a new instance of . + internal BasicErrorDryrunPrerequisiteResult() + { + ResultType = DryrunPrerequisiteResultType.BasicError; + } + + /// Initializes a new instance of . + /// The type of dryrun result. + /// Keeps track of any properties unknown to the library. + /// The error code. + /// The error message. + internal BasicErrorDryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType, IDictionary serializedAdditionalRawData, string code, string message) : base(resultType, serializedAdditionalRawData) + { + Code = code; + Message = message; + ResultType = resultType; + } + + /// The error code. + public string Code { get; } + /// The error message. + public string Message { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.Serialization.cs new file mode 100644 index 000000000000..a24d3512a206 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.Serialization.cs @@ -0,0 +1,265 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class ConfigurationInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationInfo)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"u8); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action.Value.ToString()); + } + if (Optional.IsCollectionDefined(CustomizedKeys)) + { + writer.WritePropertyName("customizedKeys"u8); + writer.WriteStartObject(); + foreach (var item in CustomizedKeys) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(DaprProperties)) + { + writer.WritePropertyName("daprProperties"u8); + writer.WriteObjectValue(DaprProperties, options); + } + if (Optional.IsCollectionDefined(AdditionalConfigurations)) + { + writer.WritePropertyName("additionalConfigurations"u8); + writer.WriteStartObject(); + foreach (var item in AdditionalConfigurations) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(AdditionalConnectionStringProperties)) + { + writer.WritePropertyName("additionalConnectionStringProperties"u8); + writer.WriteStartObject(); + foreach (var item in AdditionalConnectionStringProperties) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(ConfigurationStore)) + { + if (ConfigurationStore != null) + { + writer.WritePropertyName("configurationStore"u8); + writer.WriteObjectValue(ConfigurationStore, options); + } + else + { + writer.WriteNull("configurationStore"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ConfigurationInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationInfo(document.RootElement, options); + } + + internal static ConfigurationInfo DeserializeConfigurationInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DeleteOrUpdateBehavior? deleteOrUpdateBehavior = default; + ActionType? action = default; + IDictionary customizedKeys = default; + DaprProperties daprProperties = default; + IDictionary additionalConfigurations = default; + IDictionary additionalConnectionStringProperties = default; + ConfigurationStore configurationStore = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deleteOrUpdateBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("action"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + action = new ActionType(property.Value.GetString()); + continue; + } + if (property.NameEquals("customizedKeys"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + customizedKeys = dictionary; + continue; + } + if (property.NameEquals("daprProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + daprProperties = DaprProperties.DeserializeDaprProperties(property.Value, options); + continue; + } + if (property.NameEquals("additionalConfigurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + additionalConfigurations = dictionary; + continue; + } + if (property.NameEquals("additionalConnectionStringProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + additionalConnectionStringProperties = dictionary; + continue; + } + if (property.NameEquals("configurationStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + configurationStore = null; + continue; + } + configurationStore = ConfigurationStore.DeserializeConfigurationStore(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConfigurationInfo( + deleteOrUpdateBehavior, + action, + customizedKeys ?? new ChangeTrackingDictionary(), + daprProperties, + additionalConfigurations ?? new ChangeTrackingDictionary(), + additionalConnectionStringProperties ?? new ChangeTrackingDictionary(), + configurationStore, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConfigurationInfo)} does not support writing '{options.Format}' format."); + } + } + + ConfigurationInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConfigurationInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConfigurationInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.cs new file mode 100644 index 000000000000..be74f3a477d0 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The configuration information, used to generate configurations or save to applications. + public partial class ConfigurationInfo + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ConfigurationInfo() + { + CustomizedKeys = new ChangeTrackingDictionary(); + AdditionalConfigurations = new ChangeTrackingDictionary(); + AdditionalConnectionStringProperties = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, indicate whether to apply configurations on source application. If enable, generate configurations and applied to the source application. Default is enable. If optOut, no configuration change will be made on source. + /// Optional. A dictionary of default key name and customized key name mapping. If not specified, default key name will be used for generate configurations. + /// Indicates some additional properties for dapr client type. + /// A dictionary of additional configurations to be added. Service will auto generate a set of basic configurations and this property is to full fill more customized configurations. + /// A dictionary of additional properties to be added in the end of connection string. + /// An option to store configuration into different place. + /// Keeps track of any properties unknown to the library. + internal ConfigurationInfo(DeleteOrUpdateBehavior? deleteOrUpdateBehavior, ActionType? action, IDictionary customizedKeys, DaprProperties daprProperties, IDictionary additionalConfigurations, IDictionary additionalConnectionStringProperties, ConfigurationStore configurationStore, IDictionary serializedAdditionalRawData) + { + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Action = action; + CustomizedKeys = customizedKeys; + DaprProperties = daprProperties; + AdditionalConfigurations = additionalConfigurations; + AdditionalConnectionStringProperties = additionalConnectionStringProperties; + ConfigurationStore = configurationStore; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, indicate whether to apply configurations on source application. If enable, generate configurations and applied to the source application. Default is enable. If optOut, no configuration change will be made on source. + public ActionType? Action { get; set; } + /// Optional. A dictionary of default key name and customized key name mapping. If not specified, default key name will be used for generate configurations. + public IDictionary CustomizedKeys { get; } + /// Indicates some additional properties for dapr client type. + public DaprProperties DaprProperties { get; set; } + /// A dictionary of additional configurations to be added. Service will auto generate a set of basic configurations and this property is to full fill more customized configurations. + public IDictionary AdditionalConfigurations { get; } + /// A dictionary of additional properties to be added in the end of connection string. + public IDictionary AdditionalConnectionStringProperties { get; } + /// An option to store configuration into different place. + internal ConfigurationStore ConfigurationStore { get; set; } + /// The app configuration id to store configuration. + public string AppConfigurationId + { + get => ConfigurationStore is null ? default : ConfigurationStore.AppConfigurationId; + set + { + if (ConfigurationStore is null) + ConfigurationStore = new ConfigurationStore(); + ConfigurationStore.AppConfigurationId = value; + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.Serialization.cs new file mode 100644 index 000000000000..dd75a7bf009b --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class ConfigurationName : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationName)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Required)) + { + writer.WritePropertyName("required"u8); + writer.WriteBooleanValue(Required.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ConfigurationName IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationName)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationName(document.RootElement, options); + } + + internal static ConfigurationName DeserializeConfigurationName(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + string description = default; + bool? required = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("required"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + required = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConfigurationName(value, description, required, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConfigurationName)} does not support writing '{options.Format}' format."); + } + } + + ConfigurationName IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConfigurationName(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConfigurationName)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.cs new file mode 100644 index 000000000000..1bed8b96162e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The configuration names. + public partial class ConfigurationName + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ConfigurationName() + { + } + + /// Initializes a new instance of . + /// + /// Description for the configuration name. + /// Represent the configuration is required or not. + /// Keeps track of any properties unknown to the library. + internal ConfigurationName(string value, string description, bool? required, IDictionary serializedAdditionalRawData) + { + Value = value; + Description = description; + Required = required; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Gets the value. + public string Value { get; } + /// Description for the configuration name. + public string Description { get; } + /// Represent the configuration is required or not. + public bool? Required { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.Serialization.cs new file mode 100644 index 000000000000..3322e94d3b0f --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.Serialization.cs @@ -0,0 +1,281 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class ConfigurationNameItem : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationNameItem)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(TargetService)) + { + if (TargetService != null) + { + writer.WritePropertyName("targetService"u8); + writer.WriteStringValue(TargetService); + } + else + { + writer.WriteNull("targetService"); + } + } + if (Optional.IsDefined(ClientType)) + { + if (ClientType != null) + { + writer.WritePropertyName("clientType"u8); + writer.WriteStringValue(ClientType.Value.ToString()); + } + else + { + writer.WriteNull("clientType"); + } + } + if (Optional.IsDefined(AuthType)) + { + if (AuthType != null) + { + writer.WritePropertyName("authType"u8); + writer.WriteStringValue(AuthType.Value.ToString()); + } + else + { + writer.WriteNull("authType"); + } + } + if (Optional.IsDefined(SecretType)) + { + if (SecretType != null) + { + writer.WritePropertyName("secretType"u8); + writer.WriteStringValue(SecretType.Value.ToString()); + } + else + { + writer.WriteNull("secretType"); + } + } + if (Optional.IsDefined(DaprProperties)) + { + if (DaprProperties != null) + { + writer.WritePropertyName("daprProperties"u8); + writer.WriteObjectValue(DaprProperties, options); + } + else + { + writer.WriteNull("daprProperties"); + } + } + if (Optional.IsCollectionDefined(Names)) + { + if (Names != null) + { + writer.WritePropertyName("names"u8); + writer.WriteStartArray(); + foreach (var item in Names) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + else + { + writer.WriteNull("names"); + } + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ConfigurationNameItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationNameItem)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationNameItem(document.RootElement, options); + } + + internal static ConfigurationNameItem DeserializeConfigurationNameItem(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string targetService = default; + LinkerClientType? clientType = default; + LinkerAuthType? authType = default; + SecretSourceType? secretType = default; + DaprProperties daprProperties = default; + IReadOnlyList names = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("targetService"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + targetService = null; + continue; + } + targetService = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("clientType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + clientType = null; + continue; + } + clientType = new LinkerClientType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("authType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + authType = null; + continue; + } + authType = new LinkerAuthType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("secretType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + secretType = null; + continue; + } + secretType = new SecretSourceType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("daprProperties"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + daprProperties = null; + continue; + } + daprProperties = DaprProperties.DeserializeDaprProperties(property0.Value, options); + continue; + } + if (property0.NameEquals("names"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + names = null; + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(ConfigurationName.DeserializeConfigurationName(item, options)); + } + names = array; + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConfigurationNameItem( + targetService, + clientType, + authType, + secretType, + daprProperties, + names ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConfigurationNameItem)} does not support writing '{options.Format}' format."); + } + } + + ConfigurationNameItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConfigurationNameItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConfigurationNameItem)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.cs new file mode 100644 index 000000000000..3d8eddeb128c --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The ConfigurationNameItem. + public partial class ConfigurationNameItem + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ConfigurationNameItem() + { + Names = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The target service provider name and resource name. + /// The client type for configuration names. + /// The auth type. + /// Indicates where the secrets in configuration from. Used when secrets are from Keyvault. + /// Deprecated, please use #/definitions/DaprConfigurationList instead. + /// The configuration names to be set in compute service environment. + /// Keeps track of any properties unknown to the library. + internal ConfigurationNameItem(string targetService, LinkerClientType? clientType, LinkerAuthType? authType, SecretSourceType? secretType, DaprProperties daprProperties, IReadOnlyList names, IDictionary serializedAdditionalRawData) + { + TargetService = targetService; + ClientType = clientType; + AuthType = authType; + SecretType = secretType; + DaprProperties = daprProperties; + Names = names; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The target service provider name and resource name. + public string TargetService { get; } + /// The client type for configuration names. + public LinkerClientType? ClientType { get; } + /// The auth type. + public LinkerAuthType? AuthType { get; } + /// Indicates where the secrets in configuration from. Used when secrets are from Keyvault. + public SecretSourceType? SecretType { get; } + /// Deprecated, please use #/definitions/DaprConfigurationList instead. + public DaprProperties DaprProperties { get; } + /// The configuration names to be set in compute service environment. + public IReadOnlyList Names { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.Serialization.cs new file mode 100644 index 000000000000..38ec6f86d423 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class ConfigurationNameResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationNameResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ConfigurationNameResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationNameResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationNameResult(document.RootElement, options); + } + + internal static ConfigurationNameResult DeserializeConfigurationNameResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConfigurationNameItem.DeserializeConfigurationNameItem(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConfigurationNameResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConfigurationNameResult)} does not support writing '{options.Format}' format."); + } + } + + ConfigurationNameResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConfigurationNameResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConfigurationNameResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.cs new file mode 100644 index 000000000000..e71a5187b425 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Configuration Name list which will be set based on different target resource, client type, auth type. + internal partial class ConfigurationNameResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ConfigurationNameResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Expected configuration names for each target service. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal ConfigurationNameResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Expected configuration names for each target service. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.Serialization.cs similarity index 64% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.Serialization.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.Serialization.cs index 8337b7b5bf74..f9db49a6103f 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.Serialization.cs @@ -13,16 +13,16 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - public partial class SourceConfigurationResult : IUtf8JsonSerializable, IJsonModel + public partial class ConfigurationResult : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(SourceConfigurationResult)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(ConfigurationResult)} does not support writing '{format}' format."); } writer.WriteStartObject(); @@ -54,19 +54,19 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRea writer.WriteEndObject(); } - SourceConfigurationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + ConfigurationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(SourceConfigurationResult)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(ConfigurationResult)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeSourceConfigurationResult(document.RootElement, options); + return DeserializeConfigurationResult(document.RootElement, options); } - internal static SourceConfigurationResult DeserializeSourceConfigurationResult(JsonElement element, ModelReaderWriterOptions options = null) + internal static ConfigurationResult DeserializeConfigurationResult(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -99,38 +99,38 @@ internal static SourceConfigurationResult DeserializeSourceConfigurationResult(J } } serializedAdditionalRawData = rawDataDictionary; - return new SourceConfigurationResult(configurations ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new ConfigurationResult(configurations ?? new ChangeTrackingList(), serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(SourceConfigurationResult)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConfigurationResult)} does not support writing '{options.Format}' format."); } } - SourceConfigurationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + ConfigurationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeSourceConfigurationResult(document.RootElement, options); + return DeserializeConfigurationResult(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(SourceConfigurationResult)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(ConfigurationResult)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.cs similarity index 83% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.cs index 3cdef0e525c2..24354857efd5 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// Configurations for source resource, include appSettings, connectionString and serviceBindings. - public partial class SourceConfigurationResult + public partial class ConfigurationResult { /// /// Keeps track of any properties unknown to the library. @@ -45,16 +45,16 @@ public partial class SourceConfigurationResult /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal SourceConfigurationResult() + /// Initializes a new instance of . + internal ConfigurationResult() { Configurations = new ChangeTrackingList(); } - /// Initializes a new instance of . + /// Initializes a new instance of . /// The configuration properties for source resource. /// Keeps track of any properties unknown to the library. - internal SourceConfigurationResult(IReadOnlyList configurations, IDictionary serializedAdditionalRawData) + internal ConfigurationResult(IReadOnlyList configurations, IDictionary serializedAdditionalRawData) { Configurations = configurations; _serializedAdditionalRawData = serializedAdditionalRawData; diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationStore.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationStore.Serialization.cs new file mode 100644 index 000000000000..4321e7424068 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationStore.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class ConfigurationStore : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationStore)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(AppConfigurationId)) + { + if (AppConfigurationId != null) + { + writer.WritePropertyName("appConfigurationId"u8); + writer.WriteStringValue(AppConfigurationId); + } + else + { + writer.WriteNull("appConfigurationId"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ConfigurationStore IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConfigurationStore)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConfigurationStore(document.RootElement, options); + } + + internal static ConfigurationStore DeserializeConfigurationStore(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string appConfigurationId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("appConfigurationId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + appConfigurationId = null; + continue; + } + appConfigurationId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConfigurationStore(appConfigurationId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConfigurationStore)} does not support writing '{options.Format}' format."); + } + } + + ConfigurationStore IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConfigurationStore(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConfigurationStore)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationStore.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationStore.cs new file mode 100644 index 000000000000..e56e0af8e890 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationStore.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// An option to store configuration into different place. + internal partial class ConfigurationStore + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ConfigurationStore() + { + } + + /// Initializes a new instance of . + /// The app configuration id to store configuration. + /// Keeps track of any properties unknown to the library. + internal ConfigurationStore(string appConfigurationId, IDictionary serializedAdditionalRawData) + { + AppConfigurationId = appConfigurationId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The app configuration id to store configuration. + public string AppConfigurationId { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.Serialization.cs new file mode 100644 index 000000000000..7d1964121d3c --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.Serialization.cs @@ -0,0 +1,301 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class CreateOrUpdateDryrunParameters : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateOrUpdateDryrunParameters)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(TargetService)) + { + writer.WritePropertyName("targetService"u8); + writer.WriteObjectValue(TargetService, options); + } + if (Optional.IsDefined(AuthInfo)) + { + writer.WritePropertyName("authInfo"u8); + writer.WriteObjectValue(AuthInfo, options); + } + if (Optional.IsDefined(ClientType)) + { + writer.WritePropertyName("clientType"u8); + writer.WriteStringValue(ClientType.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + if (Optional.IsDefined(VnetSolution)) + { + if (VnetSolution != null) + { + writer.WritePropertyName("vNetSolution"u8); + writer.WriteObjectValue(VnetSolution, options); + } + else + { + writer.WriteNull("vNetSolution"); + } + } + if (Optional.IsDefined(SecretStore)) + { + if (SecretStore != null) + { + writer.WritePropertyName("secretStore"u8); + writer.WriteObjectValue(SecretStore, options); + } + else + { + writer.WriteNull("secretStore"); + } + } + if (Optional.IsDefined(Scope)) + { + if (Scope != null) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + else + { + writer.WriteNull("scope"); + } + } + if (Optional.IsDefined(PublicNetworkSolution)) + { + if (PublicNetworkSolution != null) + { + writer.WritePropertyName("publicNetworkSolution"u8); + writer.WriteObjectValue(PublicNetworkSolution, options); + } + else + { + writer.WriteNull("publicNetworkSolution"); + } + } + if (Optional.IsDefined(ConfigurationInfo)) + { + if (ConfigurationInfo != null) + { + writer.WritePropertyName("configurationInfo"u8); + writer.WriteObjectValue(ConfigurationInfo, options); + } + else + { + writer.WriteNull("configurationInfo"); + } + } + writer.WritePropertyName("actionName"u8); + writer.WriteStringValue(ActionName.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CreateOrUpdateDryrunParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateOrUpdateDryrunParameters)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateOrUpdateDryrunParameters(document.RootElement, options); + } + + internal static CreateOrUpdateDryrunParameters DeserializeCreateOrUpdateDryrunParameters(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + TargetServiceBaseInfo targetService = default; + AuthBaseInfo authInfo = default; + LinkerClientType? clientType = default; + string provisioningState = default; + VnetSolution vnetSolution = default; + LinkerSecretStore secretStore = default; + string scope = default; + PublicNetworkSolution publicNetworkSolution = default; + ConfigurationInfo configurationInfo = default; + DryrunActionName actionName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetService"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetService = TargetServiceBaseInfo.DeserializeTargetServiceBaseInfo(property.Value, options); + continue; + } + if (property.NameEquals("authInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authInfo = AuthBaseInfo.DeserializeAuthBaseInfo(property.Value, options); + continue; + } + if (property.NameEquals("clientType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientType = new LinkerClientType(property.Value.GetString()); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + provisioningState = property.Value.GetString(); + continue; + } + if (property.NameEquals("vNetSolution"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + vnetSolution = null; + continue; + } + vnetSolution = VnetSolution.DeserializeVnetSolution(property.Value, options); + continue; + } + if (property.NameEquals("secretStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + secretStore = null; + continue; + } + secretStore = LinkerSecretStore.DeserializeLinkerSecretStore(property.Value, options); + continue; + } + if (property.NameEquals("scope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + scope = null; + continue; + } + scope = property.Value.GetString(); + continue; + } + if (property.NameEquals("publicNetworkSolution"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + publicNetworkSolution = null; + continue; + } + publicNetworkSolution = PublicNetworkSolution.DeserializePublicNetworkSolution(property.Value, options); + continue; + } + if (property.NameEquals("configurationInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + configurationInfo = null; + continue; + } + configurationInfo = ConfigurationInfo.DeserializeConfigurationInfo(property.Value, options); + continue; + } + if (property.NameEquals("actionName"u8)) + { + actionName = new DryrunActionName(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateOrUpdateDryrunParameters( + actionName, + serializedAdditionalRawData, + targetService, + authInfo, + clientType, + provisioningState, + vnetSolution, + secretStore, + scope, + publicNetworkSolution, + configurationInfo); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CreateOrUpdateDryrunParameters)} does not support writing '{options.Format}' format."); + } + } + + CreateOrUpdateDryrunParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCreateOrUpdateDryrunParameters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateOrUpdateDryrunParameters)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.cs new file mode 100644 index 000000000000..fb98d5c41cba --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The dryrun parameters for creation or update a linker. + public partial class CreateOrUpdateDryrunParameters : DryrunParameters + { + /// Initializes a new instance of . + public CreateOrUpdateDryrunParameters() + { + ActionName = DryrunActionName.CreateOrUpdate; + } + + /// Initializes a new instance of . + /// The name of action for you dryrun job. + /// Keeps track of any properties unknown to the library. + /// + /// The target service properties + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + /// + /// The authentication type. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , and . + /// + /// The application client type. + /// The provisioning state. + /// The VNet solution. + /// An option to store secret value in secure place. + /// connection scope in source service. + /// The network solution. + /// The connection information consumed by applications, including secrets, connection strings. + internal CreateOrUpdateDryrunParameters(DryrunActionName actionName, IDictionary serializedAdditionalRawData, TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope, PublicNetworkSolution publicNetworkSolution, ConfigurationInfo configurationInfo) : base(actionName, serializedAdditionalRawData) + { + TargetService = targetService; + AuthInfo = authInfo; + ClientType = clientType; + ProvisioningState = provisioningState; + VnetSolution = vnetSolution; + SecretStore = secretStore; + Scope = scope; + PublicNetworkSolution = publicNetworkSolution; + ConfigurationInfo = configurationInfo; + ActionName = actionName; + } + + /// + /// The target service properties + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , and . + /// + public TargetServiceBaseInfo TargetService { get; set; } + /// + /// The authentication type. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , and . + /// + public AuthBaseInfo AuthInfo { get; set; } + /// The application client type. + public LinkerClientType? ClientType { get; set; } + /// The provisioning state. + public string ProvisioningState { get; } + /// The VNet solution. + public VnetSolution VnetSolution { get; set; } + /// An option to store secret value in secure place. + public LinkerSecretStore SecretStore { get; set; } + /// connection scope in source service. + public string Scope { get; set; } + /// The network solution. + public PublicNetworkSolution PublicNetworkSolution { get; set; } + /// The connection information consumed by applications, including secrets, connection strings. + public ConfigurationInfo ConfigurationInfo { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprBindingComponentDirection.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprBindingComponentDirection.cs new file mode 100644 index 000000000000..6ae2d0f428db --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprBindingComponentDirection.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The direction supported by the dapr binding component. + public readonly partial struct DaprBindingComponentDirection : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DaprBindingComponentDirection(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InputValue = "input"; + private const string OutputValue = "output"; + + /// input. + public static DaprBindingComponentDirection Input { get; } = new DaprBindingComponentDirection(InputValue); + /// output. + public static DaprBindingComponentDirection Output { get; } = new DaprBindingComponentDirection(OutputValue); + /// Determines if two values are the same. + public static bool operator ==(DaprBindingComponentDirection left, DaprBindingComponentDirection right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DaprBindingComponentDirection left, DaprBindingComponentDirection right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DaprBindingComponentDirection(string value) => new DaprBindingComponentDirection(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DaprBindingComponentDirection other && Equals(other); + /// + public bool Equals(DaprBindingComponentDirection 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationList.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationList.Serialization.cs new file mode 100644 index 000000000000..a916983b169f --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationList.Serialization.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class DaprConfigurationList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprConfigurationList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DaprConfigurationList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprConfigurationList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDaprConfigurationList(document.RootElement, options); + } + + internal static DaprConfigurationList DeserializeDaprConfigurationList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + string nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DaprConfigurationResource.DeserializeDaprConfigurationResource(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DaprConfigurationList(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DaprConfigurationList)} does not support writing '{options.Format}' format."); + } + } + + DaprConfigurationList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDaprConfigurationList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DaprConfigurationList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationList.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationList.cs new file mode 100644 index 000000000000..a4af65df920d --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Dapr configuration list supported by Service Connector. + internal partial class DaprConfigurationList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DaprConfigurationList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The list of dapr configurations. + /// Link to next page of resources. + /// Keeps track of any properties unknown to the library. + internal DaprConfigurationList(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The list of dapr configurations. + public IReadOnlyList Value { get; } + /// Link to next page of resources. + public string NextLink { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationResource.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationResource.Serialization.cs new file mode 100644 index 000000000000..0bec58f56ec7 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationResource.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DaprConfigurationResource : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprConfigurationResource)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(TargetType)) + { + writer.WritePropertyName("targetType"u8); + writer.WriteStringValue(TargetType); + } + if (Optional.IsDefined(AuthType)) + { + writer.WritePropertyName("authType"u8); + writer.WriteStringValue(AuthType.Value.ToString()); + } + if (Optional.IsDefined(DaprProperties)) + { + writer.WritePropertyName("daprProperties"u8); + writer.WriteObjectValue(DaprProperties, options); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DaprConfigurationResource IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprConfigurationResource)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDaprConfigurationResource(document.RootElement, options); + } + + internal static DaprConfigurationResource DeserializeDaprConfigurationResource(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string targetType = default; + LinkerAuthType? authType = default; + DaprProperties daprProperties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("targetType"u8)) + { + targetType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("authType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authType = new LinkerAuthType(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("daprProperties"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + daprProperties = DaprProperties.DeserializeDaprProperties(property0.Value, options); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DaprConfigurationResource(targetType, authType, daprProperties, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DaprConfigurationResource)} does not support writing '{options.Format}' format."); + } + } + + DaprConfigurationResource IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDaprConfigurationResource(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DaprConfigurationResource)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationResource.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationResource.cs new file mode 100644 index 000000000000..a83fb0371e7d --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationResource.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Represent one resource of the dapr configuration list. + public partial class DaprConfigurationResource + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DaprConfigurationResource() + { + } + + /// Initializes a new instance of . + /// Supported target resource type, extract from resource id, uppercase. + /// The authentication type. + /// Indicates some additional properties for dapr client type. + /// Keeps track of any properties unknown to the library. + internal DaprConfigurationResource(string targetType, LinkerAuthType? authType, DaprProperties daprProperties, IDictionary serializedAdditionalRawData) + { + TargetType = targetType; + AuthType = authType; + DaprProperties = daprProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Supported target resource type, extract from resource id, uppercase. + public string TargetType { get; } + /// The authentication type. + public LinkerAuthType? AuthType { get; } + /// Indicates some additional properties for dapr client type. + public DaprProperties DaprProperties { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadata.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadata.Serialization.cs new file mode 100644 index 000000000000..6426a380fb83 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadata.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DaprMetadata : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprMetadata)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsDefined(SecretRef)) + { + writer.WritePropertyName("secretRef"u8); + writer.WriteStringValue(SecretRef); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Required)) + { + writer.WritePropertyName("required"u8); + writer.WriteStringValue(Required.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DaprMetadata IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprMetadata)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDaprMetadata(document.RootElement, options); + } + + internal static DaprMetadata DeserializeDaprMetadata(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + string value = default; + string secretRef = default; + string description = default; + DaprMetadataRequired? required = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("secretRef"u8)) + { + secretRef = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("required"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + required = new DaprMetadataRequired(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DaprMetadata( + name, + value, + secretRef, + description, + required, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DaprMetadata)} does not support writing '{options.Format}' format."); + } + } + + DaprMetadata IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDaprMetadata(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DaprMetadata)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadata.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadata.cs new file mode 100644 index 000000000000..03a8a299b65a --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadata.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The dapr component metadata. + public partial class DaprMetadata + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DaprMetadata() + { + } + + /// Initializes a new instance of . + /// Metadata property name. + /// Metadata property value. + /// The secret name where dapr could get value. + /// The description of the metadata, returned from configuration api. + /// The value indicating whether the metadata is required or not. + /// Keeps track of any properties unknown to the library. + internal DaprMetadata(string name, string value, string secretRef, string description, DaprMetadataRequired? required, IDictionary serializedAdditionalRawData) + { + Name = name; + Value = value; + SecretRef = secretRef; + Description = description; + Required = required; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Metadata property name. + public string Name { get; set; } + /// Metadata property value. + public string Value { get; set; } + /// The secret name where dapr could get value. + public string SecretRef { get; set; } + /// The description of the metadata, returned from configuration api. + public string Description { get; set; } + /// The value indicating whether the metadata is required or not. + public DaprMetadataRequired? Required { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadataRequired.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadataRequired.cs new file mode 100644 index 000000000000..134942263a7c --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadataRequired.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The value indicating whether the metadata is required or not. + public readonly partial struct DaprMetadataRequired : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DaprMetadataRequired(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "true"; + private const string FalseValue = "false"; + + /// true. + public static DaprMetadataRequired True { get; } = new DaprMetadataRequired(TrueValue); + /// false. + public static DaprMetadataRequired False { get; } = new DaprMetadataRequired(FalseValue); + /// Determines if two values are the same. + public static bool operator ==(DaprMetadataRequired left, DaprMetadataRequired right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DaprMetadataRequired left, DaprMetadataRequired right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DaprMetadataRequired(string value) => new DaprMetadataRequired(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DaprMetadataRequired other && Equals(other); + /// + public bool Equals(DaprMetadataRequired 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprProperties.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprProperties.Serialization.cs new file mode 100644 index 000000000000..c853a82be9a1 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprProperties.Serialization.cs @@ -0,0 +1,284 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DaprProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprProperties)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Version)) + { + if (Version != null) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + else + { + writer.WriteNull("version"); + } + } + if (Optional.IsDefined(ComponentType)) + { + if (ComponentType != null) + { + writer.WritePropertyName("componentType"u8); + writer.WriteStringValue(ComponentType); + } + else + { + writer.WriteNull("componentType"); + } + } + if (Optional.IsDefined(SecretStoreComponent)) + { + if (SecretStoreComponent != null) + { + writer.WritePropertyName("secretStoreComponent"u8); + writer.WriteStringValue(SecretStoreComponent); + } + else + { + writer.WriteNull("secretStoreComponent"); + } + } + if (Optional.IsCollectionDefined(Metadata)) + { + writer.WritePropertyName("metadata"u8); + writer.WriteStartArray(); + foreach (var item in Metadata) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Scopes)) + { + writer.WritePropertyName("scopes"u8); + writer.WriteStartArray(); + foreach (var item in Scopes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(RuntimeVersion)) + { + if (RuntimeVersion != null) + { + writer.WritePropertyName("runtimeVersion"u8); + writer.WriteStringValue(RuntimeVersion); + } + else + { + writer.WriteNull("runtimeVersion"); + } + } + if (options.Format != "W" && Optional.IsDefined(BindingComponentDirection)) + { + if (BindingComponentDirection != null) + { + writer.WritePropertyName("bindingComponentDirection"u8); + writer.WriteStringValue(BindingComponentDirection.Value.ToString()); + } + else + { + writer.WriteNull("bindingComponentDirection"); + } + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DaprProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DaprProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDaprProperties(document.RootElement, options); + } + + internal static DaprProperties DeserializeDaprProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string version = default; + string componentType = default; + string secretStoreComponent = default; + IList metadata = default; + IList scopes = default; + string runtimeVersion = default; + DaprBindingComponentDirection? bindingComponentDirection = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("version"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + version = null; + continue; + } + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("componentType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + componentType = null; + continue; + } + componentType = property.Value.GetString(); + continue; + } + if (property.NameEquals("secretStoreComponent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + secretStoreComponent = null; + continue; + } + secretStoreComponent = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DaprMetadata.DeserializeDaprMetadata(item, options)); + } + metadata = array; + continue; + } + if (property.NameEquals("scopes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + scopes = array; + continue; + } + if (property.NameEquals("runtimeVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + runtimeVersion = null; + continue; + } + runtimeVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("bindingComponentDirection"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + bindingComponentDirection = null; + continue; + } + bindingComponentDirection = new DaprBindingComponentDirection(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DaprProperties( + version, + componentType, + secretStoreComponent, + metadata ?? new ChangeTrackingList(), + scopes ?? new ChangeTrackingList(), + runtimeVersion, + bindingComponentDirection, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DaprProperties)} does not support writing '{options.Format}' format."); + } + } + + DaprProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDaprProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DaprProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprProperties.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprProperties.cs new file mode 100644 index 000000000000..8106dd09f895 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprProperties.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Indicates some additional properties for dapr client type. + public partial class DaprProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DaprProperties() + { + Metadata = new ChangeTrackingList(); + Scopes = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The dapr component version. + /// The dapr component type. + /// The name of a secret store dapr to retrieve secret. + /// Additional dapr metadata. + /// The dapr component scopes. + /// The runtime version supported by the properties. + /// The direction supported by the dapr binding component. + /// Keeps track of any properties unknown to the library. + internal DaprProperties(string version, string componentType, string secretStoreComponent, IList metadata, IList scopes, string runtimeVersion, DaprBindingComponentDirection? bindingComponentDirection, IDictionary serializedAdditionalRawData) + { + Version = version; + ComponentType = componentType; + SecretStoreComponent = secretStoreComponent; + Metadata = metadata; + Scopes = scopes; + RuntimeVersion = runtimeVersion; + BindingComponentDirection = bindingComponentDirection; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The dapr component version. + public string Version { get; set; } + /// The dapr component type. + public string ComponentType { get; set; } + /// The name of a secret store dapr to retrieve secret. + public string SecretStoreComponent { get; set; } + /// Additional dapr metadata. + public IList Metadata { get; } + /// The dapr component scopes. + public IList Scopes { get; } + /// The runtime version supported by the properties. + public string RuntimeVersion { get; } + /// The direction supported by the dapr binding component. + public DaprBindingComponentDirection? BindingComponentDirection { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DeleteOrUpdateBehavior.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DeleteOrUpdateBehavior.cs new file mode 100644 index 000000000000..f7f867c67393 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DeleteOrUpdateBehavior.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The cleanup behavior to indicate whether clean up operation when resource is deleted or updated. + public readonly partial struct DeleteOrUpdateBehavior : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeleteOrUpdateBehavior(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string ForcedCleanupValue = "ForcedCleanup"; + + /// Default. + public static DeleteOrUpdateBehavior Default { get; } = new DeleteOrUpdateBehavior(DefaultValue); + /// ForcedCleanup. + public static DeleteOrUpdateBehavior ForcedCleanup { get; } = new DeleteOrUpdateBehavior(ForcedCleanupValue); + /// Determines if two values are the same. + public static bool operator ==(DeleteOrUpdateBehavior left, DeleteOrUpdateBehavior right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeleteOrUpdateBehavior left, DeleteOrUpdateBehavior right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DeleteOrUpdateBehavior(string value) => new DeleteOrUpdateBehavior(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeleteOrUpdateBehavior other && Equals(other); + /// + public bool Equals(DeleteOrUpdateBehavior 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunActionName.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunActionName.cs new file mode 100644 index 000000000000..a3f40125d6a1 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunActionName.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The name of action for you dryrun job. + internal readonly partial struct DryrunActionName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DryrunActionName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CreateOrUpdateValue = "createOrUpdate"; + + /// createOrUpdate. + public static DryrunActionName CreateOrUpdate { get; } = new DryrunActionName(CreateOrUpdateValue); + /// Determines if two values are the same. + public static bool operator ==(DryrunActionName left, DryrunActionName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DryrunActionName left, DryrunActionName right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DryrunActionName(string value) => new DryrunActionName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DryrunActionName other && Equals(other); + /// + public bool Equals(DryrunActionName 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.Serialization.cs similarity index 73% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.Serialization.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.Serialization.cs index 0f26ccc71a04..c7cdc08507c7 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.Serialization.cs @@ -13,16 +13,16 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - internal partial class LinkerList : IUtf8JsonSerializable, IJsonModel + internal partial class DryrunList : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LinkerList)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(DryrunList)} does not support writing '{format}' format."); } writer.WriteStartObject(); @@ -66,19 +66,19 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOption writer.WriteEndObject(); } - LinkerList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + DryrunList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LinkerList)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(DryrunList)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLinkerList(document.RootElement, options); + return DeserializeDryrunList(document.RootElement, options); } - internal static LinkerList DeserializeLinkerList(JsonElement element, ModelReaderWriterOptions options = null) + internal static DryrunList DeserializeDryrunList(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -87,7 +87,7 @@ internal static LinkerList DeserializeLinkerList(JsonElement element, ModelReade return null; } string nextLink = default; - IReadOnlyList value = default; + IReadOnlyList value = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -108,10 +108,10 @@ internal static LinkerList DeserializeLinkerList(JsonElement element, ModelReade { continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(LinkerResourceData.DeserializeLinkerResourceData(item, options)); + array.Add(DryrunResourceData.DeserializeDryrunResourceData(item, options)); } value = array; continue; @@ -122,38 +122,38 @@ internal static LinkerList DeserializeLinkerList(JsonElement element, ModelReade } } serializedAdditionalRawData = rawDataDictionary; - return new LinkerList(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + return new DryrunList(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(LinkerList)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(DryrunList)} does not support writing '{options.Format}' format."); } } - LinkerList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + DryrunList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeLinkerList(document.RootElement, options); + return DeserializeDryrunList(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LinkerList)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(DryrunList)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.cs new file mode 100644 index 000000000000..35d998f76a37 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The list of dryrun. + internal partial class DryrunList + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DryrunList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The link used to get the next page of dryrun list. + /// The list of dryrun. + /// Keeps track of any properties unknown to the library. + internal DryrunList(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + NextLink = nextLink; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The link used to get the next page of dryrun list. + public string NextLink { get; } + /// The list of dryrun. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.Serialization.cs new file mode 100644 index 000000000000..a93242bbc9b8 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.Serialization.cs @@ -0,0 +1,176 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DryrunOperationPreview : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunOperationPreview)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(OperationType)) + { + writer.WritePropertyName("operationType"u8); + writer.WriteStringValue(OperationType.Value.ToString()); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action); + } + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DryrunOperationPreview IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunOperationPreview)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDryrunOperationPreview(document.RootElement, options); + } + + internal static DryrunOperationPreview DeserializeDryrunOperationPreview(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + DryrunPreviewOperationType? operationType = default; + string description = default; + string action = default; + string scope = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("operationType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + operationType = new DryrunPreviewOperationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("action"u8)) + { + action = property.Value.GetString(); + continue; + } + if (property.NameEquals("scope"u8)) + { + scope = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DryrunOperationPreview( + name, + operationType, + description, + action, + scope, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DryrunOperationPreview)} does not support writing '{options.Format}' format."); + } + } + + DryrunOperationPreview IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDryrunOperationPreview(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DryrunOperationPreview)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.cs new file mode 100644 index 000000000000..a696fed12951 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The preview of the operations for creation. + public partial class DryrunOperationPreview + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal DryrunOperationPreview() + { + } + + /// Initializes a new instance of . + /// The operation name. + /// The operation type. + /// The description of the operation. + /// The action defined by RBAC, refer https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format. + /// The scope of the operation, refer https://docs.microsoft.com/azure/role-based-access-control/scope-overview. + /// Keeps track of any properties unknown to the library. + internal DryrunOperationPreview(string name, DryrunPreviewOperationType? operationType, string description, string action, string scope, IDictionary serializedAdditionalRawData) + { + Name = name; + OperationType = operationType; + Description = description; + Action = action; + Scope = scope; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The operation name. + public string Name { get; } + /// The operation type. + public DryrunPreviewOperationType? OperationType { get; } + /// The description of the operation. + public string Description { get; } + /// The action defined by RBAC, refer https://docs.microsoft.com/azure/role-based-access-control/role-definitions#actions-format. + public string Action { get; } + /// The scope of the operation, refer https://docs.microsoft.com/azure/role-based-access-control/scope-overview. + public string Scope { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.Serialization.cs new file mode 100644 index 000000000000..a04a515303a0 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.Serialization.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + [PersistableModelProxy(typeof(UnknownDryrunParameters))] + public partial class DryrunParameters : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunParameters)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("actionName"u8); + writer.WriteStringValue(ActionName.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DryrunParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunParameters)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDryrunParameters(document.RootElement, options); + } + + internal static DryrunParameters DeserializeDryrunParameters(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("actionName", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "createOrUpdate": return CreateOrUpdateDryrunParameters.DeserializeCreateOrUpdateDryrunParameters(element, options); + } + } + return UnknownDryrunParameters.DeserializeUnknownDryrunParameters(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DryrunParameters)} does not support writing '{options.Format}' format."); + } + } + + DryrunParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDryrunParameters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DryrunParameters)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.cs new file mode 100644 index 000000000000..750e51d3b384 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public abstract partial class DryrunParameters + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected DryrunParameters() + { + } + + /// Initializes a new instance of . + /// The name of action for you dryrun job. + /// Keeps track of any properties unknown to the library. + internal DryrunParameters(DryrunActionName actionName, IDictionary serializedAdditionalRawData) + { + ActionName = actionName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of action for you dryrun job. + internal DryrunActionName ActionName { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.Serialization.cs new file mode 100644 index 000000000000..812c495dea14 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.Serialization.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DryrunPatch : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunPatch)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(Parameters, options); + } + if (options.Format != "W" && Optional.IsCollectionDefined(PrerequisiteResults)) + { + writer.WritePropertyName("prerequisiteResults"u8); + writer.WriteStartArray(); + foreach (var item in PrerequisiteResults) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsCollectionDefined(OperationPreviews)) + { + writer.WritePropertyName("operationPreviews"u8); + writer.WriteStartArray(); + foreach (var item in OperationPreviews) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState); + } + writer.WriteEndObject(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DryrunPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDryrunPatch(document.RootElement, options); + } + + internal static DryrunPatch DeserializeDryrunPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DryrunParameters parameters = default; + IReadOnlyList prerequisiteResults = default; + IReadOnlyList operationPreviews = default; + string provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("parameters"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + parameters = DryrunParameters.DeserializeDryrunParameters(property0.Value, options); + continue; + } + if (property0.NameEquals("prerequisiteResults"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DryrunPrerequisiteResult.DeserializeDryrunPrerequisiteResult(item, options)); + } + prerequisiteResults = array; + continue; + } + if (property0.NameEquals("operationPreviews"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(DryrunOperationPreview.DeserializeDryrunOperationPreview(item, options)); + } + operationPreviews = array; + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + } + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DryrunPatch(parameters, prerequisiteResults ?? new ChangeTrackingList(), operationPreviews ?? new ChangeTrackingList(), provisioningState, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DryrunPatch)} does not support writing '{options.Format}' format."); + } + } + + DryrunPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDryrunPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DryrunPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.cs new file mode 100644 index 000000000000..677c8990ea18 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.cs @@ -0,0 +1,95 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// a dryrun job to be updated. + public partial class DryrunPatch + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DryrunPatch() + { + PrerequisiteResults = new ChangeTrackingList(); + OperationPreviews = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + /// + /// the result of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// the preview of the operations for creation. + /// The provisioning state. + /// Keeps track of any properties unknown to the library. + internal DryrunPatch(DryrunParameters parameters, IReadOnlyList prerequisiteResults, IReadOnlyList operationPreviews, string provisioningState, IDictionary serializedAdditionalRawData) + { + Parameters = parameters; + PrerequisiteResults = prerequisiteResults; + OperationPreviews = operationPreviews; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The parameters of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include . + /// + public DryrunParameters Parameters { get; set; } + /// + /// the result of the dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IReadOnlyList PrerequisiteResults { get; } + /// the preview of the operations for creation. + public IReadOnlyList OperationPreviews { get; } + /// The provisioning state. + public string ProvisioningState { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.Serialization.cs new file mode 100644 index 000000000000..b467478e2370 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + [PersistableModelProxy(typeof(UnknownDryrunPrerequisiteResult))] + public partial class DryrunPrerequisiteResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunPrerequisiteResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResultType.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DryrunPrerequisiteResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunPrerequisiteResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDryrunPrerequisiteResult(document.RootElement, options); + } + + internal static DryrunPrerequisiteResult DeserializeDryrunPrerequisiteResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "basicError": return BasicErrorDryrunPrerequisiteResult.DeserializeBasicErrorDryrunPrerequisiteResult(element, options); + case "permissionsMissing": return PermissionsMissingDryrunPrerequisiteResult.DeserializePermissionsMissingDryrunPrerequisiteResult(element, options); + } + } + return UnknownDryrunPrerequisiteResult.DeserializeUnknownDryrunPrerequisiteResult(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DryrunPrerequisiteResult)} does not support writing '{options.Format}' format."); + } + } + + DryrunPrerequisiteResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDryrunPrerequisiteResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DryrunPrerequisiteResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.cs new file mode 100644 index 000000000000..737206611b2e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// + /// A result of dryrun + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class DryrunPrerequisiteResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected DryrunPrerequisiteResult() + { + } + + /// Initializes a new instance of . + /// The type of dryrun result. + /// Keeps track of any properties unknown to the library. + internal DryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType, IDictionary serializedAdditionalRawData) + { + ResultType = resultType; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of dryrun result. + internal DryrunPrerequisiteResultType ResultType { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResultType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResultType.cs new file mode 100644 index 000000000000..f4e086707e78 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResultType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The type of dryrun result. + internal readonly partial struct DryrunPrerequisiteResultType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DryrunPrerequisiteResultType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string BasicErrorValue = "basicError"; + private const string PermissionsMissingValue = "permissionsMissing"; + + /// basicError. + public static DryrunPrerequisiteResultType BasicError { get; } = new DryrunPrerequisiteResultType(BasicErrorValue); + /// permissionsMissing. + public static DryrunPrerequisiteResultType PermissionsMissing { get; } = new DryrunPrerequisiteResultType(PermissionsMissingValue); + /// Determines if two values are the same. + public static bool operator ==(DryrunPrerequisiteResultType left, DryrunPrerequisiteResultType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DryrunPrerequisiteResultType left, DryrunPrerequisiteResultType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DryrunPrerequisiteResultType(string value) => new DryrunPrerequisiteResultType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DryrunPrerequisiteResultType other && Equals(other); + /// + public bool Equals(DryrunPrerequisiteResultType 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPreviewOperationType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPreviewOperationType.cs new file mode 100644 index 000000000000..f0cd3d5e88d6 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPreviewOperationType.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The operation type. + public readonly partial struct DryrunPreviewOperationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DryrunPreviewOperationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ConfigConnectionValue = "configConnection"; + private const string ConfigNetworkValue = "configNetwork"; + private const string ConfigAuthValue = "configAuth"; + + /// configConnection. + public static DryrunPreviewOperationType ConfigConnection { get; } = new DryrunPreviewOperationType(ConfigConnectionValue); + /// configNetwork. + public static DryrunPreviewOperationType ConfigNetwork { get; } = new DryrunPreviewOperationType(ConfigNetworkValue); + /// configAuth. + public static DryrunPreviewOperationType ConfigAuth { get; } = new DryrunPreviewOperationType(ConfigAuthValue); + /// Determines if two values are the same. + public static bool operator ==(DryrunPreviewOperationType left, DryrunPreviewOperationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DryrunPreviewOperationType left, DryrunPreviewOperationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DryrunPreviewOperationType(string value) => new DryrunPreviewOperationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DryrunPreviewOperationType other && Equals(other); + /// + public bool Equals(DryrunPreviewOperationType 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/EasyAuthMicrosoftEntraIdAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/EasyAuthMicrosoftEntraIdAuthInfo.Serialization.cs new file mode 100644 index 000000000000..c7e22361c4a4 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/EasyAuthMicrosoftEntraIdAuthInfo.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class EasyAuthMicrosoftEntraIdAuthInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EasyAuthMicrosoftEntraIdAuthInfo)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(ClientId)) + { + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + } + if (Optional.IsDefined(Secret)) + { + writer.WritePropertyName("secret"u8); + writer.WriteStringValue(Secret); + } + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"u8); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + writer.WritePropertyName("authType"u8); + writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + EasyAuthMicrosoftEntraIdAuthInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(EasyAuthMicrosoftEntraIdAuthInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeEasyAuthMicrosoftEntraIdAuthInfo(document.RootElement, options); + } + + internal static EasyAuthMicrosoftEntraIdAuthInfo DeserializeEasyAuthMicrosoftEntraIdAuthInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientId = default; + string secret = default; + DeleteOrUpdateBehavior? deleteOrUpdateBehavior = default; + LinkerAuthType authType = default; + AuthMode? authMode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("secret"u8)) + { + secret = property.Value.GetString(); + continue; + } + if (property.NameEquals("deleteOrUpdateBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("authType"u8)) + { + authType = new LinkerAuthType(property.Value.GetString()); + continue; + } + if (property.NameEquals("authMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authMode = new AuthMode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new EasyAuthMicrosoftEntraIdAuthInfo( + authType, + authMode, + serializedAdditionalRawData, + clientId, + secret, + deleteOrUpdateBehavior); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(EasyAuthMicrosoftEntraIdAuthInfo)} does not support writing '{options.Format}' format."); + } + } + + EasyAuthMicrosoftEntraIdAuthInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeEasyAuthMicrosoftEntraIdAuthInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(EasyAuthMicrosoftEntraIdAuthInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/EasyAuthMicrosoftEntraIdAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/EasyAuthMicrosoftEntraIdAuthInfo.cs new file mode 100644 index 000000000000..fee0f4dad6c8 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/EasyAuthMicrosoftEntraIdAuthInfo.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The authentication info when authType is EasyAuth Microsoft Entra ID. + public partial class EasyAuthMicrosoftEntraIdAuthInfo : AuthBaseInfo + { + /// Initializes a new instance of . + public EasyAuthMicrosoftEntraIdAuthInfo() + { + AuthType = LinkerAuthType.EasyAuthMicrosoftEntraId; + } + + /// Initializes a new instance of . + /// The authentication type. + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. + /// Keeps track of any properties unknown to the library. + /// Application clientId for EasyAuth Microsoft Entra ID. + /// Application Secret for EasyAuth Microsoft Entra ID. + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + internal EasyAuthMicrosoftEntraIdAuthInfo(LinkerAuthType authType, AuthMode? authMode, IDictionary serializedAdditionalRawData, string clientId, string secret, DeleteOrUpdateBehavior? deleteOrUpdateBehavior) : base(authType, authMode, serializedAdditionalRawData) + { + ClientId = clientId; + Secret = secret; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + AuthType = authType; + } + + /// Application clientId for EasyAuth Microsoft Entra ID. + public string ClientId { get; set; } + /// Application Secret for EasyAuth Microsoft Entra ID. + public string Secret { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.Serialization.cs new file mode 100644 index 000000000000..6704f6027925 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class FirewallRules : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FirewallRules)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(IPRanges)) + { + writer.WritePropertyName("ipRanges"u8); + writer.WriteStartArray(); + foreach (var item in IPRanges) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AzureServices)) + { + writer.WritePropertyName("azureServices"u8); + writer.WriteStringValue(AzureServices.Value.ToString()); + } + if (Optional.IsDefined(CallerClientIP)) + { + writer.WritePropertyName("callerClientIP"u8); + writer.WriteStringValue(CallerClientIP.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + FirewallRules IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(FirewallRules)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeFirewallRules(document.RootElement, options); + } + + internal static FirewallRules DeserializeFirewallRules(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList ipRanges = default; + AllowType? azureServices = default; + AllowType? callerClientIP = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipRanges"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + ipRanges = array; + continue; + } + if (property.NameEquals("azureServices"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + azureServices = new AllowType(property.Value.GetString()); + continue; + } + if (property.NameEquals("callerClientIP"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + callerClientIP = new AllowType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new FirewallRules(ipRanges ?? new ChangeTrackingList(), azureServices, callerClientIP, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(FirewallRules)} does not support writing '{options.Format}' format."); + } + } + + FirewallRules IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeFirewallRules(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(FirewallRules)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.cs new file mode 100644 index 000000000000..e4940cab2d03 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Target service's firewall rules. to allow connections from source service. + public partial class FirewallRules + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public FirewallRules() + { + IPRanges = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. + /// Allow Azure services to access the target service if true. + /// Allow caller client IP to access the target service if true. the property is used when connecting local application to target service. + /// Keeps track of any properties unknown to the library. + internal FirewallRules(IList ipRanges, AllowType? azureServices, AllowType? callerClientIP, IDictionary serializedAdditionalRawData) + { + IPRanges = ipRanges; + AzureServices = azureServices; + CallerClientIP = callerClientIP; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// This value specifies the set of IP addresses or IP address ranges in CIDR form to be included as the allowed list of client IPs for a given database account. + public IList IPRanges { get; } + /// Allow Azure services to access the target service if true. + public AllowType? AzureServices { get; set; } + /// Allow caller client IP to access the target service if true. the property is used when connecting local application to target service. + public AllowType? CallerClientIP { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerAuthType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerAuthType.cs index 3a51fc6d3dfb..7fa4dff33372 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerAuthType.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerAuthType.cs @@ -27,6 +27,9 @@ public LinkerAuthType(string value) private const string ServicePrincipalSecretValue = "servicePrincipalSecret"; private const string ServicePrincipalCertificateValue = "servicePrincipalCertificate"; private const string SecretValue = "secret"; + private const string AccessKeyValue = "accessKey"; + private const string UserAccountValue = "userAccount"; + private const string EasyAuthMicrosoftEntraIdValue = "easyAuthMicrosoftEntraID"; /// systemAssignedIdentity. public static LinkerAuthType SystemAssignedIdentity { get; } = new LinkerAuthType(SystemAssignedIdentityValue); @@ -38,6 +41,12 @@ public LinkerAuthType(string value) public static LinkerAuthType ServicePrincipalCertificate { get; } = new LinkerAuthType(ServicePrincipalCertificateValue); /// secret. public static LinkerAuthType Secret { get; } = new LinkerAuthType(SecretValue); + /// accessKey. + public static LinkerAuthType AccessKey { get; } = new LinkerAuthType(AccessKeyValue); + /// userAccount. + public static LinkerAuthType UserAccount { get; } = new LinkerAuthType(UserAccountValue); + /// easyAuthMicrosoftEntraID. + public static LinkerAuthType EasyAuthMicrosoftEntraId { get; } = new LinkerAuthType(EasyAuthMicrosoftEntraIdValue); /// Determines if two values are the same. public static bool operator ==(LinkerAuthType left, LinkerAuthType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerClientType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerClientType.cs index ddc43894541f..c90c7d67bfa8 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerClientType.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerClientType.cs @@ -32,6 +32,9 @@ public LinkerClientType(string value) private const string DjangoValue = "django"; private const string NodejsValue = "nodejs"; private const string SpringBootValue = "springBoot"; + private const string KafkaSpringBootValue = "kafka-springBoot"; + private const string JmsSpringBootValue = "jms-springBoot"; + private const string DaprValue = "dapr"; /// none. public static LinkerClientType None { get; } = new LinkerClientType(NoneValue); @@ -53,6 +56,12 @@ public LinkerClientType(string value) public static LinkerClientType Nodejs { get; } = new LinkerClientType(NodejsValue); /// springBoot. public static LinkerClientType SpringBoot { get; } = new LinkerClientType(SpringBootValue); + /// kafka-springBoot. + public static LinkerClientType KafkaSpringBoot { get; } = new LinkerClientType(KafkaSpringBootValue); + /// jms-springBoot. + public static LinkerClientType JmsSpringBoot { get; } = new LinkerClientType(JmsSpringBootValue); + /// dapr. + public static LinkerClientType Dapr { get; } = new LinkerClientType(DaprValue); /// Determines if two values are the same. public static bool operator ==(LinkerClientType left, LinkerClientType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerConfigurationType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerConfigurationType.cs new file mode 100644 index 000000000000..9d53659015f6 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerConfigurationType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Type of configuration to determine whether the configuration can be modified after creation. KeyvaultSecret means the configuration references a key vault secret, such as App Service/ACA key vault reference. Default means the configuration is real value, such as user name, raw secret, etc. + public readonly partial struct LinkerConfigurationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LinkerConfigurationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "Default"; + private const string KeyVaultSecretValue = "KeyVaultSecret"; + + /// Default. + public static LinkerConfigurationType Default { get; } = new LinkerConfigurationType(DefaultValue); + /// KeyVaultSecret. + public static LinkerConfigurationType KeyVaultSecret { get; } = new LinkerConfigurationType(KeyVaultSecretValue); + /// Determines if two values are the same. + public static bool operator ==(LinkerConfigurationType left, LinkerConfigurationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LinkerConfigurationType left, LinkerConfigurationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LinkerConfigurationType(string value) => new LinkerConfigurationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LinkerConfigurationType other && Equals(other); + /// + public bool Equals(LinkerConfigurationType 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.Serialization.cs similarity index 71% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.Serialization.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.Serialization.cs index a3754e7ec1cd..0c1722407957 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.Serialization.cs @@ -13,16 +13,16 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - public partial class LinkerResourcePatch : IUtf8JsonSerializable, IJsonModel + public partial class LinkerPatch : IUtf8JsonSerializable, IJsonModel { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); - void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LinkerResourcePatch)} does not support writing '{format}' format."); + throw new FormatException($"The model {nameof(LinkerPatch)} does not support writing '{format}' format."); } writer.WriteStartObject(); @@ -84,6 +84,30 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri writer.WriteNull("scope"); } } + if (Optional.IsDefined(PublicNetworkSolution)) + { + if (PublicNetworkSolution != null) + { + writer.WritePropertyName("publicNetworkSolution"u8); + writer.WriteObjectValue(PublicNetworkSolution, options); + } + else + { + writer.WriteNull("publicNetworkSolution"); + } + } + if (Optional.IsDefined(ConfigurationInfo)) + { + if (ConfigurationInfo != null) + { + writer.WritePropertyName("configurationInfo"u8); + writer.WriteObjectValue(ConfigurationInfo, options); + } + else + { + writer.WriteNull("configurationInfo"); + } + } writer.WriteEndObject(); if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -103,19 +127,19 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri writer.WriteEndObject(); } - LinkerResourcePatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + LinkerPatch IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") { - throw new FormatException($"The model {nameof(LinkerResourcePatch)} does not support reading '{format}' format."); + throw new FormatException($"The model {nameof(LinkerPatch)} does not support reading '{format}' format."); } using JsonDocument document = JsonDocument.ParseValue(ref reader); - return DeserializeLinkerResourcePatch(document.RootElement, options); + return DeserializeLinkerPatch(document.RootElement, options); } - internal static LinkerResourcePatch DeserializeLinkerResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) + internal static LinkerPatch DeserializeLinkerPatch(JsonElement element, ModelReaderWriterOptions options = null) { options ??= ModelSerializationExtensions.WireOptions; @@ -130,6 +154,8 @@ internal static LinkerResourcePatch DeserializeLinkerResourcePatch(JsonElement e VnetSolution vnetSolution = default; LinkerSecretStore secretStore = default; string scope = default; + PublicNetworkSolution publicNetworkSolution = default; + ConfigurationInfo configurationInfo = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -205,6 +231,26 @@ internal static LinkerResourcePatch DeserializeLinkerResourcePatch(JsonElement e scope = property0.Value.GetString(); continue; } + if (property0.NameEquals("publicNetworkSolution"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + publicNetworkSolution = null; + continue; + } + publicNetworkSolution = PublicNetworkSolution.DeserializePublicNetworkSolution(property0.Value, options); + continue; + } + if (property0.NameEquals("configurationInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + configurationInfo = null; + continue; + } + configurationInfo = ConfigurationInfo.DeserializeConfigurationInfo(property0.Value, options); + continue; + } } continue; } @@ -214,7 +260,7 @@ internal static LinkerResourcePatch DeserializeLinkerResourcePatch(JsonElement e } } serializedAdditionalRawData = rawDataDictionary; - return new LinkerResourcePatch( + return new LinkerPatch( targetService, authInfo, clientType, @@ -222,38 +268,40 @@ internal static LinkerResourcePatch DeserializeLinkerResourcePatch(JsonElement e vnetSolution, secretStore, scope, + publicNetworkSolution, + configurationInfo, serializedAdditionalRawData); } - BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": return ModelReaderWriter.Write(this, options); default: - throw new FormatException($"The model {nameof(LinkerResourcePatch)} does not support writing '{options.Format}' format."); + throw new FormatException($"The model {nameof(LinkerPatch)} does not support writing '{options.Format}' format."); } } - LinkerResourcePatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + LinkerPatch IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) { - var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; switch (format) { case "J": { using JsonDocument document = JsonDocument.Parse(data); - return DeserializeLinkerResourcePatch(document.RootElement, options); + return DeserializeLinkerPatch(document.RootElement, options); } default: - throw new FormatException($"The model {nameof(LinkerResourcePatch)} does not support reading '{options.Format}' format."); + throw new FormatException($"The model {nameof(LinkerPatch)} does not support reading '{options.Format}' format."); } } - string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.cs similarity index 66% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.cs index 34b1d74da55b..3d09e0628c9e 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.cs @@ -7,12 +7,11 @@ using System; using System.Collections.Generic; -using Azure.Core; namespace Azure.ResourceManager.ServiceLinker.Models { - /// A linker to be updated. - public partial class LinkerResourcePatch + /// A Linker to be updated. + public partial class LinkerPatch { /// /// Keeps track of any properties unknown to the library. @@ -46,29 +45,31 @@ public partial class LinkerResourcePatch /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - public LinkerResourcePatch() + /// Initializes a new instance of . + public LinkerPatch() { } - /// Initializes a new instance of . + /// Initializes a new instance of . /// /// The target service properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , , and . /// /// /// The authentication type. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , , , , and . /// /// The application client type. /// The provisioning state. /// The VNet solution. /// An option to store secret value in secure place. /// connection scope in source service. + /// The network solution. + /// The connection information consumed by applications, including secrets, connection strings. /// Keeps track of any properties unknown to the library. - internal LinkerResourcePatch(TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope, IDictionary serializedAdditionalRawData) + internal LinkerPatch(TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope, PublicNetworkSolution publicNetworkSolution, ConfigurationInfo configurationInfo, IDictionary serializedAdditionalRawData) { TargetService = targetService; AuthInfo = authInfo; @@ -77,19 +78,21 @@ internal LinkerResourcePatch(TargetServiceBaseInfo targetService, AuthBaseInfo a VnetSolution = vnetSolution; SecretStore = secretStore; Scope = scope; + PublicNetworkSolution = publicNetworkSolution; + ConfigurationInfo = configurationInfo; _serializedAdditionalRawData = serializedAdditionalRawData; } /// /// The target service properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , , and . /// public TargetServiceBaseInfo TargetService { get; set; } /// /// The authentication type. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , and . + /// The available derived classes include , , , , , , and . /// public AuthBaseInfo AuthInfo { get; set; } /// The application client type. @@ -97,34 +100,14 @@ internal LinkerResourcePatch(TargetServiceBaseInfo targetService, AuthBaseInfo a /// The provisioning state. public string ProvisioningState { get; } /// The VNet solution. - internal VnetSolution VnetSolution { get; set; } - /// Type of VNet solution. - public VnetSolutionType? SolutionType - { - get => VnetSolution is null ? default : VnetSolution.SolutionType; - set - { - if (VnetSolution is null) - VnetSolution = new VnetSolution(); - VnetSolution.SolutionType = value; - } - } - + public VnetSolution VnetSolution { get; set; } /// An option to store secret value in secure place. - internal LinkerSecretStore SecretStore { get; set; } - /// The key vault id to store secret. - public ResourceIdentifier SecretStoreKeyVaultId - { - get => SecretStore is null ? default : SecretStore.KeyVaultId; - set - { - if (SecretStore is null) - SecretStore = new LinkerSecretStore(); - SecretStore.KeyVaultId = value; - } - } - + public LinkerSecretStore SecretStore { get; set; } /// connection scope in source service. public string Scope { get; set; } + /// The network solution. + public PublicNetworkSolution PublicNetworkSolution { get; set; } + /// The connection information consumed by applications, including secrets, connection strings. + public ConfigurationInfo ConfigurationInfo { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.Serialization.cs index bbd7f206ea96..2f8ec865ab72 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.Serialization.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - internal partial class LinkerSecretStore : IUtf8JsonSerializable, IJsonModel + public partial class LinkerSecretStore : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -38,6 +38,18 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite writer.WriteNull("keyVaultId"); } } + if (Optional.IsDefined(KeyVaultSecretName)) + { + if (KeyVaultSecretName != null) + { + writer.WritePropertyName("keyVaultSecretName"u8); + writer.WriteStringValue(KeyVaultSecretName); + } + else + { + writer.WriteNull("keyVaultSecretName"); + } + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -77,6 +89,7 @@ internal static LinkerSecretStore DeserializeLinkerSecretStore(JsonElement eleme return null; } ResourceIdentifier keyVaultId = default; + string keyVaultSecretName = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -91,13 +104,23 @@ internal static LinkerSecretStore DeserializeLinkerSecretStore(JsonElement eleme keyVaultId = new ResourceIdentifier(property.Value.GetString()); continue; } + if (property.NameEquals("keyVaultSecretName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + keyVaultSecretName = null; + continue; + } + keyVaultSecretName = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new LinkerSecretStore(keyVaultId, serializedAdditionalRawData); + return new LinkerSecretStore(keyVaultId, keyVaultSecretName, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.cs index 3ffff2e53c63..bc1f1eb6f1f8 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// An option to store secret value in secure place. - internal partial class LinkerSecretStore + public partial class LinkerSecretStore { /// /// Keeps track of any properties unknown to the library. @@ -53,14 +53,18 @@ public LinkerSecretStore() /// Initializes a new instance of . /// The key vault id to store secret. + /// The key vault secret name to store secret, only valid when storing one secret. /// Keeps track of any properties unknown to the library. - internal LinkerSecretStore(ResourceIdentifier keyVaultId, IDictionary serializedAdditionalRawData) + internal LinkerSecretStore(ResourceIdentifier keyVaultId, string keyVaultSecretName, IDictionary serializedAdditionalRawData) { KeyVaultId = keyVaultId; + KeyVaultSecretName = keyVaultSecretName; _serializedAdditionalRawData = serializedAdditionalRawData; } /// The key vault id to store secret. public ResourceIdentifier KeyVaultId { get; set; } + /// The key vault secret name to store secret, only valid when storing one secret. + public string KeyVaultSecretName { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidateOperationResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidateOperationResult.cs index b0abe0b61df4..8a58fc721a11 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidateOperationResult.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidateOperationResult.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - /// The validation operation result for a linker. + /// The validation operation result for a Linker. public partial class LinkerValidateOperationResult { /// @@ -53,13 +53,13 @@ internal LinkerValidateOperationResult() } /// Initializes a new instance of . - /// Validated linker id. + /// Validated Linker id. /// Validation operation status. /// The linker name. /// A boolean value indicating whether the connection is available or not. /// The start time of the validation report. /// The end time of the validation report. - /// The resource id of the linker source application. + /// The resource id of the Linker source application. /// The resource Id of target service. /// The authentication type. /// The detail of validation result. @@ -79,7 +79,7 @@ internal LinkerValidateOperationResult(ResourceIdentifier resourceId, string sta _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Validated linker id. + /// Validated Linker id. public ResourceIdentifier ResourceId { get; } /// Validation operation status. public string Status { get; } @@ -91,7 +91,7 @@ internal LinkerValidateOperationResult(ResourceIdentifier resourceId, string sta public DateTimeOffset? ReportStartOn { get; } /// The end time of the validation report. public DateTimeOffset? ReportEndOn { get; } - /// The resource id of the linker source application. + /// The resource id of the Linker source application. public ResourceIdentifier SourceId { get; } /// The resource Id of target service. public ResourceIdentifier TargetId { get; } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidationResultItemInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidationResultItemInfo.cs index e7c102f9fc3c..ffcf0cf5b852 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidationResultItemInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidationResultItemInfo.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - /// The validation item for a linker. + /// The validation item for a Linker. public partial class LinkerValidationResultItemInfo { /// diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.Serialization.cs new file mode 100644 index 000000000000..6f93e50f84fb --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class PermissionsMissingDryrunPrerequisiteResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PermissionsMissingDryrunPrerequisiteResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + if (Optional.IsCollectionDefined(Permissions)) + { + writer.WritePropertyName("permissions"u8); + writer.WriteStartArray(); + foreach (var item in Permissions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(RecommendedRole)) + { + writer.WritePropertyName("recommendedRole"u8); + writer.WriteStringValue(RecommendedRole); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResultType.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PermissionsMissingDryrunPrerequisiteResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PermissionsMissingDryrunPrerequisiteResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePermissionsMissingDryrunPrerequisiteResult(document.RootElement, options); + } + + internal static PermissionsMissingDryrunPrerequisiteResult DeserializePermissionsMissingDryrunPrerequisiteResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string scope = default; + IReadOnlyList permissions = default; + string recommendedRole = default; + DryrunPrerequisiteResultType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scope"u8)) + { + scope = property.Value.GetString(); + continue; + } + if (property.NameEquals("permissions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + permissions = array; + continue; + } + if (property.NameEquals("recommendedRole"u8)) + { + recommendedRole = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new DryrunPrerequisiteResultType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PermissionsMissingDryrunPrerequisiteResult(type, serializedAdditionalRawData, scope, permissions ?? new ChangeTrackingList(), recommendedRole); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PermissionsMissingDryrunPrerequisiteResult)} does not support writing '{options.Format}' format."); + } + } + + PermissionsMissingDryrunPrerequisiteResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePermissionsMissingDryrunPrerequisiteResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PermissionsMissingDryrunPrerequisiteResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.cs new file mode 100644 index 000000000000..1dc8ce481022 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The represent of missing permissions. + public partial class PermissionsMissingDryrunPrerequisiteResult : DryrunPrerequisiteResult + { + /// Initializes a new instance of . + internal PermissionsMissingDryrunPrerequisiteResult() + { + Permissions = new ChangeTrackingList(); + ResultType = DryrunPrerequisiteResultType.PermissionsMissing; + } + + /// Initializes a new instance of . + /// The type of dryrun result. + /// Keeps track of any properties unknown to the library. + /// The permission scope. + /// The permission list. + /// The recommended role to resolve permissions missing. + internal PermissionsMissingDryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType, IDictionary serializedAdditionalRawData, string scope, IReadOnlyList permissions, string recommendedRole) : base(resultType, serializedAdditionalRawData) + { + Scope = scope; + Permissions = permissions; + RecommendedRole = recommendedRole; + ResultType = resultType; + } + + /// The permission scope. + public string Scope { get; } + /// The permission list. + public IReadOnlyList Permissions { get; } + /// The recommended role to resolve permissions missing. + public string RecommendedRole { get; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.Serialization.cs new file mode 100644 index 000000000000..5011ef75e8df --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class PublicNetworkSolution : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicNetworkSolution)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"u8); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action.Value.ToString()); + } + if (Optional.IsDefined(FirewallRules)) + { + writer.WritePropertyName("firewallRules"u8); + writer.WriteObjectValue(FirewallRules, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + PublicNetworkSolution IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(PublicNetworkSolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePublicNetworkSolution(document.RootElement, options); + } + + internal static PublicNetworkSolution DeserializePublicNetworkSolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DeleteOrUpdateBehavior? deleteOrUpdateBehavior = default; + ActionType? action = default; + FirewallRules firewallRules = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deleteOrUpdateBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("action"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + action = new ActionType(property.Value.GetString()); + continue; + } + if (property.NameEquals("firewallRules"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firewallRules = FirewallRules.DeserializeFirewallRules(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PublicNetworkSolution(deleteOrUpdateBehavior, action, firewallRules, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(PublicNetworkSolution)} does not support writing '{options.Format}' format."); + } + } + + PublicNetworkSolution IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePublicNetworkSolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PublicNetworkSolution)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.cs new file mode 100644 index 000000000000..23e90f2e82bf --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Indicates public network solution, include firewall rules. + public partial class PublicNetworkSolution + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public PublicNetworkSolution() + { + } + + /// Initializes a new instance of . + /// Indicates whether to clean up previous operation(such as firewall rules) when Linker is updating or deleting. + /// Optional. Indicates public network solution. If enable, enable public network access of target service with best try. Default is enable. If optOut, opt out public network access configuration. + /// Describe firewall rules of target service to make sure source application could connect to the target. + /// Keeps track of any properties unknown to the library. + internal PublicNetworkSolution(DeleteOrUpdateBehavior? deleteOrUpdateBehavior, ActionType? action, FirewallRules firewallRules, IDictionary serializedAdditionalRawData) + { + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Action = action; + FirewallRules = firewallRules; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Indicates whether to clean up previous operation(such as firewall rules) when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional. Indicates public network solution. If enable, enable public network access of target service with best try. Default is enable. If optOut, opt out public network access configuration. + public ActionType? Action { get; set; } + /// Describe firewall rules of target service to make sure source application could connect to the target. + public FirewallRules FirewallRules { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.Serialization.cs new file mode 100644 index 000000000000..4911efb80d65 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class ResourceList : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceList)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(NextLink)) + { + if (NextLink != null) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + else + { + writer.WriteNull("nextLink"); + } + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ResourceList IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceList)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceList(document.RootElement, options); + } + + internal static ResourceList DeserializeResourceList(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string nextLink = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + nextLink = null; + continue; + } + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(LinkerResourceData.DeserializeLinkerResourceData(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceList(nextLink, value ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ResourceList)} does not support writing '{options.Format}' format."); + } + } + + ResourceList IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeResourceList(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceList)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.cs similarity index 79% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.cs index 03dbf27871a4..16adb7f60561 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// The list of Linker. - internal partial class LinkerList + internal partial class ResourceList { /// /// Keeps track of any properties unknown to the library. @@ -45,24 +45,24 @@ internal partial class LinkerList /// private IDictionary _serializedAdditionalRawData; - /// Initializes a new instance of . - internal LinkerList() + /// Initializes a new instance of . + internal ResourceList() { Value = new ChangeTrackingList(); } - /// Initializes a new instance of . - /// The link used to get the next page of Linker list. + /// Initializes a new instance of . + /// The Linker used to get the next page of Linker list. /// The list of Linkers. /// Keeps track of any properties unknown to the library. - internal LinkerList(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) + internal ResourceList(string nextLink, IReadOnlyList value, IDictionary serializedAdditionalRawData) { NextLink = nextLink; Value = value; _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The link used to get the next page of Linker list. + /// The Linker used to get the next page of Linker list. public string NextLink { get; } /// The list of Linkers. public IReadOnlyList Value { get; } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretAuthInfo.Serialization.cs index d09750a41dcb..44294de9e8e5 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretAuthInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretAuthInfo.Serialization.cs @@ -52,6 +52,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp } writer.WritePropertyName("authType"u8); writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -93,6 +98,7 @@ internal static SecretAuthInfo DeserializeSecretAuthInfo(JsonElement element, Mo string name = default; SecretBaseInfo secretInfo = default; LinkerAuthType authType = default; + AuthMode? authMode = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -122,13 +128,22 @@ internal static SecretAuthInfo DeserializeSecretAuthInfo(JsonElement element, Mo authType = new LinkerAuthType(property.Value.GetString()); continue; } + if (property.NameEquals("authMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authMode = new AuthMode(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new SecretAuthInfo(authType, serializedAdditionalRawData, name, secretInfo); + return new SecretAuthInfo(authType, authMode, serializedAdditionalRawData, name, secretInfo); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretAuthInfo.cs index c114d03deb1f..118ceb46e8cd 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretAuthInfo.cs @@ -21,6 +21,7 @@ public SecretAuthInfo() /// Initializes a new instance of . /// The authentication type. + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. /// Keeps track of any properties unknown to the library. /// Username or account name for secret auth. /// @@ -28,7 +29,7 @@ public SecretAuthInfo() /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. /// The available derived classes include , and . /// - internal SecretAuthInfo(LinkerAuthType authType, IDictionary serializedAdditionalRawData, string name, SecretBaseInfo secretInfo) : base(authType, serializedAdditionalRawData) + internal SecretAuthInfo(LinkerAuthType authType, AuthMode? authMode, IDictionary serializedAdditionalRawData, string name, SecretBaseInfo secretInfo) : base(authType, authMode, serializedAdditionalRawData) { Name = name; SecretInfo = secretInfo; diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretSourceType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretSourceType.cs new file mode 100644 index 000000000000..76870555617c --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretSourceType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The type of secret source. + public readonly partial struct SecretSourceType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SecretSourceType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RawValueValue = "rawValue"; + private const string KeyVaultSecretValue = "keyVaultSecret"; + + /// rawValue. + public static SecretSourceType RawValue { get; } = new SecretSourceType(RawValueValue); + /// keyVaultSecret. + public static SecretSourceType KeyVaultSecret { get; } = new SecretSourceType(KeyVaultSecretValue); + /// Determines if two values are the same. + public static bool operator ==(SecretSourceType left, SecretSourceType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SecretSourceType left, SecretSourceType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SecretSourceType(string value) => new SecretSourceType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SecretSourceType other && Equals(other); + /// + public bool Equals(SecretSourceType 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/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.Serialization.cs new file mode 100644 index 000000000000..7a9a78e2ab45 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.Serialization.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class SelfHostedServer : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SelfHostedServer)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(TargetServiceType.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + SelfHostedServer IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SelfHostedServer)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSelfHostedServer(document.RootElement, options); + } + + internal static SelfHostedServer DeserializeSelfHostedServer(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string endpoint = default; + TargetServiceType type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("endpoint"u8)) + { + endpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new TargetServiceType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SelfHostedServer(type, serializedAdditionalRawData, endpoint); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SelfHostedServer)} does not support writing '{options.Format}' format."); + } + } + + SelfHostedServer IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSelfHostedServer(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SelfHostedServer)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.cs new file mode 100644 index 000000000000..50f5b760a708 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The service properties when target service type is SelfHostedServer. + public partial class SelfHostedServer : TargetServiceBaseInfo + { + /// Initializes a new instance of . + public SelfHostedServer() + { + TargetServiceType = TargetServiceType.SelfHostedServer; + } + + /// Initializes a new instance of . + /// The target service type. + /// Keeps track of any properties unknown to the library. + /// The endpoint of service. + internal SelfHostedServer(TargetServiceType targetServiceType, IDictionary serializedAdditionalRawData, string endpoint) : base(targetServiceType, serializedAdditionalRawData) + { + Endpoint = endpoint; + TargetServiceType = targetServiceType; + } + + /// The endpoint of service. + public string Endpoint { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.Serialization.cs index c785301a0ae6..4c39f6796cf9 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.Serialization.cs @@ -32,8 +32,28 @@ void IJsonModel.Write(Utf8JsonWriter writer writer.WriteStringValue(PrincipalId); writer.WritePropertyName("certificate"u8); writer.WriteStringValue(Certificate); + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"u8); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"u8); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } writer.WritePropertyName("authType"u8); writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -75,7 +95,10 @@ internal static ServicePrincipalCertificateAuthInfo DeserializeServicePrincipalC string clientId = default; Guid principalId = default; string certificate = default; + DeleteOrUpdateBehavior? deleteOrUpdateBehavior = default; + IList roles = default; LinkerAuthType authType = default; + AuthMode? authMode = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -95,18 +118,58 @@ internal static ServicePrincipalCertificateAuthInfo DeserializeServicePrincipalC certificate = property.Value.GetString(); continue; } + if (property.NameEquals("deleteOrUpdateBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("roles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roles = array; + continue; + } if (property.NameEquals("authType"u8)) { authType = new LinkerAuthType(property.Value.GetString()); continue; } + if (property.NameEquals("authMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authMode = new AuthMode(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ServicePrincipalCertificateAuthInfo(authType, serializedAdditionalRawData, clientId, principalId, certificate); + return new ServicePrincipalCertificateAuthInfo( + authType, + authMode, + serializedAdditionalRawData, + clientId, + principalId, + certificate, + deleteOrUpdateBehavior, + roles ?? new ChangeTrackingList()); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.cs index 23612cfecbc2..575412338488 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.cs @@ -26,20 +26,26 @@ public ServicePrincipalCertificateAuthInfo(string clientId, Guid principalId, st ClientId = clientId; PrincipalId = principalId; Certificate = certificate; + Roles = new ChangeTrackingList(); AuthType = LinkerAuthType.ServicePrincipalCertificate; } /// Initializes a new instance of . /// The authentication type. + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. /// Keeps track of any properties unknown to the library. /// Application clientId for servicePrincipal auth. /// Principal Id for servicePrincipal auth. /// ServicePrincipal certificate for servicePrincipal auth. - internal ServicePrincipalCertificateAuthInfo(LinkerAuthType authType, IDictionary serializedAdditionalRawData, string clientId, Guid principalId, string certificate) : base(authType, serializedAdditionalRawData) + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + internal ServicePrincipalCertificateAuthInfo(LinkerAuthType authType, AuthMode? authMode, IDictionary serializedAdditionalRawData, string clientId, Guid principalId, string certificate, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles) : base(authType, authMode, serializedAdditionalRawData) { ClientId = clientId; PrincipalId = principalId; Certificate = certificate; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; AuthType = authType; } @@ -54,5 +60,9 @@ internal ServicePrincipalCertificateAuthInfo() public Guid PrincipalId { get; set; } /// ServicePrincipal certificate for servicePrincipal auth. public string Certificate { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + public IList Roles { get; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.Serialization.cs index acf0d3a865ae..9a6103a574e2 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.Serialization.cs @@ -32,8 +32,40 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod writer.WriteStringValue(PrincipalId); writer.WritePropertyName("secret"u8); writer.WriteStringValue(Secret); + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"u8); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"u8); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(UserName)) + { + if (UserName != null) + { + writer.WritePropertyName("userName"u8); + writer.WriteStringValue(UserName); + } + else + { + writer.WriteNull("userName"); + } + } writer.WritePropertyName("authType"u8); writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -75,7 +107,11 @@ internal static ServicePrincipalSecretAuthInfo DeserializeServicePrincipalSecret string clientId = default; Guid principalId = default; string secret = default; + DeleteOrUpdateBehavior? deleteOrUpdateBehavior = default; + IList roles = default; + string userName = default; LinkerAuthType authType = default; + AuthMode? authMode = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -95,18 +131,69 @@ internal static ServicePrincipalSecretAuthInfo DeserializeServicePrincipalSecret secret = property.Value.GetString(); continue; } + if (property.NameEquals("deleteOrUpdateBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("roles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roles = array; + continue; + } + if (property.NameEquals("userName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + userName = null; + continue; + } + userName = property.Value.GetString(); + continue; + } if (property.NameEquals("authType"u8)) { authType = new LinkerAuthType(property.Value.GetString()); continue; } + if (property.NameEquals("authMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authMode = new AuthMode(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new ServicePrincipalSecretAuthInfo(authType, serializedAdditionalRawData, clientId, principalId, secret); + return new ServicePrincipalSecretAuthInfo( + authType, + authMode, + serializedAdditionalRawData, + clientId, + principalId, + secret, + deleteOrUpdateBehavior, + roles ?? new ChangeTrackingList(), + userName); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.cs index 7e8323b5bc3a..d0b437edd39a 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.cs @@ -26,20 +26,28 @@ public ServicePrincipalSecretAuthInfo(string clientId, Guid principalId, string ClientId = clientId; PrincipalId = principalId; Secret = secret; + Roles = new ChangeTrackingList(); AuthType = LinkerAuthType.ServicePrincipalSecret; } /// Initializes a new instance of . /// The authentication type. + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. /// Keeps track of any properties unknown to the library. /// ServicePrincipal application clientId for servicePrincipal auth. /// Principal Id for servicePrincipal auth. /// Secret for servicePrincipal auth. - internal ServicePrincipalSecretAuthInfo(LinkerAuthType authType, IDictionary serializedAdditionalRawData, string clientId, Guid principalId, string secret) : base(authType, serializedAdditionalRawData) + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + /// Username created in the database which is mapped to a user in AAD. + internal ServicePrincipalSecretAuthInfo(LinkerAuthType authType, AuthMode? authMode, IDictionary serializedAdditionalRawData, string clientId, Guid principalId, string secret, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType, authMode, serializedAdditionalRawData) { ClientId = clientId; PrincipalId = principalId; Secret = secret; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; + UserName = userName; AuthType = authType; } @@ -54,5 +62,11 @@ internal ServicePrincipalSecretAuthInfo() public Guid PrincipalId { get; set; } /// Secret for servicePrincipal auth. public string Secret { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + public IList Roles { get; } + /// Username created in the database which is mapped to a user in AAD. + public string UserName { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfiguration.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfiguration.Serialization.cs index f31c80c95e64..5ddddc8d8e66 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfiguration.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfiguration.Serialization.cs @@ -43,6 +43,35 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri writer.WriteNull("value"); } } + if (options.Format != "W" && Optional.IsDefined(ConfigType)) + { + writer.WritePropertyName("configType"u8); + writer.WriteStringValue(ConfigType.Value.ToString()); + } + if (Optional.IsDefined(KeyVaultReferenceIdentity)) + { + if (KeyVaultReferenceIdentity != null) + { + writer.WritePropertyName("keyVaultReferenceIdentity"u8); + writer.WriteStringValue(KeyVaultReferenceIdentity); + } + else + { + writer.WriteNull("keyVaultReferenceIdentity"); + } + } + if (Optional.IsDefined(Description)) + { + if (Description != null) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + else + { + writer.WriteNull("description"); + } + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -83,6 +112,9 @@ internal static SourceConfiguration DeserializeSourceConfiguration(JsonElement e } string name = default; string value = default; + LinkerConfigurationType? configType = default; + string keyVaultReferenceIdentity = default; + string description = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -102,13 +134,48 @@ internal static SourceConfiguration DeserializeSourceConfiguration(JsonElement e value = property.Value.GetString(); continue; } + if (property.NameEquals("configType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + configType = new LinkerConfigurationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("keyVaultReferenceIdentity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + keyVaultReferenceIdentity = null; + continue; + } + keyVaultReferenceIdentity = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + description = null; + continue; + } + description = property.Value.GetString(); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new SourceConfiguration(name, value, serializedAdditionalRawData); + return new SourceConfiguration( + name, + value, + configType, + keyVaultReferenceIdentity, + description, + serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfiguration.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfiguration.cs index dc442dc31c78..9eb51db967d9 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfiguration.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfiguration.cs @@ -53,11 +53,17 @@ internal SourceConfiguration() /// Initializes a new instance of . /// The name of setting. /// The value of setting. + /// The type of setting. + /// The identity for key vault reference, system or user-assigned managed identity ID. + /// Descriptive information for the configuration. /// Keeps track of any properties unknown to the library. - internal SourceConfiguration(string name, string value, IDictionary serializedAdditionalRawData) + internal SourceConfiguration(string name, string value, LinkerConfigurationType? configType, string keyVaultReferenceIdentity, string description, IDictionary serializedAdditionalRawData) { Name = name; Value = value; + ConfigType = configType; + KeyVaultReferenceIdentity = keyVaultReferenceIdentity; + Description = description; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -65,5 +71,11 @@ internal SourceConfiguration(string name, string value, IDictionary The value of setting. public string Value { get; } + /// The type of setting. + public LinkerConfigurationType? ConfigType { get; } + /// The identity for key vault reference, system or user-assigned managed identity ID. + public string KeyVaultReferenceIdentity { get; } + /// Descriptive information for the configuration. + public string Description { get; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.Serialization.cs index 8a7f01f23ff9..627758a49ade 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.Serialization.cs @@ -26,8 +26,40 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mod } writer.WriteStartObject(); + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"u8); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"u8); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(UserName)) + { + if (UserName != null) + { + writer.WritePropertyName("userName"u8); + writer.WriteStringValue(UserName); + } + else + { + writer.WriteNull("userName"); + } + } writer.WritePropertyName("authType"u8); writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -66,23 +98,75 @@ internal static SystemAssignedIdentityAuthInfo DeserializeSystemAssignedIdentity { return null; } + DeleteOrUpdateBehavior? deleteOrUpdateBehavior = default; + IList roles = default; + string userName = default; LinkerAuthType authType = default; + AuthMode? authMode = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("deleteOrUpdateBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("roles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roles = array; + continue; + } + if (property.NameEquals("userName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + userName = null; + continue; + } + userName = property.Value.GetString(); + continue; + } if (property.NameEquals("authType"u8)) { authType = new LinkerAuthType(property.Value.GetString()); continue; } + if (property.NameEquals("authMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authMode = new AuthMode(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new SystemAssignedIdentityAuthInfo(authType, serializedAdditionalRawData); + return new SystemAssignedIdentityAuthInfo( + authType, + authMode, + serializedAdditionalRawData, + deleteOrUpdateBehavior, + roles ?? new ChangeTrackingList(), + userName); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.cs index f513a6235300..9da34dd24aa1 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.cs @@ -16,15 +16,30 @@ public partial class SystemAssignedIdentityAuthInfo : AuthBaseInfo /// Initializes a new instance of . public SystemAssignedIdentityAuthInfo() { + Roles = new ChangeTrackingList(); AuthType = LinkerAuthType.SystemAssignedIdentity; } /// Initializes a new instance of . /// The authentication type. + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. /// Keeps track of any properties unknown to the library. - internal SystemAssignedIdentityAuthInfo(LinkerAuthType authType, IDictionary serializedAdditionalRawData) : base(authType, serializedAdditionalRawData) + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, this value specifies the Azure role to be assigned. + /// Username created in the database which is mapped to a user in AAD. + internal SystemAssignedIdentityAuthInfo(LinkerAuthType authType, AuthMode? authMode, IDictionary serializedAdditionalRawData, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType, authMode, serializedAdditionalRawData) { + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; + UserName = userName; AuthType = authType; } + + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, this value specifies the Azure role to be assigned. + public IList Roles { get; } + /// Username created in the database which is mapped to a user in AAD. + public string UserName { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.Serialization.cs index 6fea9a8392fa..597d21a56e59 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.Serialization.cs @@ -73,6 +73,7 @@ internal static TargetServiceBaseInfo DeserializeTargetServiceBaseInfo(JsonEleme case "AzureResource": return AzureResourceInfo.DeserializeAzureResourceInfo(element, options); case "ConfluentBootstrapServer": return ConfluentBootstrapServerInfo.DeserializeConfluentBootstrapServerInfo(element, options); case "ConfluentSchemaRegistry": return ConfluentSchemaRegistryInfo.DeserializeConfluentSchemaRegistryInfo(element, options); + case "SelfHostedServer": return SelfHostedServer.DeserializeSelfHostedServer(element, options); } } return UnknownTargetServiceBase.DeserializeUnknownTargetServiceBase(element, options); diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.cs index a1d41b573014..446d78f606e9 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models /// /// The target service properties /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , and . + /// The available derived classes include , , and . /// public abstract partial class TargetServiceBaseInfo { diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceType.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceType.cs index 3f4b6d0cc99d..bb5e2954cbf8 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceType.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceType.cs @@ -25,6 +25,7 @@ public TargetServiceType(string value) private const string AzureResourceValue = "AzureResource"; private const string ConfluentBootstrapServerValue = "ConfluentBootstrapServer"; private const string ConfluentSchemaRegistryValue = "ConfluentSchemaRegistry"; + private const string SelfHostedServerValue = "SelfHostedServer"; /// AzureResource. public static TargetServiceType AzureResource { get; } = new TargetServiceType(AzureResourceValue); @@ -32,6 +33,8 @@ public TargetServiceType(string value) public static TargetServiceType ConfluentBootstrapServer { get; } = new TargetServiceType(ConfluentBootstrapServerValue); /// ConfluentSchemaRegistry. public static TargetServiceType ConfluentSchemaRegistry { get; } = new TargetServiceType(ConfluentSchemaRegistryValue); + /// SelfHostedServer. + public static TargetServiceType SelfHostedServer { get; } = new TargetServiceType(SelfHostedServerValue); /// Determines if two values are the same. public static bool operator ==(TargetServiceType left, TargetServiceType right) => left.Equals(right); /// Determines if two values are not the same. diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownAuthInfoBase.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownAuthInfoBase.Serialization.cs index 289f497757fe..7c1b7475094d 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownAuthInfoBase.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownAuthInfoBase.Serialization.cs @@ -28,6 +28,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpti writer.WriteStartObject(); writer.WritePropertyName("authType"u8); writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -67,6 +72,7 @@ internal static UnknownAuthInfoBase DeserializeUnknownAuthInfoBase(JsonElement e return null; } LinkerAuthType authType = "Unknown"; + AuthMode? authMode = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -76,13 +82,22 @@ internal static UnknownAuthInfoBase DeserializeUnknownAuthInfoBase(JsonElement e authType = new LinkerAuthType(property.Value.GetString()); continue; } + if (property.NameEquals("authMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authMode = new AuthMode(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new UnknownAuthInfoBase(authType, serializedAdditionalRawData); + return new UnknownAuthInfoBase(authType, authMode, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownAuthInfoBase.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownAuthInfoBase.cs index a7f0a42073c5..62fce864b2e3 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownAuthInfoBase.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownAuthInfoBase.cs @@ -15,8 +15,9 @@ internal partial class UnknownAuthInfoBase : AuthBaseInfo { /// Initializes a new instance of . /// The authentication type. + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. /// Keeps track of any properties unknown to the library. - internal UnknownAuthInfoBase(LinkerAuthType authType, IDictionary serializedAdditionalRawData) : base(authType, serializedAdditionalRawData) + internal UnknownAuthInfoBase(LinkerAuthType authType, AuthMode? authMode, IDictionary serializedAdditionalRawData) : base(authType, authMode, serializedAdditionalRawData) { AuthType = authType; } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.Serialization.cs new file mode 100644 index 000000000000..2a36247e849e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.Serialization.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class UnknownDryrunParameters : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunParameters)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("actionName"u8); + writer.WriteStringValue(ActionName.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DryrunParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunParameters)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDryrunParameters(document.RootElement, options); + } + + internal static UnknownDryrunParameters DeserializeUnknownDryrunParameters(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DryrunActionName actionName = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("actionName"u8)) + { + actionName = new DryrunActionName(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownDryrunParameters(actionName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DryrunParameters)} does not support writing '{options.Format}' format."); + } + } + + DryrunParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDryrunParameters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DryrunParameters)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.cs new file mode 100644 index 000000000000..1d2c19061d43 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Unknown version of DryrunParameters. + internal partial class UnknownDryrunParameters : DryrunParameters + { + /// Initializes a new instance of . + /// The name of action for you dryrun job. + /// Keeps track of any properties unknown to the library. + internal UnknownDryrunParameters(DryrunActionName actionName, IDictionary serializedAdditionalRawData) : base(actionName, serializedAdditionalRawData) + { + ActionName = actionName; + } + + /// Initializes a new instance of for deserialization. + internal UnknownDryrunParameters() + { + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.Serialization.cs new file mode 100644 index 000000000000..516217382dac --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,119 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class UnknownDryrunPrerequisiteResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunPrerequisiteResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(ResultType.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DryrunPrerequisiteResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DryrunPrerequisiteResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDryrunPrerequisiteResult(document.RootElement, options); + } + + internal static UnknownDryrunPrerequisiteResult DeserializeUnknownDryrunPrerequisiteResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DryrunPrerequisiteResultType type = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new DryrunPrerequisiteResultType(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownDryrunPrerequisiteResult(type, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DryrunPrerequisiteResult)} does not support writing '{options.Format}' format."); + } + } + + DryrunPrerequisiteResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDryrunPrerequisiteResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DryrunPrerequisiteResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.cs new file mode 100644 index 000000000000..40a87c33f496 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Unknown version of DryrunPrerequisiteResult. + internal partial class UnknownDryrunPrerequisiteResult : DryrunPrerequisiteResult + { + /// Initializes a new instance of . + /// The type of dryrun result. + /// Keeps track of any properties unknown to the library. + internal UnknownDryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType, IDictionary serializedAdditionalRawData) : base(resultType, serializedAdditionalRawData) + { + ResultType = resultType; + } + + /// Initializes a new instance of for deserialization. + internal UnknownDryrunPrerequisiteResult() + { + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.Serialization.cs new file mode 100644 index 000000000000..fac9d3d7e5ab --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class UserAccountAuthInfo : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UserAccountAuthInfo)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(PrincipalId)) + { + writer.WritePropertyName("principalId"u8); + writer.WriteStringValue(PrincipalId.Value); + } + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"u8); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"u8); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(UserName)) + { + if (UserName != null) + { + writer.WritePropertyName("userName"u8); + writer.WriteStringValue(UserName); + } + else + { + writer.WriteNull("userName"); + } + } + writer.WritePropertyName("authType"u8); + writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + UserAccountAuthInfo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UserAccountAuthInfo)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUserAccountAuthInfo(document.RootElement, options); + } + + internal static UserAccountAuthInfo DeserializeUserAccountAuthInfo(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Guid? principalId = default; + DeleteOrUpdateBehavior? deleteOrUpdateBehavior = default; + IList roles = default; + string userName = default; + LinkerAuthType authType = default; + AuthMode? authMode = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("principalId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + principalId = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("deleteOrUpdateBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("roles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roles = array; + continue; + } + if (property.NameEquals("userName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + userName = null; + continue; + } + userName = property.Value.GetString(); + continue; + } + if (property.NameEquals("authType"u8)) + { + authType = new LinkerAuthType(property.Value.GetString()); + continue; + } + if (property.NameEquals("authMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authMode = new AuthMode(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UserAccountAuthInfo( + authType, + authMode, + serializedAdditionalRawData, + principalId, + deleteOrUpdateBehavior, + roles ?? new ChangeTrackingList(), + userName); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(UserAccountAuthInfo)} does not support writing '{options.Format}' format."); + } + } + + UserAccountAuthInfo IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeUserAccountAuthInfo(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UserAccountAuthInfo)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.cs new file mode 100644 index 000000000000..b95d30c9fc32 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The authentication info when authType is user account. + public partial class UserAccountAuthInfo : AuthBaseInfo + { + /// Initializes a new instance of . + public UserAccountAuthInfo() + { + Roles = new ChangeTrackingList(); + AuthType = LinkerAuthType.UserAccount; + } + + /// Initializes a new instance of . + /// The authentication type. + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. + /// Keeps track of any properties unknown to the library. + /// Principal Id for user account. + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + /// Username created in the database which is mapped to a user in AAD. + internal UserAccountAuthInfo(LinkerAuthType authType, AuthMode? authMode, IDictionary serializedAdditionalRawData, Guid? principalId, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType, authMode, serializedAdditionalRawData) + { + PrincipalId = principalId; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; + UserName = userName; + AuthType = authType; + } + + /// Principal Id for user account. + public Guid? PrincipalId { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, this value specifies the Azure roles to be assigned. Automatically. + public IList Roles { get; } + /// Username created in the database which is mapped to a user in AAD. + public string UserName { get; set; } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.Serialization.cs index 92a72973c4e6..9f4d58e4bbbe 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.Serialization.cs @@ -36,8 +36,40 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model writer.WritePropertyName("subscriptionId"u8); writer.WriteStringValue(SubscriptionId); } + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"u8); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } + if (Optional.IsCollectionDefined(Roles)) + { + writer.WritePropertyName("roles"u8); + writer.WriteStartArray(); + foreach (var item in Roles) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(UserName)) + { + if (UserName != null) + { + writer.WritePropertyName("userName"u8); + writer.WriteStringValue(UserName); + } + else + { + writer.WriteNull("userName"); + } + } writer.WritePropertyName("authType"u8); writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -78,7 +110,11 @@ internal static UserAssignedIdentityAuthInfo DeserializeUserAssignedIdentityAuth } string clientId = default; string subscriptionId = default; + DeleteOrUpdateBehavior? deleteOrUpdateBehavior = default; + IList roles = default; + string userName = default; LinkerAuthType authType = default; + AuthMode? authMode = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -93,18 +129,68 @@ internal static UserAssignedIdentityAuthInfo DeserializeUserAssignedIdentityAuth subscriptionId = property.Value.GetString(); continue; } + if (property.NameEquals("deleteOrUpdateBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } + if (property.NameEquals("roles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + roles = array; + continue; + } + if (property.NameEquals("userName"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + userName = null; + continue; + } + userName = property.Value.GetString(); + continue; + } if (property.NameEquals("authType"u8)) { authType = new LinkerAuthType(property.Value.GetString()); continue; } + if (property.NameEquals("authMode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authMode = new AuthMode(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new UserAssignedIdentityAuthInfo(authType, serializedAdditionalRawData, clientId, subscriptionId); + return new UserAssignedIdentityAuthInfo( + authType, + authMode, + serializedAdditionalRawData, + clientId, + subscriptionId, + deleteOrUpdateBehavior, + roles ?? new ChangeTrackingList(), + userName); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.cs index 3ed5ae45e742..878af5867ca3 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.cs @@ -16,18 +16,26 @@ public partial class UserAssignedIdentityAuthInfo : AuthBaseInfo /// Initializes a new instance of . public UserAssignedIdentityAuthInfo() { + Roles = new ChangeTrackingList(); AuthType = LinkerAuthType.UserAssignedIdentity; } /// Initializes a new instance of . /// The authentication type. + /// Optional. Indicates how to configure authentication. If optInAllAuth, service linker configures authentication such as enabling identity on source resource and granting RBAC roles. If optOutAllAuth, opt out authentication setup. Default is optInAllAuth. /// Keeps track of any properties unknown to the library. /// Client Id for userAssignedIdentity. /// Subscription id for userAssignedIdentity. - internal UserAssignedIdentityAuthInfo(LinkerAuthType authType, IDictionary serializedAdditionalRawData, string clientId, string subscriptionId) : base(authType, serializedAdditionalRawData) + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + /// Optional, this value specifies the Azure role to be assigned. + /// Username created in the database which is mapped to a user in AAD. + internal UserAssignedIdentityAuthInfo(LinkerAuthType authType, AuthMode? authMode, IDictionary serializedAdditionalRawData, string clientId, string subscriptionId, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType, authMode, serializedAdditionalRawData) { ClientId = clientId; SubscriptionId = subscriptionId; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; + UserName = userName; AuthType = authType; } @@ -35,5 +43,11 @@ internal UserAssignedIdentityAuthInfo(LinkerAuthType authType, IDictionary Subscription id for userAssignedIdentity. public string SubscriptionId { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } + /// Optional, this value specifies the Azure role to be assigned. + public IList Roles { get; } + /// Username created in the database which is mapped to a user in AAD. + public string UserName { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.Serialization.cs index c74d44facd96..506c45b2dc37 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.Serialization.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - internal partial class VnetSolution : IUtf8JsonSerializable, IJsonModel + public partial class VnetSolution : IUtf8JsonSerializable, IJsonModel { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); @@ -38,6 +38,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOpti writer.WriteNull("type"); } } + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"u8); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -77,6 +82,7 @@ internal static VnetSolution DeserializeVnetSolution(JsonElement element, ModelR return null; } VnetSolutionType? type = default; + DeleteOrUpdateBehavior? deleteOrUpdateBehavior = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -91,13 +97,22 @@ internal static VnetSolution DeserializeVnetSolution(JsonElement element, ModelR type = new VnetSolutionType(property.Value.GetString()); continue; } + if (property.NameEquals("deleteOrUpdateBehavior"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deleteOrUpdateBehavior = new DeleteOrUpdateBehavior(property.Value.GetString()); + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new VnetSolution(type, serializedAdditionalRawData); + return new VnetSolution(type, deleteOrUpdateBehavior, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.cs index 51a448e7a8da..50b8556329f6 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// The VNet solution for linker. - internal partial class VnetSolution + public partial class VnetSolution { /// /// Keeps track of any properties unknown to the library. @@ -52,14 +52,18 @@ public VnetSolution() /// Initializes a new instance of . /// Type of VNet solution. + /// Indicates whether to clean up previous operation when Linker is updating or deleting. /// Keeps track of any properties unknown to the library. - internal VnetSolution(VnetSolutionType? solutionType, IDictionary serializedAdditionalRawData) + internal VnetSolution(VnetSolutionType? solutionType, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IDictionary serializedAdditionalRawData) { SolutionType = solutionType; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; _serializedAdditionalRawData = serializedAdditionalRawData; } /// Type of VNet solution. public VnetSolutionType? SolutionType { get; set; } + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + public DeleteOrUpdateBehavior? DeleteOrUpdateBehavior { get; set; } } } diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConfigurationNamesRestOperations.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConfigurationNamesRestOperations.cs new file mode 100644 index 000000000000..9fbd22a089c3 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConfigurationNamesRestOperations.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal partial class ConfigurationNamesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConfigurationNamesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ConfigurationNamesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-04-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string filter, string skipToken) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ServiceLinker/configurationNames", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + return uri; + } + + internal HttpMessage CreateListRequest(string filter, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ServiceLinker/configurationNames", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + public async Task> ListAsync(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(filter, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationNameResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationNameResult.DeserializeConfigurationNameResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + public Response List(string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(filter, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationNameResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationNameResult.DeserializeConfigurationNameResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string filter, string skipToken) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string filter, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// The URL to the next page of results. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// is null. + public async Task> ListNextPageAsync(string nextLink, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink, filter, skipToken); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationNameResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationNameResult.DeserializeConfigurationNameResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the configuration names generated by Service Connector for all target, client types, auth types. + /// The URL to the next page of results. + /// OData filter options. + /// OData skipToken option for pagination. + /// The cancellation token to use. + /// is null. + public Response ListNextPage(string nextLink, string filter = null, string skipToken = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink, filter, skipToken); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationNameResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationNameResult.DeserializeConfigurationNameResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConnectorRestOperations.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConnectorRestOperations.cs new file mode 100644 index 000000000000..be10c25ce4be --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConnectorRestOperations.cs @@ -0,0 +1,1366 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal partial class ConnectorRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConnectorRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ConnectorRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-04-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListDryrunRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListDryrunRequest(string subscriptionId, string resourceGroupName, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// list dryrun jobs. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListDryrunAsync(string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListDryrunRequest(subscriptionId, resourceGroupName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// list dryrun jobs. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListDryrun(string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListDryrunRequest(subscriptionId, resourceGroupName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetDryrunRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetDryrunRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// get a dryrun job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetDryrunAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateGetDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DryrunResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// get a dryrun job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response GetDryrun(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateGetDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DryrunResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateDryrunRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunResourceData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateDryrunRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// create a dryrun job to do necessary check before actual creation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateDryrunAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// create a dryrun job to do necessary check before actual creation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateDryrun(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateDryrunRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateDryrunRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// update a dryrun job to do necessary check before actual creation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateDryrunAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// update a dryrun job to do necessary check before actual creation. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response UpdateDryrun(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteDryrunRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteDryrunRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// delete a dryrun job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteDryrunAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateDeleteDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// delete a dryrun job. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of dryrun. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response DeleteDryrun(string subscriptionId, string resourceGroupName, AzureLocation location, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateDeleteDryrunRequest(subscriptionId, resourceGroupName, location, dryrunName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceList.DeserializeResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceList.DeserializeResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns Connector resource for a given name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, location, connectorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + LinkerResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = LinkerResourceData.DeserializeLinkerResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((LinkerResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns Connector resource for a given name. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, location, connectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + LinkerResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = LinkerResourceData.DeserializeLinkerResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((LinkerResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, LinkerResourceData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, LinkerResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update Connector resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connector details. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, LinkerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, location, connectorName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update Connector resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connector details. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, LinkerResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, location, connectorName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, location, connectorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, location, connectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, LinkerPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, LinkerPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Operation to update an existing Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connector details. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, LinkerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, location, connectorName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Operation to update an existing Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connector details. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, LinkerPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, location, connectorName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateValidateRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateValidateRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendPath("/validate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Validate a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task ValidateAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateValidateRequest(subscriptionId, resourceGroupName, location, connectorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Validate a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Validate(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateValidateRequest(subscriptionId, resourceGroupName, location, connectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGenerateConfigurationsRequestUri(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, ConfigurationInfo info) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendPath("/generateConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGenerateConfigurationsRequest(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, ConfigurationInfo info) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ServiceLinker/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendPath("/generateConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (info != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(info, ModelSerializationExtensions.WireOptions); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Generate configurations for a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GenerateConfigurationsAsync(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGenerateConfigurationsRequest(subscriptionId, resourceGroupName, location, connectorName, info); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Generate configurations for a Connector. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The name of resource. + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response GenerateConfigurations(string subscriptionId, string resourceGroupName, AzureLocation location, string connectorName, ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGenerateConfigurationsRequest(subscriptionId, resourceGroupName, location, connectorName, info); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListDryrunNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListDryrunNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// list dryrun jobs. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListDryrunNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListDryrunNextPageRequest(nextLink, subscriptionId, resourceGroupName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// list dryrun jobs. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListDryrunNextPage(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListDryrunNextPageRequest(nextLink, subscriptionId, resourceGroupName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, location); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ResourceList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ResourceList.DeserializeResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns list of connector which connects to the resource, which supports to config the target service during the resource provision. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The name of Azure region. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, AzureLocation location, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, location); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ResourceList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ResourceList.DeserializeResourceList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkerRestOperations.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkerRestOperations.cs index 5493f67fe2bc..33ebc7f088b6 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkerRestOperations.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkerRestOperations.cs @@ -32,7 +32,7 @@ public LinkerRestOperations(HttpPipeline pipeline, string applicationId, Uri end { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-05-01"; + _apiVersion = apiVersion ?? "2023-04-01-preview"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -64,11 +64,11 @@ internal HttpMessage CreateListRequest(string resourceUri) return message; } - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The cancellation token to use. /// is null. - public async Task> ListAsync(string resourceUri, CancellationToken cancellationToken = default) + public async Task> ListAsync(string resourceUri, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); @@ -78,9 +78,9 @@ public async Task> ListAsync(string resourceUri, Cancellati { case 200: { - LinkerList value = default; + ResourceList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LinkerList.DeserializeLinkerList(document.RootElement); + value = ResourceList.DeserializeResourceList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -88,11 +88,11 @@ public async Task> ListAsync(string resourceUri, Cancellati } } - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The cancellation token to use. /// is null. - public Response List(string resourceUri, CancellationToken cancellationToken = default) + public Response List(string resourceUri, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); @@ -102,9 +102,9 @@ public Response List(string resourceUri, CancellationToken cancellat { case 200: { - LinkerList value = default; + ResourceList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LinkerList.DeserializeLinkerList(document.RootElement); + value = ResourceList.DeserializeResourceList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -234,7 +234,7 @@ internal HttpMessage CreateCreateOrUpdateRequest(string resourceUri, string link return message; } - /// Create or update linker resource. + /// Create or update Linker resource. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// Linker details. @@ -259,7 +259,7 @@ public async Task CreateOrUpdateAsync(string resourceUri, string linke } } - /// Create or update linker resource. + /// Create or update Linker resource. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// Linker details. @@ -314,7 +314,7 @@ internal HttpMessage CreateDeleteRequest(string resourceUri, string linkerName) return message; } - /// Delete a link. + /// Delete a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. @@ -338,7 +338,7 @@ public async Task DeleteAsync(string resourceUri, string linkerName, C } } - /// Delete a link. + /// Delete a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. @@ -362,7 +362,7 @@ public Response Delete(string resourceUri, string linkerName, CancellationToken } } - internal RequestUriBuilder CreateUpdateRequestUri(string resourceUri, string linkerName, LinkerResourcePatch patch) + internal RequestUriBuilder CreateUpdateRequestUri(string resourceUri, string linkerName, LinkerPatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -374,7 +374,7 @@ internal RequestUriBuilder CreateUpdateRequestUri(string resourceUri, string lin return uri; } - internal HttpMessage CreateUpdateRequest(string resourceUri, string linkerName, LinkerResourcePatch patch) + internal HttpMessage CreateUpdateRequest(string resourceUri, string linkerName, LinkerPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -396,14 +396,14 @@ internal HttpMessage CreateUpdateRequest(string resourceUri, string linkerName, return message; } - /// Operation to update an existing link. + /// Operation to update an existing Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// Linker details. /// The cancellation token to use. /// , or is null. /// is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string resourceUri, string linkerName, LinkerResourcePatch patch, CancellationToken cancellationToken = default) + public async Task UpdateAsync(string resourceUri, string linkerName, LinkerPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); @@ -421,14 +421,14 @@ public async Task UpdateAsync(string resourceUri, string linkerName, L } } - /// Operation to update an existing link. + /// Operation to update an existing Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// Linker details. /// The cancellation token to use. /// , or is null. /// is an empty string, and was expected to be non-empty. - public Response Update(string resourceUri, string linkerName, LinkerResourcePatch patch, CancellationToken cancellationToken = default) + public Response Update(string resourceUri, string linkerName, LinkerPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); @@ -478,7 +478,7 @@ internal HttpMessage CreateValidateRequest(string resourceUri, string linkerName return message; } - /// Validate a link. + /// Validate a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. @@ -501,7 +501,7 @@ public async Task ValidateAsync(string resourceUri, string linkerName, } } - /// Validate a link. + /// Validate a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. @@ -556,13 +556,13 @@ internal HttpMessage CreateListConfigurationsRequest(string resourceUri, string return message; } - /// list source configurations for a linker. + /// list source configurations for a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public async Task> ListConfigurationsAsync(string resourceUri, string linkerName, CancellationToken cancellationToken = default) + public async Task> ListConfigurationsAsync(string resourceUri, string linkerName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); @@ -573,9 +573,9 @@ public async Task> ListConfigurationsAsync(s { case 200: { - SourceConfigurationResult value = default; + ConfigurationResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = SourceConfigurationResult.DeserializeSourceConfigurationResult(document.RootElement); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -583,13 +583,13 @@ public async Task> ListConfigurationsAsync(s } } - /// list source configurations for a linker. + /// list source configurations for a Linker. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The name Linker resource. /// The cancellation token to use. /// or is null. /// is an empty string, and was expected to be non-empty. - public Response ListConfigurations(string resourceUri, string linkerName, CancellationToken cancellationToken = default) + public Response ListConfigurations(string resourceUri, string linkerName, CancellationToken cancellationToken = default) { Argument.AssertNotNull(resourceUri, nameof(resourceUri)); Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); @@ -600,9 +600,9 @@ public Response ListConfigurations(string resourceUri { case 200: { - SourceConfigurationResult value = default; + ConfigurationResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = SourceConfigurationResult.DeserializeSourceConfigurationResult(document.RootElement); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -632,12 +632,12 @@ internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceU return message; } - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// The URL to the next page of results. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The cancellation token to use. /// or is null. - public async Task> ListNextPageAsync(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + public async Task> ListNextPageAsync(string nextLink, string resourceUri, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNull(resourceUri, nameof(resourceUri)); @@ -648,9 +648,9 @@ public async Task> ListNextPageAsync(string nextLink, strin { case 200: { - LinkerList value = default; + ResourceList value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = LinkerList.DeserializeLinkerList(document.RootElement); + value = ResourceList.DeserializeResourceList(document.RootElement); return Response.FromValue(value, message.Response); } default: @@ -658,12 +658,12 @@ public async Task> ListNextPageAsync(string nextLink, strin } } - /// Returns list of Linkers which connects to the resource. + /// Returns list of Linkers which connects to the resource. which supports to config both application and target service during the resource provision. /// The URL to the next page of results. /// The fully qualified Azure Resource manager identifier of the resource to be connected. /// The cancellation token to use. /// or is null. - public Response ListNextPage(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + public Response ListNextPage(string nextLink, string resourceUri, CancellationToken cancellationToken = default) { Argument.AssertNotNull(nextLink, nameof(nextLink)); Argument.AssertNotNull(resourceUri, nameof(resourceUri)); @@ -674,9 +674,9 @@ public Response ListNextPage(string nextLink, string resourceUri, Ca { case 200: { - LinkerList value = default; + ResourceList value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); - value = LinkerList.DeserializeLinkerList(document.RootElement); + value = ResourceList.DeserializeResourceList(document.RootElement); return Response.FromValue(value, message.Response); } default: diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkersRestOperations.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkersRestOperations.cs new file mode 100644 index 000000000000..6368dd086914 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkersRestOperations.cs @@ -0,0 +1,766 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ServiceLinker.Models; + +namespace Azure.ResourceManager.ServiceLinker +{ + internal partial class LinkersRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of LinkersRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public LinkersRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-04-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListDryrunRequestUri(string resourceUri) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/dryruns", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListDryrunRequest(string resourceUri) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/dryruns", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// list dryrun jobs. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// is null. + public async Task> ListDryrunAsync(string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDryrunRequest(resourceUri); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// list dryrun jobs. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// is null. + public Response ListDryrun(string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDryrunRequest(resourceUri); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetDryrunRequestUri(string resourceUri, string dryrunName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetDryrunRequest(string resourceUri, string dryrunName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// get a dryrun job. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GetDryrunAsync(string resourceUri, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateGetDryrunRequest(resourceUri, dryrunName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DryrunResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// get a dryrun job. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response GetDryrun(string resourceUri, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateGetDryrunRequest(resourceUri, dryrunName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunResourceData.DeserializeDryrunResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DryrunResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateDryrunRequestUri(string resourceUri, string dryrunName, DryrunResourceData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateDryrunRequest(string resourceUri, string dryrunName, DryrunResourceData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// create a dryrun job to do necessary check before actual creation. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task CreateDryrunAsync(string resourceUri, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateDryrunRequest(resourceUri, dryrunName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// create a dryrun job to do necessary check before actual creation. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response CreateDryrun(string resourceUri, string dryrunName, DryrunResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateDryrunRequest(resourceUri, dryrunName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateDryrunRequestUri(string resourceUri, string dryrunName, DryrunPatch patch) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateDryrunRequest(string resourceUri, string dryrunName, DryrunPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// add a dryrun job to do necessary check before actual creation. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public async Task UpdateDryrunAsync(string resourceUri, string dryrunName, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateDryrunRequest(resourceUri, dryrunName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// add a dryrun job to do necessary check before actual creation. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// dryrun resource. + /// The cancellation token to use. + /// , or is null. + /// is an empty string, and was expected to be non-empty. + public Response UpdateDryrun(string resourceUri, string dryrunName, DryrunPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateDryrunRequest(resourceUri, dryrunName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteDryrunRequestUri(string resourceUri, string dryrunName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteDryrunRequest(string resourceUri, string dryrunName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/dryruns/", false); + uri.AppendPath(dryrunName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// delete a dryrun job. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task DeleteDryrunAsync(string resourceUri, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateDeleteDryrunRequest(resourceUri, dryrunName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// delete a dryrun job. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name of dryrun. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response DeleteDryrun(string resourceUri, string dryrunName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(dryrunName, nameof(dryrunName)); + + using var message = CreateDeleteDryrunRequest(resourceUri, dryrunName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGenerateConfigurationsRequestUri(string resourceUri, string linkerName, ConfigurationInfo info) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/linkers/", false); + uri.AppendPath(linkerName, true); + uri.AppendPath("/generateConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGenerateConfigurationsRequest(string resourceUri, string linkerName, ConfigurationInfo info) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/linkers/", false); + uri.AppendPath(linkerName, true); + uri.AppendPath("/generateConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (info != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(info, ModelSerializationExtensions.WireOptions); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Generate configurations for a Linker. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name Linker resource. + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GenerateConfigurationsAsync(string resourceUri, string linkerName, ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); + + using var message = CreateGenerateConfigurationsRequest(resourceUri, linkerName, info); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConfigurationResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Generate configurations for a Linker. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The name Linker resource. + /// Connection Info, including format, secret store, etc. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response GenerateConfigurations(string resourceUri, string linkerName, ConfigurationInfo info = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + Argument.AssertNotNullOrEmpty(linkerName, nameof(linkerName)); + + using var message = CreateGenerateConfigurationsRequest(resourceUri, linkerName, info); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConfigurationResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConfigurationResult.DeserializeConfigurationResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListDaprConfigurationsRequestUri(string resourceUri) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/daprConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListDaprConfigurationsRequest(string resourceUri) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ServiceLinker/daprConfigurations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the dapr configuration supported by Service Connector. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// is null. + public async Task> ListDaprConfigurationsAsync(string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDaprConfigurationsRequest(resourceUri); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DaprConfigurationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DaprConfigurationList.DeserializeDaprConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the dapr configuration supported by Service Connector. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// is null. + public Response ListDaprConfigurations(string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDaprConfigurationsRequest(resourceUri); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DaprConfigurationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DaprConfigurationList.DeserializeDaprConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListDryrunNextPageRequestUri(string nextLink, string resourceUri) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListDryrunNextPageRequest(string nextLink, string resourceUri) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// list dryrun jobs. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// or is null. + public async Task> ListDryrunNextPageAsync(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDryrunNextPageRequest(nextLink, resourceUri); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// list dryrun jobs. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// or is null. + public Response ListDryrunNextPage(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDryrunNextPageRequest(nextLink, resourceUri); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DryrunList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DryrunList.DeserializeDryrunList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListDaprConfigurationsNextPageRequestUri(string nextLink, string resourceUri) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListDaprConfigurationsNextPageRequest(string nextLink, string resourceUri) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List the dapr configuration supported by Service Connector. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// or is null. + public async Task> ListDaprConfigurationsNextPageAsync(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDaprConfigurationsNextPageRequest(nextLink, resourceUri); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DaprConfigurationList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DaprConfigurationList.DeserializeDaprConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List the dapr configuration supported by Service Connector. + /// The URL to the next page of results. + /// The fully qualified Azure Resource manager identifier of the resource to be connected. + /// The cancellation token to use. + /// or is null. + public Response ListDaprConfigurationsNextPage(string nextLink, string resourceUri, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListDaprConfigurationsNextPageRequest(nextLink, resourceUri); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DaprConfigurationList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DaprConfigurationList.DeserializeDaprConfigurationList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/autorest.md b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/autorest.md index 4ebbecf6d1f1..855e68692e05 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/autorest.md +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true csharp: true library-name: ServiceLinker namespace: Azure.ResourceManager.ServiceLinker -require: https://github.com/Azure/azure-rest-api-specs/blob/42ca0236ef14093f5aff0694efa34d5594e814a0/specification/servicelinker/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/servicelinker/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: