From 21ec94446d7f93a0f358eaafe6209cf2ccf7d6a5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 22 Apr 2024 07:42:52 +0000 Subject: [PATCH] CodeGen from PR 3274 in test-repo-billy/azure-rest-api-specs Merge 9bc05e2c1810d4d58ab37ed52635c8cabfb51a66 into 9bcccc7cbd85cb42446d8ceed87913d9a1f89764 --- .../Samples/Sample_DryrunCollection.cs | 206 +++ .../Samples/Sample_DryrunResource.cs | 126 ++ ...llection.cs => Sample_LinkerCollection.cs} | 133 +- .../Samples/Sample_LinkerResource.cs | 81 +- .../Sample_LocationConnectorCollection.cs | 216 +++ .../Sample_LocationConnectorResource.cs | 186 +++ .../Sample_LocationDryrunCollection.cs | 222 ++++ .../Samples/Sample_LocationDryrunResource.cs | 132 ++ .../Sample_TenantResourceExtensions.cs | 46 + .../Generated/ArmServiceLinkerModelFactory.cs | 168 ++- .../src/Generated/DryrunCollection.cs | 405 ++++++ .../src/Generated/DryrunResource.cs | 300 +++++ .../src/Generated/DryrunResourceData.cs | 70 + .../MockableServiceLinkerArmClient.cs | 164 ++- .../MockableServiceLinkerArmResource.cs | 12 +- ...kableServiceLinkerResourceGroupResource.cs | 151 +++ .../MockableServiceLinkerTenantResource.cs | 94 ++ .../Extensions/ServiceLinkerExtensions.cs | 461 ++++++- ...ourceCollection.cs => LinkerCollection.cs} | 78 +- .../src/Generated/LinkerResource.cs | 157 ++- .../src/Generated/LinkerResourceData.cs | 46 +- .../Generated/LocationConnectorCollection.cs | 419 ++++++ .../Generated/LocationConnectorResource.cs | 433 ++++++ .../src/Generated/LocationDryrunCollection.cs | 419 ++++++ .../src/Generated/LocationDryrunResource.cs | 303 +++++ .../DryrunOperationSource.cs | 40 + ...tionSource.cs => LinkerOperationSource.cs} | 4 +- .../LocationConnectorOperationSource.cs | 40 + .../LocationDryrunOperationSource.cs | 40 + .../Models/AccessKeyInfoBase.Serialization.cs | 82 ++ .../src/Generated/Models/AccessKeyInfoBase.cs | 36 + .../Generated/Models/AccessKeyPermission.cs | 60 + .../src/Generated/Models/ActionType.cs | 54 + .../src/Generated/Models/AllowType.cs | 51 + .../Models/AuthBaseInfo.Serialization.cs | 8 + .../src/Generated/Models/AuthBaseInfo.cs | 8 +- .../src/Generated/Models/AuthMode.cs | 51 + ...rDryrunPrerequisiteResult.Serialization.cs | 45 + .../BasicErrorDryrunPrerequisiteResult.cs | 35 + .../Models/ConfigurationInfo.Serialization.cs | 180 +++ .../src/Generated/Models/ConfigurationInfo.cs | 69 + .../Models/ConfigurationName.Serialization.cs | 49 + .../src/Generated/Models/ConfigurationName.cs | 36 + .../ConfigurationNameItem.Serialization.cs | 111 ++ .../Generated/Models/ConfigurationNameItem.cs | 52 + .../ConfigurationNameResult.Serialization.cs | 49 + .../Models/ConfigurationNameResult.cs | 36 + ...s => ConfigurationResult.Serialization.cs} | 6 +- ...rationResult.cs => ConfigurationResult.cs} | 10 +- .../ConfigurationStore.Serialization.cs | 56 + .../Generated/Models/ConfigurationStore.cs | 28 + ...eOrUpdateDryrunParameters.Serialization.cs | 207 +++ .../Models/CreateOrUpdateDryrunParameters.cs | 79 ++ .../Models/DaprBindingComponentDirection.cs | 51 + .../DaprConfigurationList.Serialization.cs | 49 + .../Generated/Models/DaprConfigurationList.cs | 36 + ...DaprConfigurationResource.Serialization.cs | 65 + .../Models/DaprConfigurationResource.cs | 36 + .../Models/DaprMetadata.Serialization.cs | 92 ++ .../src/Generated/Models/DaprMetadata.cs | 44 + .../Generated/Models/DaprMetadataRequired.cs | 51 + .../Models/DaprProperties.Serialization.cs | 175 +++ .../src/Generated/Models/DaprProperties.cs | 57 + .../Models/DeleteOrUpdateBehavior.cs | 51 + .../src/Generated/Models/DryrunActionName.cs | 48 + .../Models/DryrunList.Serialization.cs | 55 + .../src/Generated/Models/DryrunList.cs | 37 + .../DryrunOperationPreview.Serialization.cs | 61 + .../Models/DryrunOperationPreview.cs | 44 + .../Models/DryrunParameters.Serialization.cs | 39 + .../src/Generated/Models/DryrunParameters.cs | 32 + .../Models/DryrunPatch.Serialization.cs | 29 + .../src/Generated/Models/DryrunPatch.cs | 61 + .../DryrunPrerequisiteResult.Serialization.cs | 31 + .../Models/DryrunPrerequisiteResult.cs | 32 + .../Models/DryrunPrerequisiteResultType.cs | 51 + .../Models/DryrunPreviewOperationType.cs | 54 + .../DryrunResourceData.Serialization.cs | 130 ++ ...hMicrosoftEntraIdAuthInfo.Serialization.cs | 93 ++ .../EasyAuthMicrosoftEntraIdAuthInfo.cs | 40 + .../Models/FirewallRules.Serialization.cs | 89 ++ .../src/Generated/Models/FirewallRules.cs | 40 + .../src/Generated/Models/LinkerAuthType.cs | 9 + .../src/Generated/Models/LinkerClientType.cs | 9 + .../Models/LinkerConfigurationType.cs | 51 + ...zation.cs => LinkerPatch.Serialization.cs} | 26 +- ...{LinkerResourcePatch.cs => LinkerPatch.cs} | 58 +- .../LinkerResourceData.Serialization.cs | 48 +- .../Models/LinkerSecretStore.Serialization.cs | 27 +- .../src/Generated/Models/LinkerSecretStore.cs | 8 +- .../Models/LinkerValidateOperationResult.cs | 10 +- .../Models/LinkerValidationResultItemInfo.cs | 2 +- ...gDryrunPrerequisiteResult.Serialization.cs | 61 + ...missionsMissingDryrunPrerequisiteResult.cs | 43 + .../PublicNetworkSolution.Serialization.cs | 78 ++ .../Generated/Models/PublicNetworkSolution.cs | 36 + ...ation.cs => ResourceList.Serialization.cs} | 6 +- .../Models/{LinkerList.cs => ResourceList.cs} | 14 +- .../Models/SecretAuthInfo.Serialization.cs | 17 +- .../src/Generated/Models/SecretAuthInfo.cs | 3 +- .../src/Generated/Models/SecretSourceType.cs | 51 + .../Models/SelfHostedServer.Serialization.cs | 52 + .../src/Generated/Models/SelfHostedServer.cs | 31 + ...ncipalCertificateAuthInfo.Serialization.cs | 58 +- .../ServicePrincipalCertificateAuthInfo.cs | 13 +- ...cePrincipalSecretAuthInfo.Serialization.cs | 81 +- .../Models/ServicePrincipalSecretAuthInfo.cs | 17 +- .../SourceConfiguration.Serialization.cs | 34 +- .../Generated/Models/SourceConfiguration.cs | 14 +- ...mAssignedIdentityAuthInfo.Serialization.cs | 81 +- .../Models/SystemAssignedIdentityAuthInfo.cs | 20 +- .../TargetServiceBaseInfo.Serialization.cs | 1 + .../Generated/Models/TargetServiceBaseInfo.cs | 2 +- .../src/Generated/Models/TargetServiceType.cs | 3 + .../UnknownAuthInfoBase.Serialization.cs | 17 +- .../Generated/Models/UnknownAuthInfoBase.cs | 3 +- .../UnknownDryrunParameters.Serialization.cs | 41 + .../Models/UnknownDryrunParameters.cs | 20 + ...nDryrunPrerequisiteResult.Serialization.cs | 32 + .../Models/UnknownDryrunPrerequisiteResult.cs | 20 + .../UserAccountAuthInfo.Serialization.cs | 136 ++ .../Generated/Models/UserAccountAuthInfo.cs | 49 + ...rAssignedIdentityAuthInfo.Serialization.cs | 81 +- .../Models/UserAssignedIdentityAuthInfo.cs | 19 +- .../Models/VnetSolution.Serialization.cs | 19 +- .../src/Generated/Models/VnetSolution.cs | 8 +- .../ConfigurationNamesRestOperations.cs | 173 +++ .../RestOperations/ConnectorRestOperations.cs | 1159 +++++++++++++++++ .../RestOperations/LinkerRestOperations.cs | 72 +- .../RestOperations/LinkersRestOperations.cs | 668 ++++++++++ .../src/autorest.md | 2 +- 131 files changed, 11285 insertions(+), 421 deletions(-) create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_DryrunCollection.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_DryrunResource.cs rename sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/{Sample_LinkerResourceCollection.cs => Sample_LinkerCollection.cs} (58%) create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationConnectorCollection.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationConnectorResource.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationDryrunCollection.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationDryrunResource.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_TenantResourceExtensions.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunCollection.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerResourceGroupResource.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerTenantResource.cs rename sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/{LinkerResourceCollection.cs => LinkerCollection.cs} (80%) create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorCollection.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunCollection.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/DryrunOperationSource.cs rename sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/{LinkerResourceOperationSource.cs => LinkerOperationSource.cs} (89%) create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationConnectorOperationSource.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationDryrunOperationSource.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyPermission.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ActionType.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AllowType.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthMode.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.cs rename sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/{SourceConfigurationResult.Serialization.cs => ConfigurationResult.Serialization.cs} (83%) rename sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/{SourceConfigurationResult.cs => ConfigurationResult.cs} (66%) create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationStore.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationStore.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprBindingComponentDirection.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationList.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationList.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationResource.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationResource.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadata.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadata.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadataRequired.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprProperties.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprProperties.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DeleteOrUpdateBehavior.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunActionName.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResultType.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPreviewOperationType.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunResourceData.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/EasyAuthMicrosoftEntraIdAuthInfo.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/EasyAuthMicrosoftEntraIdAuthInfo.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerConfigurationType.cs rename sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/{LinkerResourcePatch.Serialization.cs => LinkerPatch.Serialization.cs} (71%) rename sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/{LinkerResourcePatch.cs => LinkerPatch.cs} (57%) create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.cs rename sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/{LinkerList.Serialization.cs => ResourceList.Serialization.cs} (89%) rename sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/{LinkerList.cs => ResourceList.cs} (58%) create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretSourceType.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.Serialization.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConfigurationNamesRestOperations.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConnectorRestOperations.cs create mode 100644 sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkersRestOperations.cs 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..d95755d11f7f --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_DryrunCollection.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceLinker; +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..a0f00cedde7c --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_DryrunResource.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceLinker; +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 18f88b4a938b..d361980c6f5f 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 @@ -16,14 +16,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 @@ -37,7 +37,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()) @@ -52,12 +52,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 @@ -71,7 +71,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"; @@ -84,12 +84,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 @@ -103,7 +103,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"; @@ -112,12 +112,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 @@ -131,7 +131,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"; @@ -152,12 +152,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 @@ -171,7 +171,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"; @@ -189,97 +189,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 8a7facd9a45f..d8697efab995 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 @@ -18,12 +18,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 @@ -36,10 +36,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 @@ -48,12 +48,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 @@ -66,20 +66,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 @@ -92,10 +92,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() { @@ -103,7 +103,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 @@ -113,12 +113,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 @@ -131,10 +131,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}"); @@ -145,7 +145,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 @@ -153,15 +153,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..6b201161ad24 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationConnectorCollection.cs @@ -0,0 +1,216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceLinker; +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..6e6dbf3dace7 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationConnectorResource.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceLinker; +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..e679a907e2b2 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationDryrunCollection.cs @@ -0,0 +1,222 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.ServiceLinker; +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..4acc5b4591ff --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_LocationDryrunResource.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceLinker; +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..b2fd8b05a96a --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/samples/Generated/Samples/Sample_TenantResourceExtensions.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceLinker; +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 f1c362037067..8129341ba2c9 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/ArmServiceLinkerModelFactory.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/ArmServiceLinkerModelFactory.cs @@ -17,6 +17,44 @@ 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); + } + + /// 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); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -25,32 +63,51 @@ 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, name, resourceType, systemData, targetService, authInfo, clientType, provisioningState, vnetSolution, secretStore, scope, publicNetworkSolution, configurationInfo); + } + + /// 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) { - return new LinkerResourceData(id, name, resourceType, systemData, targetService, authInfo, clientType, provisioningState, solutionType != null ? new VnetSolution(solutionType) : null, secretStoreKeyVaultId != null ? new LinkerSecretStore(secretStoreKeyVaultId) : null, scope); + metadata ??= new List(); + scopes ??= new List(); + + return new DaprProperties(version, componentType, secretStoreComponent, metadata?.ToList(), scopes?.ToList(), runtimeVersion, bindingComponentDirection); } /// 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. @@ -74,23 +131,106 @@ public static LinkerValidationResultItemInfo LinkerValidationResultItemInfo(stri return new LinkerValidationResultItemInfo(name, description, result, errorMessage, errorCode); } - /// 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()); + return new ConfigurationResult(configurations?.ToList()); } /// 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); + } + + /// 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()); + } + + /// 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 SourceConfiguration(name, value); + return new ConfigurationName(value, description, required); + } + + /// 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); + } + + /// 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, 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, 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, scope, permissions?.ToList(), recommendedRole); } } } 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..5f05dfcfc58a --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunCollection.cs @@ -0,0 +1,405 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.cs new file mode 100644 index 000000000000..1a8a25db5a5a --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResource.cs @@ -0,0 +1,300 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 operation = new ServiceLinkerArmOperation(response); + 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 + /// + /// + /// + /// 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 operation = new ServiceLinkerArmOperation(response); + 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.cs new file mode 100644 index 000000000000..42571cbfca5e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/DryrunResourceData.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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 + { + /// 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. + internal DryrunResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DryrunParameters parameters, IReadOnlyList prerequisiteResults, IReadOnlyList operationPreviews, string provisioningState) : base(id, name, resourceType, systemData) + { + Parameters = parameters; + PrerequisiteResults = prerequisiteResults; + OperationPreviews = operationPreviews; + ProvisioningState = provisioningState; + } + + /// + /// 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 665d04de6701..a9ce57f67e07 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmClient.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmClient.cs @@ -8,16 +8,22 @@ using System; using System.Threading; using System.Threading.Tasks; +using Autorest.CSharp.Core; using Azure; using Azure.Core; +using Azure.Core.Pipeline; using Azure.ResourceManager; using Azure.ResourceManager.ServiceLinker; +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() { @@ -34,18 +40,77 @@ 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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); } /// @@ -67,9 +132,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); } /// @@ -91,9 +156,96 @@ 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 + /// + /// + /// + /// 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, DaprConfigurationResource.DeserializeDaprConfigurationResource, 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 + /// + /// + /// + /// 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, DaprConfigurationResource.DeserializeDaprConfigurationResource, 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 329fcb51f95d..762cedc4b429 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmResource.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerArmResource.cs @@ -38,9 +38,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)); } /// @@ -61,9 +61,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,9 +84,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..4011c0254f3a --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerResourceGroupResource.cs @@ -0,0 +1,151 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceLinker; + +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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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..bb9e6cc0ff8e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/MockableServiceLinkerTenantResource.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ServiceLinker; +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 + /// + /// + /// + /// 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, ConfigurationNameItem.DeserializeConfigurationNameItem, 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 + /// + /// + /// + /// 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, ConfigurationNameItem.DeserializeConfigurationNameItem, 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 3e504a9b880a..79a198373c0d 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Extensions/ServiceLinkerExtensions.cs @@ -11,7 +11,9 @@ using Azure; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Resources; using Azure.ResourceManager.ServiceLinker.Mocking; +using Azure.ResourceManager.ServiceLinker.Models; namespace Azure.ResourceManager.ServiceLinker { @@ -28,22 +30,112 @@ 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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); } /// @@ -60,7 +152,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. @@ -70,11 +162,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); } /// @@ -91,7 +183,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. @@ -101,11 +193,124 @@ 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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); } /// @@ -131,17 +336,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(); } /// @@ -158,7 +363,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. @@ -167,11 +372,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); } /// @@ -188,7 +393,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. @@ -197,11 +402,231 @@ 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 c338c85a6b37..b7c66c6d3285 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceCollection.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerCollection.cs @@ -21,30 +21,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 @@ -67,12 +67,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; @@ -85,7 +85,7 @@ public virtual async Task> CreateOrUpdateAsync(Wait } /// - /// Create or update linker resource. + /// Create or update Linker resource. /// /// /// Request Path @@ -108,12 +108,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; @@ -146,11 +146,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()); @@ -183,11 +183,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()); @@ -200,7 +200,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 @@ -216,13 +216,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 @@ -238,9 +238,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); } /// @@ -264,11 +264,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) @@ -299,11 +299,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) @@ -334,11 +334,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()); @@ -371,11 +371,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 049190ec6448..cf40509316a3 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResource.cs @@ -18,10 +18,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 { @@ -34,8 +34,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. @@ -60,9 +62,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 @@ -105,11 +110,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()); @@ -137,11 +142,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()); @@ -154,7 +159,7 @@ public virtual Response Get(CancellationToken cancellationToken } /// - /// Delete a link. + /// Delete a Linker. /// /// /// Request Path @@ -170,12 +175,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; @@ -188,7 +193,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell } /// - /// Delete a link. + /// Delete a Linker. /// /// /// Request Path @@ -204,12 +209,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; @@ -222,7 +227,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel } /// - /// Operation to update an existing link. + /// Operation to update an existing Linker. /// /// /// Request Path @@ -238,16 +243,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; @@ -260,7 +265,7 @@ public virtual async Task> UpdateAsync(WaitUntil wa } /// - /// Operation to update an existing link. + /// Operation to update an existing Linker. /// /// /// Request Path @@ -276,16 +281,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; @@ -298,7 +303,7 @@ public virtual ArmOperation Update(WaitUntil waitUntil, LinkerRe } /// - /// Validate a link. + /// Validate a Linker. /// /// /// Request Path @@ -314,12 +319,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; @@ -332,7 +337,7 @@ public virtual async Task> ValidateA } /// - /// Validate a link. + /// Validate a Linker. /// /// /// Request Path @@ -348,12 +353,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; @@ -366,7 +371,7 @@ public virtual ArmOperation Validate(WaitUntil wa } /// - /// list source configurations for a linker. + /// list source configurations for a Linker. /// /// /// Request Path @@ -379,13 +384,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) @@ -396,7 +401,7 @@ public virtual async Task> GetConfigurations } /// - /// list source configurations for a linker. + /// list source configurations for a Linker. /// /// /// Request Path @@ -409,13 +414,75 @@ 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs index 5484996a901f..8db88da7a033 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LinkerResourceData.cs @@ -30,19 +30,21 @@ 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. - internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope) : base(id, name, resourceType, systemData) + /// The network solution. + /// The connection information consumed by applications, including secrets, connection strings. + 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) : base(id, name, resourceType, systemData) { TargetService = targetService; AuthInfo = authInfo; @@ -51,18 +53,20 @@ internal LinkerResourceData(ResourceIdentifier id, string name, ResourceType res VnetSolution = vnetSolution; SecretStore = secretStore; Scope = scope; + PublicNetworkSolution = publicNetworkSolution; + ConfigurationInfo = configurationInfo; } /// /// 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. @@ -70,34 +74,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..9ea173f4b4c9 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorCollection.cs @@ -0,0 +1,419 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.cs new file mode 100644 index 000000000000..c04114e8c559 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationConnectorResource.cs @@ -0,0 +1,433 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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..23981dd8cf68 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunCollection.cs @@ -0,0 +1,419 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.cs new file mode 100644 index 000000000000..9308a3d8baa0 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LocationDryrunResource.cs @@ -0,0 +1,303 @@ +// 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; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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 operation = new ServiceLinkerArmOperation(response); + 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 + /// + /// + /// + /// 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 operation = new ServiceLinkerArmOperation(response); + 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 + /// + /// + /// + /// 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 + /// + /// + /// + /// 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..a049e24ba031 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/DryrunOperationSource.cs @@ -0,0 +1,40 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; + +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 8a16516e879d..f7b8de0b9c72 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerResourceOperationSource.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LinkerOperationSource.cs @@ -14,11 +14,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..3ed6e607707e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationConnectorOperationSource.cs @@ -0,0 +1,40 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; + +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..ffafdb078fdf --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/LongRunningOperation/LocationDryrunOperationSource.cs @@ -0,0 +1,40 @@ +// 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; +using Azure.Core; +using Azure.ResourceManager; + +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..853feb64b3df --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.Serialization.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class AccessKeyInfoBase : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + 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()); + } + writer.WriteEndObject(); + } + + internal static AccessKeyInfoBase DeserializeAccessKeyInfoBase(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> permissions = default; + LinkerAuthType authType = default; + Optional authMode = default; + 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; + } + } + return new AccessKeyInfoBase(authType, Optional.ToNullable(authMode), Optional.ToList(permissions)); + } + } +} 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..9cf4aa7cedc3 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AccessKeyInfoBase.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +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. + /// 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, IList permissions) : base(authType, authMode) + { + 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 558b45b388d8..386a6205e45a 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 @@ -17,6 +17,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("authType"u8); writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } writer.WriteEndObject(); } @@ -30,10 +35,13 @@ internal static AuthBaseInfo DeserializeAuthBaseInfo(JsonElement element) { switch (discriminator.GetString()) { + case "accessKey": return AccessKeyInfoBase.DeserializeAccessKeyInfoBase(element); + case "easyAuthMicrosoftEntraID": return EasyAuthMicrosoftEntraIdAuthInfo.DeserializeEasyAuthMicrosoftEntraIdAuthInfo(element); case "secret": return SecretAuthInfo.DeserializeSecretAuthInfo(element); case "servicePrincipalCertificate": return ServicePrincipalCertificateAuthInfo.DeserializeServicePrincipalCertificateAuthInfo(element); case "servicePrincipalSecret": return ServicePrincipalSecretAuthInfo.DeserializeServicePrincipalSecretAuthInfo(element); case "systemAssignedIdentity": return SystemAssignedIdentityAuthInfo.DeserializeSystemAssignedIdentityAuthInfo(element); + case "userAccount": return UserAccountAuthInfo.DeserializeUserAccountAuthInfo(element); case "userAssignedIdentity": return UserAssignedIdentityAuthInfo.DeserializeUserAssignedIdentityAuthInfo(element); } } 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 a692b326d598..66d4f49079e2 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/AuthBaseInfo.cs @@ -10,7 +10,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 { @@ -21,12 +21,16 @@ protected AuthBaseInfo() /// Initializes a new instance of . /// The authentication type. - internal AuthBaseInfo(LinkerAuthType authType) + /// 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. + internal AuthBaseInfo(LinkerAuthType authType, AuthMode? authMode) { AuthType = authType; + AuthMode = authMode; } /// 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..e1a925325555 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class BasicErrorDryrunPrerequisiteResult + { + internal static BasicErrorDryrunPrerequisiteResult DeserializeBasicErrorDryrunPrerequisiteResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional code = default; + Optional message = default; + DryrunPrerequisiteResultType type = default; + 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; + } + } + return new BasicErrorDryrunPrerequisiteResult(type, code.Value, message.Value); + } + } +} 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..7a2fc5239eee --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/BasicErrorDryrunPrerequisiteResult.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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. + /// The error code. + /// The error message. + internal BasicErrorDryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType, string code, string message) : base(resultType) + { + 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..1f5a50c25dd3 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class ConfigurationInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + 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); + } + 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); + } + else + { + writer.WriteNull("configurationStore"); + } + } + writer.WriteEndObject(); + } + + internal static ConfigurationInfo DeserializeConfigurationInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional deleteOrUpdateBehavior = default; + Optional action = default; + Optional> customizedKeys = default; + Optional daprProperties = default; + Optional> additionalConfigurations = default; + Optional> additionalConnectionStringProperties = default; + Optional configurationStore = default; + 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); + 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); + continue; + } + } + return new ConfigurationInfo(Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToNullable(action), Optional.ToDictionary(customizedKeys), daprProperties.Value, Optional.ToDictionary(additionalConfigurations), Optional.ToDictionary(additionalConnectionStringProperties), configurationStore.Value); + } + } +} 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..79ae125ae3b3 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationInfo.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The configuration information, used to generate configurations or save to applications. + public partial class ConfigurationInfo + { + /// 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. + internal ConfigurationInfo(DeleteOrUpdateBehavior? deleteOrUpdateBehavior, ActionType? action, IDictionary customizedKeys, DaprProperties daprProperties, IDictionary additionalConfigurations, IDictionary additionalConnectionStringProperties, ConfigurationStore configurationStore) + { + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Action = action; + CustomizedKeys = customizedKeys; + DaprProperties = daprProperties; + AdditionalConfigurations = additionalConfigurations; + AdditionalConnectionStringProperties = additionalConnectionStringProperties; + ConfigurationStore = configurationStore; + } + + /// 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..9a467ff68d2d --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class ConfigurationName + { + internal static ConfigurationName DeserializeConfigurationName(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + Optional description = default; + Optional required = default; + 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; + } + } + return new ConfigurationName(value.Value, description.Value, Optional.ToNullable(required)); + } + } +} 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..d643c8cc54b1 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationName.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The configuration names. + public partial class ConfigurationName + { + /// Initializes a new instance of . + internal ConfigurationName() + { + } + + /// Initializes a new instance of . + /// + /// Description for the configuration name. + /// Represent the configuration is required or not. + internal ConfigurationName(string value, string description, bool? required) + { + Value = value; + Description = description; + Required = required; + } + + /// 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..170c4b885cf1 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.Serialization.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class ConfigurationNameItem + { + internal static ConfigurationNameItem DeserializeConfigurationNameItem(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional targetService = default; + Optional clientType = default; + Optional authType = default; + Optional secretType = default; + Optional daprProperties = default; + Optional> names = default; + 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); + 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)); + } + names = array; + continue; + } + } + continue; + } + } + return new ConfigurationNameItem(targetService.Value, Optional.ToNullable(clientType), Optional.ToNullable(authType), Optional.ToNullable(secretType), daprProperties.Value, Optional.ToList(names)); + } + } +} 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..7cecd1ec5617 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameItem.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The ConfigurationNameItem. + public partial class ConfigurationNameItem + { + /// 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. + internal ConfigurationNameItem(string targetService, LinkerClientType? clientType, LinkerAuthType? authType, SecretSourceType? secretType, DaprProperties daprProperties, IReadOnlyList names) + { + TargetService = targetService; + ClientType = clientType; + AuthType = authType; + SecretType = secretType; + DaprProperties = daprProperties; + Names = names; + } + + /// 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..549b472492ed --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class ConfigurationNameResult + { + internal static ConfigurationNameResult DeserializeConfigurationNameResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + 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)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ConfigurationNameResult(Optional.ToList(value), nextLink.Value); + } + } +} 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..c23861f4c830 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationNameResult.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +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 + { + /// 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. + internal ConfigurationNameResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// 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 83% 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 a8cf325da252..bd52e367624e 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 @@ -11,9 +11,9 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - public partial class SourceConfigurationResult + public partial class ConfigurationResult { - internal static SourceConfigurationResult DeserializeSourceConfigurationResult(JsonElement element) + internal static ConfigurationResult DeserializeConfigurationResult(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -37,7 +37,7 @@ internal static SourceConfigurationResult DeserializeSourceConfigurationResult(J continue; } } - return new SourceConfigurationResult(Optional.ToList(configurations)); + return new ConfigurationResult(Optional.ToList(configurations)); } } } 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 66% 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 dea436b75c01..4a32e38fd7d9 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfigurationResult.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationResult.cs @@ -11,17 +11,17 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// Configurations for source resource, include appSettings, connectionString and serviceBindings. - public partial class SourceConfigurationResult + public partial class ConfigurationResult { - /// 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. - internal SourceConfigurationResult(IReadOnlyList configurations) + internal ConfigurationResult(IReadOnlyList configurations) { Configurations = configurations; } 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..9a7576ae8d21 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationStore.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class ConfigurationStore : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AppConfigurationId)) + { + if (AppConfigurationId != null) + { + writer.WritePropertyName("appConfigurationId"u8); + writer.WriteStringValue(AppConfigurationId); + } + else + { + writer.WriteNull("appConfigurationId"); + } + } + writer.WriteEndObject(); + } + + internal static ConfigurationStore DeserializeConfigurationStore(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional appConfigurationId = default; + 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; + } + } + return new ConfigurationStore(appConfigurationId.Value); + } + } +} 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..abb65c3124d1 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ConfigurationStore.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// An option to store configuration into different place. + internal partial class ConfigurationStore + { + /// Initializes a new instance of . + public ConfigurationStore() + { + } + + /// Initializes a new instance of . + /// The app configuration id to store configuration. + internal ConfigurationStore(string appConfigurationId) + { + AppConfigurationId = appConfigurationId; + } + + /// 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..28ed5de4b575 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.Serialization.cs @@ -0,0 +1,207 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class CreateOrUpdateDryrunParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(TargetService)) + { + writer.WritePropertyName("targetService"u8); + writer.WriteObjectValue(TargetService); + } + if (Optional.IsDefined(AuthInfo)) + { + writer.WritePropertyName("authInfo"u8); + writer.WriteObjectValue(AuthInfo); + } + if (Optional.IsDefined(ClientType)) + { + writer.WritePropertyName("clientType"u8); + writer.WriteStringValue(ClientType.Value.ToString()); + } + if (Optional.IsDefined(VnetSolution)) + { + if (VnetSolution != null) + { + writer.WritePropertyName("vNetSolution"u8); + writer.WriteObjectValue(VnetSolution); + } + else + { + writer.WriteNull("vNetSolution"); + } + } + if (Optional.IsDefined(SecretStore)) + { + if (SecretStore != null) + { + writer.WritePropertyName("secretStore"u8); + writer.WriteObjectValue(SecretStore); + } + 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); + } + else + { + writer.WriteNull("publicNetworkSolution"); + } + } + if (Optional.IsDefined(ConfigurationInfo)) + { + if (ConfigurationInfo != null) + { + writer.WritePropertyName("configurationInfo"u8); + writer.WriteObjectValue(ConfigurationInfo); + } + else + { + writer.WriteNull("configurationInfo"); + } + } + writer.WritePropertyName("actionName"u8); + writer.WriteStringValue(ActionName.ToString()); + writer.WriteEndObject(); + } + + internal static CreateOrUpdateDryrunParameters DeserializeCreateOrUpdateDryrunParameters(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional targetService = default; + Optional authInfo = default; + Optional clientType = default; + Optional provisioningState = default; + Optional vnetSolution = default; + Optional secretStore = default; + Optional scope = default; + Optional publicNetworkSolution = default; + Optional configurationInfo = default; + DryrunActionName actionName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("targetService"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + targetService = TargetServiceBaseInfo.DeserializeTargetServiceBaseInfo(property.Value); + continue; + } + if (property.NameEquals("authInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + authInfo = AuthBaseInfo.DeserializeAuthBaseInfo(property.Value); + 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); + continue; + } + if (property.NameEquals("secretStore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + secretStore = null; + continue; + } + secretStore = LinkerSecretStore.DeserializeLinkerSecretStore(property.Value); + 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); + continue; + } + if (property.NameEquals("configurationInfo"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + configurationInfo = null; + continue; + } + configurationInfo = ConfigurationInfo.DeserializeConfigurationInfo(property.Value); + continue; + } + if (property.NameEquals("actionName"u8)) + { + actionName = new DryrunActionName(property.Value.GetString()); + continue; + } + } + return new CreateOrUpdateDryrunParameters(actionName, targetService.Value, authInfo.Value, Optional.ToNullable(clientType), provisioningState.Value, vnetSolution.Value, secretStore.Value, scope.Value, publicNetworkSolution.Value, configurationInfo.Value); + } + } +} 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..276df3e49024 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/CreateOrUpdateDryrunParameters.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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. + /// + /// 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, TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope, PublicNetworkSolution publicNetworkSolution, ConfigurationInfo configurationInfo) : base(actionName) + { + 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..ec9f6882d0e2 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationList.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class DaprConfigurationList + { + internal static DaprConfigurationList DeserializeDaprConfigurationList(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + 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)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DaprConfigurationList(Optional.ToList(value), nextLink.Value); + } + } +} 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..52cac67dbc31 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Dapr configuration list supported by Service Connector. + internal partial class DaprConfigurationList + { + /// 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. + internal DaprConfigurationList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// 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..ab0713ebfb4e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationResource.Serialization.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DaprConfigurationResource + { + internal static DaprConfigurationResource DeserializeDaprConfigurationResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional targetType = default; + Optional authType = default; + Optional daprProperties = default; + 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); + continue; + } + } + continue; + } + } + return new DaprConfigurationResource(targetType.Value, Optional.ToNullable(authType), daprProperties.Value); + } + } +} 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..a7fefe921fe7 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprConfigurationResource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Represent one resource of the dapr configuration list. + public partial class DaprConfigurationResource + { + /// 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. + internal DaprConfigurationResource(string targetType, LinkerAuthType? authType, DaprProperties daprProperties) + { + TargetType = targetType; + AuthType = authType; + DaprProperties = daprProperties; + } + + /// 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..eadd925ff8f3 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadata.Serialization.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DaprMetadata : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + 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()); + } + writer.WriteEndObject(); + } + + internal static DaprMetadata DeserializeDaprMetadata(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional value = default; + Optional secretRef = default; + Optional description = default; + Optional required = default; + 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; + } + } + return new DaprMetadata(name.Value, value.Value, secretRef.Value, description.Value, Optional.ToNullable(required)); + } + } +} 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..7369b020066b --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprMetadata.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The dapr component metadata. + public partial class DaprMetadata + { + /// 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. + internal DaprMetadata(string name, string value, string secretRef, string description, DaprMetadataRequired? required) + { + Name = name; + Value = value; + SecretRef = secretRef; + Description = description; + Required = required; + } + + /// 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..629544e51e97 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprProperties.Serialization.cs @@ -0,0 +1,175 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DaprProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + 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); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Scopes)) + { + writer.WritePropertyName("scopes"u8); + writer.WriteStartArray(); + foreach (var item in Scopes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static DaprProperties DeserializeDaprProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional version = default; + Optional componentType = default; + Optional secretStoreComponent = default; + Optional> metadata = default; + Optional> scopes = default; + Optional runtimeVersion = default; + Optional bindingComponentDirection = default; + 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)); + } + 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; + } + } + return new DaprProperties(version.Value, componentType.Value, secretStoreComponent.Value, Optional.ToList(metadata), Optional.ToList(scopes), runtimeVersion.Value, Optional.ToNullable(bindingComponentDirection)); + } + } +} 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..7562d93c5047 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DaprProperties.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Indicates some additional properties for dapr client type. + public partial class DaprProperties + { + /// 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. + internal DaprProperties(string version, string componentType, string secretStoreComponent, IList metadata, IList scopes, string runtimeVersion, DaprBindingComponentDirection? bindingComponentDirection) + { + Version = version; + ComponentType = componentType; + SecretStoreComponent = secretStoreComponent; + Metadata = metadata; + Scopes = scopes; + RuntimeVersion = runtimeVersion; + BindingComponentDirection = bindingComponentDirection; + } + + /// 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/DryrunList.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.Serialization.cs new file mode 100644 index 000000000000..bf5ecbad459d --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ServiceLinker; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class DryrunList + { + internal static DryrunList DeserializeDryrunList(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nextLink = default; + Optional> value = default; + 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(DryrunResourceData.DeserializeDryrunResourceData(item)); + } + value = array; + continue; + } + } + return new DryrunList(nextLink.Value, Optional.ToList(value)); + } + } +} 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..6213fcfa614e --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunList.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ServiceLinker; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The list of dryrun. + internal partial class DryrunList + { + /// 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. + internal DryrunList(string nextLink, IReadOnlyList value) + { + NextLink = nextLink; + Value = value; + } + + /// 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..992ad5429583 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DryrunOperationPreview + { + internal static DryrunOperationPreview DeserializeDryrunOperationPreview(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional operationType = default; + Optional description = default; + Optional action = default; + Optional scope = default; + 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; + } + } + return new DryrunOperationPreview(name.Value, Optional.ToNullable(operationType), description.Value, action.Value, scope.Value); + } + } +} 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..7a6b2c459201 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunOperationPreview.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The preview of the operations for creation. + public partial class DryrunOperationPreview + { + /// 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. + internal DryrunOperationPreview(string name, DryrunPreviewOperationType? operationType, string description, string action, string scope) + { + Name = name; + OperationType = operationType; + Description = description; + Action = action; + Scope = scope; + } + + /// 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..4203b814942f --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DryrunParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("actionName"u8); + writer.WriteStringValue(ActionName.ToString()); + writer.WriteEndObject(); + } + + internal static DryrunParameters DeserializeDryrunParameters(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("actionName", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "createOrUpdate": return CreateOrUpdateDryrunParameters.DeserializeCreateOrUpdateDryrunParameters(element); + } + } + return UnknownDryrunParameters.DeserializeUnknownDryrunParameters(element); + } + } +} 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..7744e09f3d11 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunParameters.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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 + { + /// Initializes a new instance of . + protected DryrunParameters() + { + } + + /// Initializes a new instance of . + /// The name of action for you dryrun job. + internal DryrunParameters(DryrunActionName actionName) + { + ActionName = actionName; + } + + /// 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..b9a0bc39e0b7 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DryrunPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(Parameters); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} 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..51e4dae68dd2 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPatch.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// a dryrun job to be updated. + public partial class DryrunPatch + { + /// 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. + internal DryrunPatch(DryrunParameters parameters, IReadOnlyList prerequisiteResults, IReadOnlyList operationPreviews, string provisioningState) + { + Parameters = parameters; + PrerequisiteResults = prerequisiteResults; + OperationPreviews = operationPreviews; + ProvisioningState = provisioningState; + } + + /// + /// 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..30e3947908fc --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class DryrunPrerequisiteResult + { + internal static DryrunPrerequisiteResult DeserializeDryrunPrerequisiteResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("type", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "basicError": return BasicErrorDryrunPrerequisiteResult.DeserializeBasicErrorDryrunPrerequisiteResult(element); + case "permissionsMissing": return PermissionsMissingDryrunPrerequisiteResult.DeserializePermissionsMissingDryrunPrerequisiteResult(element); + } + } + return UnknownDryrunPrerequisiteResult.DeserializeUnknownDryrunPrerequisiteResult(element); + } + } +} 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..583d33b1ea80 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunPrerequisiteResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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 + { + /// Initializes a new instance of . + protected DryrunPrerequisiteResult() + { + } + + /// Initializes a new instance of . + /// The type of dryrun result. + internal DryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType) + { + ResultType = resultType; + } + + /// 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/DryrunResourceData.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunResourceData.Serialization.cs new file mode 100644 index 000000000000..d2950d17b477 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/DryrunResourceData.Serialization.cs @@ -0,0 +1,130 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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 + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(Parameters)) + { + writer.WritePropertyName("parameters"u8); + writer.WriteObjectValue(Parameters); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DryrunResourceData DeserializeDryrunResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional parameters = default; + Optional> prerequisiteResults = default; + Optional> operationPreviews = default; + Optional provisioningState = default; + 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); + 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)); + } + 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)); + } + operationPreviews = array; + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + provisioningState = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new DryrunResourceData(id, name, type, systemData.Value, parameters.Value, Optional.ToList(prerequisiteResults), Optional.ToList(operationPreviews), provisioningState.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..28075a6c7e27 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/EasyAuthMicrosoftEntraIdAuthInfo.Serialization.cs @@ -0,0 +1,93 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class EasyAuthMicrosoftEntraIdAuthInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + 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()); + } + writer.WriteEndObject(); + } + + internal static EasyAuthMicrosoftEntraIdAuthInfo DeserializeEasyAuthMicrosoftEntraIdAuthInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional clientId = default; + Optional secret = default; + Optional deleteOrUpdateBehavior = default; + LinkerAuthType authType = default; + Optional authMode = default; + 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; + } + } + return new EasyAuthMicrosoftEntraIdAuthInfo(authType, Optional.ToNullable(authMode), clientId.Value, secret.Value, Optional.ToNullable(deleteOrUpdateBehavior)); + } + } +} 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..09e8787e42f8 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/EasyAuthMicrosoftEntraIdAuthInfo.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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. + /// 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, string clientId, string secret, DeleteOrUpdateBehavior? deleteOrUpdateBehavior) : base(authType, authMode) + { + 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..f6575595601f --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.Serialization.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class FirewallRules : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + 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()); + } + writer.WriteEndObject(); + } + + internal static FirewallRules DeserializeFirewallRules(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> ipRanges = default; + Optional azureServices = default; + Optional callerClientIP = default; + 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; + } + } + return new FirewallRules(Optional.ToList(ipRanges), Optional.ToNullable(azureServices), Optional.ToNullable(callerClientIP)); + } + } +} 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..78851d9e2895 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/FirewallRules.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Target service's firewall rules. to allow connections from source service. + public partial class FirewallRules + { + /// 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. + internal FirewallRules(IList ipRanges, AllowType? azureServices, AllowType? callerClientIP) + { + IPRanges = ipRanges; + AzureServices = azureServices; + CallerClientIP = callerClientIP; + } + + /// 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 00c4c6548608..e11b2c5be8ef 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 @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - public partial class LinkerResourcePatch : IUtf8JsonSerializable + public partial class LinkerPatch : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -68,6 +68,30 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("scope"); } } + if (Optional.IsDefined(PublicNetworkSolution)) + { + if (PublicNetworkSolution != null) + { + writer.WritePropertyName("publicNetworkSolution"u8); + writer.WriteObjectValue(PublicNetworkSolution); + } + else + { + writer.WriteNull("publicNetworkSolution"); + } + } + if (Optional.IsDefined(ConfigurationInfo)) + { + if (ConfigurationInfo != null) + { + writer.WritePropertyName("configurationInfo"u8); + writer.WriteObjectValue(ConfigurationInfo); + } + else + { + writer.WriteNull("configurationInfo"); + } + } writer.WriteEndObject(); writer.WriteEndObject(); } 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 57% 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 d3b604eb8b8f..5052b1938bce 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourcePatch.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerPatch.cs @@ -5,35 +5,35 @@ #nullable disable -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 { - /// 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. - internal LinkerResourcePatch(TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope) + /// The network solution. + /// The connection information consumed by applications, including secrets, connection strings. + internal LinkerPatch(TargetServiceBaseInfo targetService, AuthBaseInfo authInfo, LinkerClientType? clientType, string provisioningState, VnetSolution vnetSolution, LinkerSecretStore secretStore, string scope, PublicNetworkSolution publicNetworkSolution, ConfigurationInfo configurationInfo) { TargetService = targetService; AuthInfo = authInfo; @@ -42,18 +42,20 @@ internal LinkerResourcePatch(TargetServiceBaseInfo targetService, AuthBaseInfo a VnetSolution = vnetSolution; SecretStore = secretStore; Scope = scope; + PublicNetworkSolution = publicNetworkSolution; + ConfigurationInfo = configurationInfo; } /// /// 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. @@ -61,34 +63,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/LinkerResourceData.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourceData.Serialization.cs index 11673c36a10a..f31f36eb0889 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourceData.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerResourceData.Serialization.cs @@ -70,6 +70,30 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("scope"); } } + if (Optional.IsDefined(PublicNetworkSolution)) + { + if (PublicNetworkSolution != null) + { + writer.WritePropertyName("publicNetworkSolution"u8); + writer.WriteObjectValue(PublicNetworkSolution); + } + else + { + writer.WriteNull("publicNetworkSolution"); + } + } + if (Optional.IsDefined(ConfigurationInfo)) + { + if (ConfigurationInfo != null) + { + writer.WritePropertyName("configurationInfo"u8); + writer.WriteObjectValue(ConfigurationInfo); + } + else + { + writer.WriteNull("configurationInfo"); + } + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -91,6 +115,8 @@ internal static LinkerResourceData DeserializeLinkerResourceData(JsonElement ele Optional vnetSolution = default; Optional secretStore = default; Optional scope = default; + Optional publicNetworkSolution = default; + Optional configurationInfo = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -188,11 +214,31 @@ 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); + continue; + } + if (property0.NameEquals("configurationInfo"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + configurationInfo = null; + continue; + } + configurationInfo = ConfigurationInfo.DeserializeConfigurationInfo(property0.Value); + continue; + } } continue; } } - return new LinkerResourceData(id, name, type, systemData.Value, targetService.Value, authInfo.Value, Optional.ToNullable(clientType), provisioningState.Value, vnetSolution.Value, secretStore.Value, scope.Value); + return new LinkerResourceData(id, name, type, systemData.Value, targetService.Value, authInfo.Value, Optional.ToNullable(clientType), provisioningState.Value, vnetSolution.Value, secretStore.Value, scope.Value, publicNetworkSolution.Value, configurationInfo.Value); } } } 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 e8ef60f12437..776ca4eb46d0 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 @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - internal partial class LinkerSecretStore : IUtf8JsonSerializable + public partial class LinkerSecretStore : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -27,6 +27,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("keyVaultId"); } } + if (Optional.IsDefined(KeyVaultSecretName)) + { + if (KeyVaultSecretName != null) + { + writer.WritePropertyName("keyVaultSecretName"u8); + writer.WriteStringValue(KeyVaultSecretName); + } + else + { + writer.WriteNull("keyVaultSecretName"); + } + } writer.WriteEndObject(); } @@ -37,6 +49,7 @@ internal static LinkerSecretStore DeserializeLinkerSecretStore(JsonElement eleme return null; } Optional keyVaultId = default; + Optional keyVaultSecretName = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyVaultId"u8)) @@ -49,8 +62,18 @@ 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; + } } - return new LinkerSecretStore(keyVaultId.Value); + return new LinkerSecretStore(keyVaultId.Value, keyVaultSecretName.Value); } } } 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 edaa35848a2c..f596f0b427af 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerSecretStore.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// An option to store secret value in secure place. - internal partial class LinkerSecretStore + public partial class LinkerSecretStore { /// Initializes a new instance of . public LinkerSecretStore() @@ -19,12 +19,16 @@ public LinkerSecretStore() /// Initializes a new instance of . /// The key vault id to store secret. - internal LinkerSecretStore(ResourceIdentifier keyVaultId) + /// The key vault secret name to store secret, only valid when storing one secret. + internal LinkerSecretStore(ResourceIdentifier keyVaultId, string keyVaultSecretName) { KeyVaultId = keyVaultId; + KeyVaultSecretName = keyVaultSecretName; } /// 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 edc10ef194ca..54c560ab0706 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 { /// Initializes a new instance of . @@ -21,13 +21,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. @@ -45,7 +45,7 @@ internal LinkerValidateOperationResult(ResourceIdentifier resourceId, string sta ValidationDetail = validationDetail; } - /// Validated linker id. + /// Validated Linker id. public ResourceIdentifier ResourceId { get; } /// Validation operation status. public string Status { get; } @@ -57,7 +57,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 857fae2e5c5c..f5b8ceb2af22 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidationResultItemInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerValidationResultItemInfo.cs @@ -7,7 +7,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - /// The validation item for a linker. + /// The validation item for a Linker. public partial class LinkerValidationResultItemInfo { /// Initializes a new instance of . 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..a47a7e1f4dc7 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class PermissionsMissingDryrunPrerequisiteResult + { + internal static PermissionsMissingDryrunPrerequisiteResult DeserializePermissionsMissingDryrunPrerequisiteResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional scope = default; + Optional> permissions = default; + Optional recommendedRole = default; + DryrunPrerequisiteResultType type = default; + 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; + } + } + return new PermissionsMissingDryrunPrerequisiteResult(type, scope.Value, Optional.ToList(permissions), recommendedRole.Value); + } + } +} 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..a8016932c2cd --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PermissionsMissingDryrunPrerequisiteResult.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +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. + /// The permission scope. + /// The permission list. + /// The recommended role to resolve permissions missing. + internal PermissionsMissingDryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType, string scope, IReadOnlyList permissions, string recommendedRole) : base(resultType) + { + 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..fedd15d93dcd --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class PublicNetworkSolution : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + 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); + } + writer.WriteEndObject(); + } + + internal static PublicNetworkSolution DeserializePublicNetworkSolution(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional deleteOrUpdateBehavior = default; + Optional action = default; + Optional firewallRules = default; + 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); + continue; + } + } + return new PublicNetworkSolution(Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToNullable(action), firewallRules.Value); + } + } +} 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..8981322a0858 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/PublicNetworkSolution.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// Indicates public network solution, include firewall rules. + public partial class PublicNetworkSolution + { + /// 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. + internal PublicNetworkSolution(DeleteOrUpdateBehavior? deleteOrUpdateBehavior, ActionType? action, FirewallRules firewallRules) + { + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Action = action; + FirewallRules = firewallRules; + } + + /// 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/LinkerList.Serialization.cs b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.Serialization.cs similarity index 89% rename from sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.Serialization.cs rename to sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.Serialization.cs index 68cb79e46ac0..0a763b019b4a 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.Serialization.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.Serialization.cs @@ -12,9 +12,9 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - internal partial class LinkerList + internal partial class ResourceList { - internal static LinkerList DeserializeLinkerList(JsonElement element) + internal static ResourceList DeserializeResourceList(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { @@ -49,7 +49,7 @@ internal static LinkerList DeserializeLinkerList(JsonElement element) continue; } } - return new LinkerList(nextLink.Value, Optional.ToList(value)); + return new ResourceList(nextLink.Value, Optional.ToList(value)); } } } 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 58% 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 9b20de19e957..275b216d1083 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/LinkerList.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ResourceList.cs @@ -12,24 +12,24 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// The list of Linker. - internal partial class LinkerList + internal partial class ResourceList { - /// 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. - internal LinkerList(string nextLink, IReadOnlyList value) + internal ResourceList(string nextLink, IReadOnlyList value) { NextLink = nextLink; Value = value; } - /// 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 f7dc66846288..21cbb585b2dc 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 @@ -41,6 +41,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WritePropertyName("authType"u8); writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } writer.WriteEndObject(); } @@ -53,6 +58,7 @@ internal static SecretAuthInfo DeserializeSecretAuthInfo(JsonElement element) Optional name = default; Optional secretInfo = default; LinkerAuthType authType = default; + Optional authMode = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -80,8 +86,17 @@ internal static SecretAuthInfo DeserializeSecretAuthInfo(JsonElement element) 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; + } } - return new SecretAuthInfo(authType, name.Value, secretInfo.Value); + return new SecretAuthInfo(authType, Optional.ToNullable(authMode), name.Value, secretInfo.Value); } } } 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 e00f7659c9e5..c90ba00c1ec8 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SecretAuthInfo.cs @@ -18,13 +18,14 @@ 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. /// Username or account name for secret auth. /// /// Password or key vault secret for secret auth. /// 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, string name, SecretBaseInfo secretInfo) : base(authType) + internal SecretAuthInfo(LinkerAuthType authType, AuthMode? authMode, string name, SecretBaseInfo secretInfo) : base(authType, authMode) { 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..029d808eb598 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class SelfHostedServer : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint); + } + writer.WritePropertyName("type"u8); + writer.WriteStringValue(TargetServiceType.ToString()); + writer.WriteEndObject(); + } + + internal static SelfHostedServer DeserializeSelfHostedServer(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional endpoint = default; + TargetServiceType type = default; + 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; + } + } + return new SelfHostedServer(type, endpoint.Value); + } + } +} 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..80b437dfd151 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SelfHostedServer.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +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. + /// The endpoint of service. + internal SelfHostedServer(TargetServiceType targetServiceType, string endpoint) : base(targetServiceType) + { + 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 ca6d66162114..d92857379be7 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 @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -22,8 +23,28 @@ void IUtf8JsonSerializable.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()); + } writer.WriteEndObject(); } @@ -36,7 +57,10 @@ internal static ServicePrincipalCertificateAuthInfo DeserializeServicePrincipalC string clientId = default; Guid principalId = default; string certificate = default; + Optional deleteOrUpdateBehavior = default; + Optional> roles = default; LinkerAuthType authType = default; + Optional authMode = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -54,13 +78,45 @@ 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; + } } - return new ServicePrincipalCertificateAuthInfo(authType, clientId, principalId, certificate); + return new ServicePrincipalCertificateAuthInfo(authType, Optional.ToNullable(authMode), clientId, principalId, certificate, Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToList(roles)); } } } 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 6290d72beee8..4a915109cd89 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalCertificateAuthInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ServiceLinker.Models @@ -26,19 +27,25 @@ 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. /// Application clientId for servicePrincipal auth. /// Principal Id for servicePrincipal auth. /// ServicePrincipal certificate for servicePrincipal auth. - internal ServicePrincipalCertificateAuthInfo(LinkerAuthType authType, string clientId, Guid principalId, string certificate) : base(authType) + /// 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, string clientId, Guid principalId, string certificate, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles) : base(authType, authMode) { ClientId = clientId; PrincipalId = principalId; Certificate = certificate; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; AuthType = authType; } @@ -48,5 +55,9 @@ internal ServicePrincipalCertificateAuthInfo(LinkerAuthType authType, string cli 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 08bae3cfb5ff..6866a4ad0487 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 @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -22,8 +23,40 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) 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()); + } writer.WriteEndObject(); } @@ -36,7 +69,11 @@ internal static ServicePrincipalSecretAuthInfo DeserializeServicePrincipalSecret string clientId = default; Guid principalId = default; string secret = default; + Optional deleteOrUpdateBehavior = default; + Optional> roles = default; + Optional userName = default; LinkerAuthType authType = default; + Optional authMode = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -54,13 +91,55 @@ 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; + } } - return new ServicePrincipalSecretAuthInfo(authType, clientId, principalId, secret); + return new ServicePrincipalSecretAuthInfo(authType, Optional.ToNullable(authMode), clientId, principalId, secret, Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToList(roles), userName.Value); } } } 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 386a033d5183..3b8008ce0441 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/ServicePrincipalSecretAuthInfo.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using Azure.Core; namespace Azure.ResourceManager.ServiceLinker.Models @@ -26,19 +27,27 @@ 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. /// ServicePrincipal application clientId for servicePrincipal auth. /// Principal Id for servicePrincipal auth. /// Secret for servicePrincipal auth. - internal ServicePrincipalSecretAuthInfo(LinkerAuthType authType, string clientId, Guid principalId, string secret) : base(authType) + /// 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, string clientId, Guid principalId, string secret, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType, authMode) { ClientId = clientId; PrincipalId = principalId; Secret = secret; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; + UserName = userName; AuthType = authType; } @@ -48,5 +57,11 @@ internal ServicePrincipalSecretAuthInfo(LinkerAuthType authType, string clientId 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 efb909dbbbfd..91c6d3e98e2e 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 @@ -20,6 +20,9 @@ internal static SourceConfiguration DeserializeSourceConfiguration(JsonElement e } Optional name = default; Optional value = default; + Optional configType = default; + Optional keyVaultReferenceIdentity = default; + Optional description = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name"u8)) @@ -37,8 +40,37 @@ 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; + } } - return new SourceConfiguration(name.Value, value.Value); + return new SourceConfiguration(name.Value, value.Value, Optional.ToNullable(configType), keyVaultReferenceIdentity.Value, description.Value); } } } 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 cb50e333afbe..16c38e13219b 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfiguration.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SourceConfiguration.cs @@ -18,15 +18,27 @@ internal SourceConfiguration() /// Initializes a new instance of . /// The name of setting. /// The value of setting. - internal SourceConfiguration(string name, string value) + /// The type of setting. + /// The identity for key vault reference, system or user-assigned managed identity ID. + /// Descriptive information for the configuration. + internal SourceConfiguration(string name, string value, LinkerConfigurationType? configType, string keyVaultReferenceIdentity, string description) { Name = name; Value = value; + ConfigType = configType; + KeyVaultReferenceIdentity = keyVaultReferenceIdentity; + Description = description; } /// The name of setting. public string Name { get; } /// 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 e0936edb75df..20b070158064 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 @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -15,8 +16,40 @@ public partial class SystemAssignedIdentityAuthInfo : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { 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()); + } writer.WriteEndObject(); } @@ -26,16 +59,62 @@ internal static SystemAssignedIdentityAuthInfo DeserializeSystemAssignedIdentity { return null; } + Optional deleteOrUpdateBehavior = default; + Optional> roles = default; + Optional userName = default; LinkerAuthType authType = default; + Optional authMode = default; 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; + } } - return new SystemAssignedIdentityAuthInfo(authType); + return new SystemAssignedIdentityAuthInfo(authType, Optional.ToNullable(authMode), Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToList(roles), userName.Value); } } } 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 23ed3b76099d..2cf0d81940d7 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/SystemAssignedIdentityAuthInfo.cs @@ -5,6 +5,9 @@ #nullable disable +using System.Collections.Generic; +using Azure.Core; + namespace Azure.ResourceManager.ServiceLinker.Models { /// The authentication info when authType is systemAssignedIdentity. @@ -13,14 +16,29 @@ 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. - internal SystemAssignedIdentityAuthInfo(LinkerAuthType authType) : base(authType) + /// 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. + /// 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, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType, authMode) { + 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 bd944cc53e09..e29a5850069f 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 @@ -33,6 +33,7 @@ internal static TargetServiceBaseInfo DeserializeTargetServiceBaseInfo(JsonEleme case "AzureResource": return AzureResourceInfo.DeserializeAzureResourceInfo(element); case "ConfluentBootstrapServer": return ConfluentBootstrapServerInfo.DeserializeConfluentBootstrapServerInfo(element); case "ConfluentSchemaRegistry": return ConfluentSchemaRegistryInfo.DeserializeConfluentSchemaRegistryInfo(element); + case "SelfHostedServer": return SelfHostedServer.DeserializeSelfHostedServer(element); } } return UnknownTargetServiceBase.DeserializeUnknownTargetServiceBase(element); 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 f2b22f50522f..341b4edd3f1e 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/TargetServiceBaseInfo.cs @@ -10,7 +10,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 0233feea9190..f74698714d07 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 @@ -17,6 +17,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("authType"u8); writer.WriteStringValue(AuthType.ToString()); + if (Optional.IsDefined(AuthMode)) + { + writer.WritePropertyName("authMode"u8); + writer.WriteStringValue(AuthMode.Value.ToString()); + } writer.WriteEndObject(); } @@ -27,6 +32,7 @@ internal static UnknownAuthInfoBase DeserializeUnknownAuthInfoBase(JsonElement e return null; } LinkerAuthType authType = "Unknown"; + Optional authMode = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("authType"u8)) @@ -34,8 +40,17 @@ 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; + } } - return new UnknownAuthInfoBase(authType); + return new UnknownAuthInfoBase(authType, Optional.ToNullable(authMode)); } } } 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 91be30dd73c8..6ca3a41179e1 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownAuthInfoBase.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownAuthInfoBase.cs @@ -12,7 +12,8 @@ internal partial class UnknownAuthInfoBase : AuthBaseInfo { /// Initializes a new instance of . /// The authentication type. - internal UnknownAuthInfoBase(LinkerAuthType authType) : base(authType) + /// 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. + internal UnknownAuthInfoBase(LinkerAuthType authType, AuthMode? authMode) : base(authType, authMode) { 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..44428dd4cc34 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class UnknownDryrunParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("actionName"u8); + writer.WriteStringValue(ActionName.ToString()); + writer.WriteEndObject(); + } + + internal static UnknownDryrunParameters DeserializeUnknownDryrunParameters(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DryrunActionName actionName = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("actionName"u8)) + { + actionName = new DryrunActionName(property.Value.GetString()); + continue; + } + } + return new UnknownDryrunParameters(actionName); + } + } +} 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..d0918d802992 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunParameters.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The UnknownDryrunParameters. + internal partial class UnknownDryrunParameters : DryrunParameters + { + /// Initializes a new instance of . + /// The name of action for you dryrun job. + internal UnknownDryrunParameters(DryrunActionName actionName) : base(actionName) + { + ActionName = actionName; + } + } +} 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..cc97c56045a4 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + internal partial class UnknownDryrunPrerequisiteResult + { + internal static UnknownDryrunPrerequisiteResult DeserializeUnknownDryrunPrerequisiteResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DryrunPrerequisiteResultType type = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new DryrunPrerequisiteResultType(property.Value.GetString()); + continue; + } + } + return new UnknownDryrunPrerequisiteResult(type); + } + } +} 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..8a711da996bc --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UnknownDryrunPrerequisiteResult.cs @@ -0,0 +1,20 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + /// The UnknownDryrunPrerequisiteResult. + internal partial class UnknownDryrunPrerequisiteResult : DryrunPrerequisiteResult + { + /// Initializes a new instance of . + /// The type of dryrun result. + internal UnknownDryrunPrerequisiteResult(DryrunPrerequisiteResultType resultType) : base(resultType) + { + ResultType = resultType; + } + } +} 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..7cae92be46b2 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAccountAuthInfo.Serialization.cs @@ -0,0 +1,136 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ServiceLinker.Models +{ + public partial class UserAccountAuthInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + 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()); + } + writer.WriteEndObject(); + } + + internal static UserAccountAuthInfo DeserializeUserAccountAuthInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional principalId = default; + Optional deleteOrUpdateBehavior = default; + Optional> roles = default; + Optional userName = default; + LinkerAuthType authType = default; + Optional authMode = default; + 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; + } + } + return new UserAccountAuthInfo(authType, Optional.ToNullable(authMode), Optional.ToNullable(principalId), Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToList(roles), userName.Value); + } + } +} 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..b9d6ec25d9c1 --- /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; +using Azure.Core; + +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. + /// 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, Guid? principalId, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType, authMode) + { + 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 4618a16da356..8ddf46303c81 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 @@ -5,6 +5,7 @@ #nullable disable +using System.Collections.Generic; using System.Text.Json; using Azure.Core; @@ -25,8 +26,40 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) 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()); + } writer.WriteEndObject(); } @@ -38,7 +71,11 @@ internal static UserAssignedIdentityAuthInfo DeserializeUserAssignedIdentityAuth } Optional clientId = default; Optional subscriptionId = default; + Optional deleteOrUpdateBehavior = default; + Optional> roles = default; + Optional userName = default; LinkerAuthType authType = default; + Optional authMode = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("clientId"u8)) @@ -51,13 +88,55 @@ 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; + } } - return new UserAssignedIdentityAuthInfo(authType, clientId.Value, subscriptionId.Value); + return new UserAssignedIdentityAuthInfo(authType, Optional.ToNullable(authMode), clientId.Value, subscriptionId.Value, Optional.ToNullable(deleteOrUpdateBehavior), Optional.ToList(roles), userName.Value); } } } 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 27351d15d818..15b5c9598d85 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/UserAssignedIdentityAuthInfo.cs @@ -5,6 +5,9 @@ #nullable disable +using System.Collections.Generic; +using Azure.Core; + namespace Azure.ResourceManager.ServiceLinker.Models { /// The authentication info when authType is userAssignedIdentity. @@ -13,17 +16,25 @@ 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. /// Client Id for userAssignedIdentity. /// Subscription id for userAssignedIdentity. - internal UserAssignedIdentityAuthInfo(LinkerAuthType authType, string clientId, string subscriptionId) : base(authType) + /// 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, string clientId, string subscriptionId, DeleteOrUpdateBehavior? deleteOrUpdateBehavior, IList roles, string userName) : base(authType, authMode) { ClientId = clientId; SubscriptionId = subscriptionId; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; + Roles = roles; + UserName = userName; AuthType = authType; } @@ -31,5 +42,11 @@ internal UserAssignedIdentityAuthInfo(LinkerAuthType authType, string clientId, public string ClientId { get; set; } /// 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 3dd1e3e13b65..ad3eb0c59a77 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 @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { - internal partial class VnetSolution : IUtf8JsonSerializable + public partial class VnetSolution : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -27,6 +27,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteNull("type"); } } + if (Optional.IsDefined(DeleteOrUpdateBehavior)) + { + writer.WritePropertyName("deleteOrUpdateBehavior"u8); + writer.WriteStringValue(DeleteOrUpdateBehavior.Value.ToString()); + } writer.WriteEndObject(); } @@ -37,6 +42,7 @@ internal static VnetSolution DeserializeVnetSolution(JsonElement element) return null; } Optional type = default; + Optional deleteOrUpdateBehavior = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type"u8)) @@ -49,8 +55,17 @@ internal static VnetSolution DeserializeVnetSolution(JsonElement element) 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; + } } - return new VnetSolution(Optional.ToNullable(type)); + return new VnetSolution(Optional.ToNullable(type), Optional.ToNullable(deleteOrUpdateBehavior)); } } } 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 bafc81a3eb7e..307df0fc42f3 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/Models/VnetSolution.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.ServiceLinker.Models { /// The VNet solution for linker. - internal partial class VnetSolution + public partial class VnetSolution { /// Initializes a new instance of . public VnetSolution() @@ -17,12 +17,16 @@ public VnetSolution() /// Initializes a new instance of . /// Type of VNet solution. - internal VnetSolution(VnetSolutionType? solutionType) + /// Indicates whether to clean up previous operation when Linker is updating or deleting. + internal VnetSolution(VnetSolutionType? solutionType, DeleteOrUpdateBehavior? deleteOrUpdateBehavior) { SolutionType = solutionType; + DeleteOrUpdateBehavior = deleteOrUpdateBehavior; } /// 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..7048ddfa1fa7 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConfigurationNamesRestOperations.cs @@ -0,0 +1,173 @@ +// 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; +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 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 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..df3ded4f6c15 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/ConnectorRestOperations.cs @@ -0,0 +1,1159 @@ +// 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; +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 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 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 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); + 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 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); + 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 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 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 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 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); + 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 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 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); + 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 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 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); + 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 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 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 7c449a18fdf9..ddd380f13c4f 100644 --- a/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkerRestOperations.cs +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkerRestOperations.cs @@ -33,7 +33,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); } @@ -54,11 +54,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)); @@ -68,9 +68,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: @@ -78,11 +78,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)); @@ -92,9 +92,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: @@ -200,7 +200,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. @@ -225,7 +225,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. @@ -268,7 +268,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. @@ -292,7 +292,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. @@ -316,7 +316,7 @@ public Response Delete(string resourceUri, string linkerName, CancellationToken } } - 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; @@ -338,14 +338,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)); @@ -363,14 +363,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)); @@ -407,7 +407,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. @@ -430,7 +430,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. @@ -472,13 +472,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)); @@ -489,9 +489,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: @@ -499,13 +499,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)); @@ -516,9 +516,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: @@ -540,12 +540,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)); @@ -556,9 +556,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: @@ -566,12 +566,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)); @@ -582,9 +582,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..a39a215722d7 --- /dev/null +++ b/sdk/servicelinker/Azure.ResourceManager.ServiceLinker/src/Generated/RestOperations/LinkersRestOperations.cs @@ -0,0 +1,668 @@ +// 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; +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 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 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 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); + 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 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); + 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 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 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); + 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 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 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 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 b15225691313..2b3a71b1fa13 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: