From ae2567f1fe440bf18ffec6307fe5de621962c6ff Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Wed, 16 Apr 2025 15:53:18 +0000 Subject: [PATCH] CodeGen from PR 33840 in Azure/azure-rest-api-specs Merge ff949c6945b9edffa07cdf0a60ec24ed7f468808 into 04b1cc9e738c59be9948f6b7abf3e5e0171a04f3 --- ....ResourceManager.OnlineExperimentation.sln | 56 ++ .../CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../README.md | 80 ++ ...rceManager.OnlineExperimentation.net8.0.cs | 228 ++++++ ...er.OnlineExperimentation.netstandard2.0.cs | 228 ++++++ .../assets.json | 7 + ...nager.OnlineExperimentation.Samples.csproj | 13 + ...ple_OnlineExperimentWorkspaceCollection.cs | 272 +++++++ ...ample_OnlineExperimentWorkspaceResource.cs | 180 +++++ .../Sample_SubscriptionResourceExtensions.cs | 50 ++ ...sourceManager.OnlineExperimentation.csproj | 8 + .../ArmOnlineExperimentationModelFactory.cs | 78 ++ .../MockableOnlineExperimentationArmClient.cs | 49 ++ ...ineExperimentationResourceGroupResource.cs | 105 +++ ...lineExperimentationSubscriptionResource.cs | 102 +++ .../OnlineExperimentationExtensions.cs | 219 ++++++ .../src/Generated/Internal/Argument.cs | 129 ++++ .../Internal/ChangeTrackingDictionary.cs | 167 ++++ .../Generated/Internal/ChangeTrackingList.cs | 153 ++++ .../Internal/ModelSerializationExtensions.cs | 399 ++++++++++ .../src/Generated/Internal/Optional.cs | 51 ++ .../Internal/Utf8JsonRequestContent.cs | 55 ++ ...nlineExperimentWorkspaceOperationSource.cs | 36 + .../OnlineExperimentationArmOperation.cs | 94 +++ .../OnlineExperimentationArmOperationOfT.cs | 100 +++ ...tomerManagedKeyEncryption.Serialization.cs | 148 ++++ .../Models/CustomerManagedKeyEncryption.cs | 69 ++ .../KeyEncryptionKeyIdentity.Serialization.cs | 163 ++++ .../Models/KeyEncryptionKeyIdentity.cs | 74 ++ .../Models/KeyEncryptionKeyIdentityType.cs | 51 ++ ...rimentWorkspaceListResult.Serialization.cs | 151 ++++ .../OnlineExperimentWorkspaceListResult.cs | 80 ++ ...rimentWorkspaceProperties.Serialization.cs | 206 +++++ .../OnlineExperimentWorkspaceProperties.cs | 118 +++ ...perimentationWorkspaceSku.Serialization.cs | 141 ++++ .../OnlineExperimentationWorkspaceSku.cs | 76 ++ .../OnlineExperimentationWorkspaceSkuName.cs | 57 ++ .../OnlineExperimentationWorkspaceSkuTier.cs | 57 ++ ...ceEncryptionConfiguration.Serialization.cs | 133 ++++ .../Models/ResourceEncryptionConfiguration.cs | 65 ++ .../Models/ResourceProvisioningState.cs | 54 ++ .../OnlineExperimentWorkspaceCollection.cs | 494 ++++++++++++ ...neExperimentWorkspaceData.Serialization.cs | 212 +++++ .../OnlineExperimentWorkspaceData.cs | 91 +++ ...perimentWorkspaceResource.Serialization.cs | 26 + .../OnlineExperimentWorkspaceResource.cs | 706 +++++++++++++++++ .../src/Generated/ProviderConstants.cs | 16 + ...nlineExperimentWorkspacesRestOperations.cs | 723 ++++++++++++++++++ .../src/Properties/AssemblyInfo.cs | 11 + ...Manager.OnlineExperimentation.Tests.csproj | 8 + ...OnlineExperimentationManagementTestBase.cs | 45 ++ ...xperimentationManagementTestEnvironment.cs | 11 + .../tsp-location.yaml | 4 + sdk/onlineexperimentation/ci.mgmt.yml | 26 + sdk/resourcemanager/ci.mgmt.yml | 2 + sdk/storage/ci.yml | 2 + 57 files changed, 6896 insertions(+) create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Azure.ResourceManager.OnlineExperimentation.sln create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/CHANGELOG.md create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Directory.Build.props create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/README.md create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.net8.0.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.netstandard2.0.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/assets.json create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Azure.ResourceManager.OnlineExperimentation.Samples.csproj create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceCollection.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceResource.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Azure.ResourceManager.OnlineExperimentation.csproj create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ArmOnlineExperimentationModelFactory.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationArmClient.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationResourceGroupResource.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationSubscriptionResource.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/OnlineExperimentationExtensions.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Argument.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Optional.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentWorkspaceOperationSource.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperation.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperationOfT.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.Serialization.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.Serialization.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentityType.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.Serialization.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.Serialization.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.Serialization.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuName.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuTier.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.Serialization.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceProvisioningState.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceCollection.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.Serialization.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.Serialization.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ProviderConstants.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/RestOperations/OnlineExperimentWorkspacesRestOperations.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Properties/AssemblyInfo.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/Azure.ResourceManager.OnlineExperimentation.Tests.csproj create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestBase.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestEnvironment.cs create mode 100644 sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tsp-location.yaml create mode 100644 sdk/onlineexperimentation/ci.mgmt.yml diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Azure.ResourceManager.OnlineExperimentation.sln b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Azure.ResourceManager.OnlineExperimentation.sln new file mode 100644 index 000000000000..779249ad70eb --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Azure.ResourceManager.OnlineExperimentation.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.OnlineExperimentation.Samples", "samples\Azure.ResourceManager.OnlineExperimentation.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.OnlineExperimentation", "src\Azure.ResourceManager.OnlineExperimentation.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.OnlineExperimentation.Tests", "tests\Azure.ResourceManager.OnlineExperimentation.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/CHANGELOG.md b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Directory.Build.props b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/README.md b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/README.md new file mode 100644 index 000000000000..13d45116b02c --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure OnlineExperimentation management client library for .NET + +**[Describe the service briefly first.]** + +This library follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET. + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. + - HTTP pipeline with custom policies. + - Better error-handling. + - Support uniform telemetry across all languages. + +## Getting started + +### Install the package + +Install the Microsoft Azure OnlineExperimentation management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.OnlineExperimentation --prerelease +``` + +### Prerequisites + +* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/). + +### Authenticate the Client + +To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). + +## Key concepts + +Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package: + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). +- [API References](https://learn.microsoft.com/dotnet/api/?view=azure-dotnet). +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md). + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples) + +## Troubleshooting + +- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues). +- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags. + +## Next steps + +For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/). + +## Contributing + +For details on contributing to this repository, see the [contributing +guide][cg]. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(for example, label, comment). Follow the instructions provided by the +bot. You'll only need to do this action once across all repositories +using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For +more information, see the [Code of Conduct FAQ][coc_faq] or contact + with any other questions or comments. + + +[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ \ No newline at end of file diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.net8.0.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.net8.0.cs new file mode 100644 index 000000000000..0c2d832a7405 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.net8.0.cs @@ -0,0 +1,228 @@ +namespace Azure.ResourceManager.OnlineExperimentation +{ + public static partial class OnlineExperimentationExtensions + { + public static Azure.Response GetOnlineExperimentWorkspace(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetOnlineExperimentWorkspaceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetOnlineExperimentWorkspaces(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetOnlineExperimentWorkspacesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class OnlineExperimentWorkspaceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected OnlineExperimentWorkspaceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string workspaceName, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string workspaceName, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class OnlineExperimentWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspaceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku Sku { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class OnlineExperimentWorkspaceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected OnlineExperimentWorkspaceResource() { } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.OnlineExperimentation.Mocking +{ + public partial class MockableOnlineExperimentationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationArmClient() { } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableOnlineExperimentationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationResourceGroupResource() { } + public virtual Azure.Response GetOnlineExperimentWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOnlineExperimentWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces() { throw null; } + } + public partial class MockableOnlineExperimentationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationSubscriptionResource() { } + public virtual Azure.Pageable GetOnlineExperimentWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOnlineExperimentWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + public static partial class ArmOnlineExperimentationModelFactory + { + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku OnlineExperimentationWorkspaceSku(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName name = default(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName), Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier? tier = default(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier?)) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData OnlineExperimentWorkspaceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku sku = null) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties OnlineExperimentWorkspaceProperties(string workspaceId = null, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState?), Azure.Core.ResourceIdentifier logAnalyticsWorkspaceResourceId = null, Azure.Core.ResourceIdentifier logsExporterStorageAccountResourceId = null, Azure.Core.ResourceIdentifier appConfigurationResourceId = null, Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption customerManagedKeyEncryption = null, System.Uri endpoint = null) { throw null; } + } + public partial class CustomerManagedKeyEncryption : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomerManagedKeyEncryption() { } + public Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentity KeyEncryptionKeyIdentity { get { throw null; } set { } } + public System.Uri KeyEncryptionKeyUri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyEncryptionKeyIdentity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyEncryptionKeyIdentity() { } + public System.Guid? FederatedClientId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType? IdentityType { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier UserAssignedIdentityResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct KeyEncryptionKeyIdentityType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public KeyEncryptionKeyIdentityType(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType SystemAssignedIdentity { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType UserAssignedIdentity { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType left, Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType left, Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OnlineExperimentationWorkspaceSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentationWorkspaceSku(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName name) { } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName Name { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier? Tier { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OnlineExperimentationWorkspaceSkuName : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OnlineExperimentationWorkspaceSkuName(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName D0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName F0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName P0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName S0 { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OnlineExperimentationWorkspaceSkuTier : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OnlineExperimentationWorkspaceSkuTier(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Developer { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Free { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Premium { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Standard { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OnlineExperimentWorkspaceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspaceProperties(Azure.Core.ResourceIdentifier logAnalyticsWorkspaceResourceId, Azure.Core.ResourceIdentifier logsExporterStorageAccountResourceId, Azure.Core.ResourceIdentifier appConfigurationResourceId) { } + public Azure.Core.ResourceIdentifier AppConfigurationResourceId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption CustomerManagedKeyEncryption { get { throw null; } set { } } + public System.Uri Endpoint { get { throw null; } } + public Azure.Core.ResourceIdentifier LogAnalyticsWorkspaceResourceId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier LogsExporterStorageAccountResourceId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public string WorkspaceId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState left, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState left, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.netstandard2.0.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.netstandard2.0.cs new file mode 100644 index 000000000000..0c2d832a7405 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/api/Azure.ResourceManager.OnlineExperimentation.netstandard2.0.cs @@ -0,0 +1,228 @@ +namespace Azure.ResourceManager.OnlineExperimentation +{ + public static partial class OnlineExperimentationExtensions + { + public static Azure.Response GetOnlineExperimentWorkspace(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetOnlineExperimentWorkspaceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetOnlineExperimentWorkspaces(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetOnlineExperimentWorkspacesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class OnlineExperimentWorkspaceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected OnlineExperimentWorkspaceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string workspaceName, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string workspaceName, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class OnlineExperimentWorkspaceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspaceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku Sku { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class OnlineExperimentWorkspaceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected OnlineExperimentWorkspaceResource() { } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.OnlineExperimentation.Mocking +{ + public partial class MockableOnlineExperimentationArmClient : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationArmClient() { } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableOnlineExperimentationResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationResourceGroupResource() { } + public virtual Azure.Response GetOnlineExperimentWorkspace(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetOnlineExperimentWorkspaceAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces() { throw null; } + } + public partial class MockableOnlineExperimentationSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableOnlineExperimentationSubscriptionResource() { } + public virtual Azure.Pageable GetOnlineExperimentWorkspaces(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetOnlineExperimentWorkspacesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + public static partial class ArmOnlineExperimentationModelFactory + { + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku OnlineExperimentationWorkspaceSku(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName name = default(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName), Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier? tier = default(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier?)) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.OnlineExperimentWorkspaceData OnlineExperimentWorkspaceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku sku = null) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties OnlineExperimentWorkspaceProperties(string workspaceId = null, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState?), Azure.Core.ResourceIdentifier logAnalyticsWorkspaceResourceId = null, Azure.Core.ResourceIdentifier logsExporterStorageAccountResourceId = null, Azure.Core.ResourceIdentifier appConfigurationResourceId = null, Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption customerManagedKeyEncryption = null, System.Uri endpoint = null) { throw null; } + } + public partial class CustomerManagedKeyEncryption : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public CustomerManagedKeyEncryption() { } + public Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentity KeyEncryptionKeyIdentity { get { throw null; } set { } } + public System.Uri KeyEncryptionKeyUri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class KeyEncryptionKeyIdentity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyEncryptionKeyIdentity() { } + public System.Guid? FederatedClientId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType? IdentityType { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier UserAssignedIdentityResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct KeyEncryptionKeyIdentityType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public KeyEncryptionKeyIdentityType(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType SystemAssignedIdentity { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType UserAssignedIdentity { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType left, Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType left, Azure.ResourceManager.OnlineExperimentation.Models.KeyEncryptionKeyIdentityType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OnlineExperimentationWorkspaceSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentationWorkspaceSku(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName name) { } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName Name { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier? Tier { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSku System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OnlineExperimentationWorkspaceSkuName : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OnlineExperimentationWorkspaceSkuName(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName D0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName F0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName P0 { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName S0 { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuName right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct OnlineExperimentationWorkspaceSkuTier : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public OnlineExperimentationWorkspaceSkuTier(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Developer { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Free { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Premium { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier Standard { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier left, Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentationWorkspaceSkuTier right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OnlineExperimentWorkspaceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OnlineExperimentWorkspaceProperties(Azure.Core.ResourceIdentifier logAnalyticsWorkspaceResourceId, Azure.Core.ResourceIdentifier logsExporterStorageAccountResourceId, Azure.Core.ResourceIdentifier appConfigurationResourceId) { } + public Azure.Core.ResourceIdentifier AppConfigurationResourceId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.CustomerManagedKeyEncryption CustomerManagedKeyEncryption { get { throw null; } set { } } + public System.Uri Endpoint { get { throw null; } } + public Azure.Core.ResourceIdentifier LogAnalyticsWorkspaceResourceId { get { throw null; } set { } } + public Azure.Core.ResourceIdentifier LogsExporterStorageAccountResourceId { get { throw null; } set { } } + public Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public string WorkspaceId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.OnlineExperimentation.Models.OnlineExperimentWorkspaceProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState left, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState left, Azure.ResourceManager.OnlineExperimentation.Models.ResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/assets.json b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/assets.json new file mode 100644 index 000000000000..9e49956a0064 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation", + "Tag": "" +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Azure.ResourceManager.OnlineExperimentation.Samples.csproj b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Azure.ResourceManager.OnlineExperimentation.Samples.csproj new file mode 100644 index 000000000000..bd64b7950a3b --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Azure.ResourceManager.OnlineExperimentation.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceCollection.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceCollection.cs new file mode 100644 index 000000000000..5861b06e1435 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceCollection.cs @@ -0,0 +1,272 @@ +// 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.Models; +using Azure.ResourceManager.OnlineExperimentation.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.OnlineExperimentation.Samples +{ + public partial class Sample_OnlineExperimentWorkspaceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateAnOnlineExperimentWorkspaceWithFreeSku() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_CreateOrUpdate.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation + string workspaceName = "expworkspace7"; + OnlineExperimentWorkspaceData data = new OnlineExperimentWorkspaceData(new AzureLocation("eastus2")) + { + Properties = new OnlineExperimentWorkspaceProperties(new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.OperationalInsights/workspaces/log9871"), new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.Storage/storageAccounts/sto9871"), new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.AppConfiguration/configurationStores/appconfig9871")), + Identity = new ManagedServiceIdentity("UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2")] = new UserAssignedIdentity() +}, + }, + Sku = new OnlineExperimentationWorkspaceSku(OnlineExperimentationWorkspaceSkuName.F0), + Tags = +{ +["newKey"] = "newVal" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workspaceName, data); + OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreateOrUpdateAnOnlineExperimentWorkspaceWithFreeSkuAndCustomerManagedKey() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_CreateOrUpdateWithEncryption.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation + string workspaceName = "expworkspace7"; + OnlineExperimentWorkspaceData data = new OnlineExperimentWorkspaceData(new AzureLocation("eastus2")) + { + Properties = new OnlineExperimentWorkspaceProperties(new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.OperationalInsights/workspaces/log9871"), new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.Storage/storageAccounts/sto9871"), new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.AppConfiguration/configurationStores/appconfig9871")) + { + CustomerManagedKeyEncryption = new CustomerManagedKeyEncryption + { + KeyEncryptionKeyIdentity = new KeyEncryptionKeyIdentity + { + IdentityType = KeyEncryptionKeyIdentityType.UserAssignedIdentity, + UserAssignedIdentityResourceId = new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1"), + }, + KeyEncryptionKeyUri = new Uri("https://contosovault.vault.azure.net/keys/contosokek"), + }, + }, + Identity = new ManagedServiceIdentity("UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2")] = new UserAssignedIdentity() +}, + }, + Sku = new OnlineExperimentationWorkspaceSku(OnlineExperimentationWorkspaceSkuName.F0), + Tags = +{ +["newKey"] = "newVal" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workspaceName, data); + OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetASingleOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Get.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation + string workspaceName = "expworkspace3"; + OnlineExperimentWorkspaceResource result = await collection.GetAsync(workspaceName); + + // 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 + OnlineExperimentWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListOnlineExperimentWorkspacesInAResourceGroup() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_ListByResourceGroup.json + // this example is just showing the usage of "OnlineExperimentWorkspace_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation and iterate over the result + await foreach (OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetASingleOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Get.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation + string workspaceName = "expworkspace3"; + bool result = await collection.ExistsAsync(workspaceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetASingleOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Get.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this OnlineExperimentWorkspaceResource + OnlineExperimentWorkspaceCollection collection = resourceGroupResource.GetOnlineExperimentWorkspaces(); + + // invoke the operation + string workspaceName = "expworkspace3"; + NullableResponse response = await collection.GetIfExistsAsync(workspaceName); + OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceResource.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceResource.cs new file mode 100644 index 000000000000..2f1537910618 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_OnlineExperimentWorkspaceResource.cs @@ -0,0 +1,180 @@ +// 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.Models; +using Azure.ResourceManager.OnlineExperimentation.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.OnlineExperimentation.Samples +{ + public partial class Sample_OnlineExperimentWorkspaceResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetASingleOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Get.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 OnlineExperimentWorkspaceResource created on azure + // for more information of creating OnlineExperimentWorkspaceResource, please refer to the document of OnlineExperimentWorkspaceResource + string subscriptionId = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + string workspaceName = "expworkspace3"; + ResourceIdentifier onlineExperimentWorkspaceResourceId = OnlineExperimentWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OnlineExperimentWorkspaceResource onlineExperimentWorkspace = client.GetOnlineExperimentWorkspaceResource(onlineExperimentWorkspaceResourceId); + + // invoke the operation + OnlineExperimentWorkspaceResource result = await onlineExperimentWorkspace.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 + OnlineExperimentWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteAnOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Delete.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 OnlineExperimentWorkspaceResource created on azure + // for more information of creating OnlineExperimentWorkspaceResource, please refer to the document of OnlineExperimentWorkspaceResource + string subscriptionId = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + string workspaceName = "expworkspace3"; + ResourceIdentifier onlineExperimentWorkspaceResourceId = OnlineExperimentWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OnlineExperimentWorkspaceResource onlineExperimentWorkspace = client.GetOnlineExperimentWorkspaceResource(onlineExperimentWorkspaceResourceId); + + // invoke the operation + await onlineExperimentWorkspace.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateAnOnlineExperimentWorkspace() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_Update.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 OnlineExperimentWorkspaceResource created on azure + // for more information of creating OnlineExperimentWorkspaceResource, please refer to the document of OnlineExperimentWorkspaceResource + string subscriptionId = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + string workspaceName = "expworkspace3"; + ResourceIdentifier onlineExperimentWorkspaceResourceId = OnlineExperimentWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OnlineExperimentWorkspaceResource onlineExperimentWorkspace = client.GetOnlineExperimentWorkspaceResource(onlineExperimentWorkspaceResourceId); + + // invoke the operation + OnlineExperimentWorkspaceData data = new OnlineExperimentWorkspaceData(default) + { + Identity = new ManagedServiceIdentity("UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2")] = new UserAssignedIdentity() +}, + }, + Tags = +{ +["newKey"] = "newVal" +}, + }; + ArmOperation lro = await onlineExperimentWorkspace.UpdateAsync(WaitUntil.Completed, data); + OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_UpdateAnOnlineExperimentWorkspaceWithCustomerManagedEncryptionKey() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_UpdateWithEncryption.json + // this example is just showing the usage of "OnlineExperimentWorkspace_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 OnlineExperimentWorkspaceResource created on azure + // for more information of creating OnlineExperimentWorkspaceResource, please refer to the document of OnlineExperimentWorkspaceResource + string subscriptionId = "fa5fc227-a624-475e-b696-cdd604c735bc"; + string resourceGroupName = "res9871"; + string workspaceName = "expworkspace3"; + ResourceIdentifier onlineExperimentWorkspaceResourceId = OnlineExperimentWorkspaceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName); + OnlineExperimentWorkspaceResource onlineExperimentWorkspace = client.GetOnlineExperimentWorkspaceResource(onlineExperimentWorkspaceResourceId); + + // invoke the operation + OnlineExperimentWorkspaceData data = new OnlineExperimentWorkspaceData(default) + { + Properties = new OnlineExperimentWorkspaceProperties(new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.OperationalInsights/workspaces/log9871"), new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/res9871/providers/Microsoft.Storage/storageAccounts/sto9871"), null) + { + CustomerManagedKeyEncryption = new CustomerManagedKeyEncryption + { + KeyEncryptionKeyIdentity = new KeyEncryptionKeyIdentity + { + IdentityType = KeyEncryptionKeyIdentityType.UserAssignedIdentity, + UserAssignedIdentityResourceId = new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1"), + }, + KeyEncryptionKeyUri = new Uri("https://contosovault.vault.azure.net/keys/contosokek"), + }, + }, + Identity = new ManagedServiceIdentity("UserAssigned") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id1")] = new UserAssignedIdentity(), +[new ResourceIdentifier("/subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/eu2cgroup/providers/Microsoft.ManagedIdentity/userAssignedIdentities/id2")] = new UserAssignedIdentity() +}, + }, + Tags = +{ +["newKey"] = "newVal" +}, + }; + ArmOperation lro = await onlineExperimentWorkspace.UpdateAsync(WaitUntil.Completed, data); + OnlineExperimentWorkspaceResource 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 + OnlineExperimentWorkspaceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..10c9728ba122 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.OnlineExperimentation.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetOnlineExperimentWorkspaces_ListOnlineExperimentWorkspacesInASubscription() + { + // Generated from example definition: 2025-05-31-preview/OnlineExperimentWorkspaces_ListBySubscription.json + // this example is just showing the usage of "OnlineExperimentWorkspace_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "fa5fc227-a624-475e-b696-cdd604c735bc"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (OnlineExperimentWorkspaceResource item in subscriptionResource.GetOnlineExperimentWorkspacesAsync()) + { + // 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 + OnlineExperimentWorkspaceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Azure.ResourceManager.OnlineExperimentation.csproj b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Azure.ResourceManager.OnlineExperimentation.csproj new file mode 100644 index 000000000000..0cd904f70d96 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Azure.ResourceManager.OnlineExperimentation.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider OnlineExperimentation. + 1.0.0-beta.1 + azure;management;arm;resource manager;onlineexperimentation + Azure.ResourceManager.OnlineExperimentation + + diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ArmOnlineExperimentationModelFactory.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ArmOnlineExperimentationModelFactory.cs new file mode 100644 index 000000000000..7c01043e0917 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ArmOnlineExperimentationModelFactory.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// Model factory for models. + public static partial class ArmOnlineExperimentationModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The managed service identities assigned to this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// A new instance for mocking. + public static OnlineExperimentWorkspaceData OnlineExperimentWorkspaceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, OnlineExperimentWorkspaceProperties properties = null, ManagedServiceIdentity identity = null, OnlineExperimentationWorkspaceSku sku = null) + { + tags ??= new Dictionary(); + + return new OnlineExperimentWorkspaceData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + identity, + sku, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The Id of the workspace. + /// The provisioning state for the resource. + /// The resource identifier of the Log Analytics workspace which online experiment workspace uses for generating experiment analysis results. + /// The resource identifier of storage account where logs are exported from Log Analytics workspace. Online Experiment workspace uses it generating experiment analysis results. + /// The resource identifier of App Configuration with which this online experiment workspace is tied for experimentation. This is a required field for creating an online experiment workspace. + /// The encryption configuration for the online experiment workspace resource. + /// The data plane endpoint for the online experiment workspace resource. + /// A new instance for mocking. + public static OnlineExperimentWorkspaceProperties OnlineExperimentWorkspaceProperties(string workspaceId = null, ResourceProvisioningState? provisioningState = null, ResourceIdentifier logAnalyticsWorkspaceResourceId = null, ResourceIdentifier logsExporterStorageAccountResourceId = null, ResourceIdentifier appConfigurationResourceId = null, CustomerManagedKeyEncryption customerManagedKeyEncryption = null, Uri endpoint = null) + { + return new OnlineExperimentWorkspaceProperties( + workspaceId, + provisioningState, + logAnalyticsWorkspaceResourceId, + logsExporterStorageAccountResourceId, + appConfigurationResourceId, + customerManagedKeyEncryption != null ? new ResourceEncryptionConfiguration(customerManagedKeyEncryption, serializedAdditionalRawData: null) : null, + endpoint, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the SKU. Ex - F0, P0. It is typically a letter+number code. + /// The name of the SKU tier. + /// A new instance for mocking. + public static OnlineExperimentationWorkspaceSku OnlineExperimentationWorkspaceSku(OnlineExperimentationWorkspaceSkuName name = default, OnlineExperimentationWorkspaceSkuTier? tier = null) + { + return new OnlineExperimentationWorkspaceSku(name, tier, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationArmClient.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationArmClient.cs new file mode 100644 index 000000000000..669fb77b6060 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationArmClient.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableOnlineExperimentationArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableOnlineExperimentationArmClient() + { + } + + /// 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 MockableOnlineExperimentationArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableOnlineExperimentationArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(ResourceIdentifier id) + { + OnlineExperimentWorkspaceResource.ValidateResourceId(id); + return new OnlineExperimentWorkspaceResource(Client, id); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationResourceGroupResource.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationResourceGroupResource.cs new file mode 100644 index 000000000000..195543a97bdb --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationResourceGroupResource.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableOnlineExperimentationResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableOnlineExperimentationResourceGroupResource() + { + } + + /// 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 MockableOnlineExperimentationResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of OnlineExperimentWorkspaceResources in the ResourceGroupResource. + /// An object representing collection of OnlineExperimentWorkspaceResources and their operations over a OnlineExperimentWorkspaceResource. + public virtual OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces() + { + return GetCachedClient(client => new OnlineExperimentWorkspaceCollection(client, Id)); + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetOnlineExperimentWorkspaceAsync(string workspaceName, CancellationToken cancellationToken = default) + { + return await GetOnlineExperimentWorkspaces().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetOnlineExperimentWorkspace(string workspaceName, CancellationToken cancellationToken = default) + { + return GetOnlineExperimentWorkspaces().Get(workspaceName, cancellationToken); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationSubscriptionResource.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationSubscriptionResource.cs new file mode 100644 index 000000000000..a60f6cd7553e --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/MockableOnlineExperimentationSubscriptionResource.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.OnlineExperimentation.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableOnlineExperimentationSubscriptionResource : ArmResource + { + private ClientDiagnostics _onlineExperimentWorkspaceClientDiagnostics; + private OnlineExperimentWorkspacesRestOperations _onlineExperimentWorkspaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableOnlineExperimentationSubscriptionResource() + { + } + + /// 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 MockableOnlineExperimentationSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics OnlineExperimentWorkspaceClientDiagnostics => _onlineExperimentWorkspaceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.OnlineExperimentation", OnlineExperimentWorkspaceResource.ResourceType.Namespace, Diagnostics); + private OnlineExperimentWorkspacesRestOperations OnlineExperimentWorkspaceRestClient => _onlineExperimentWorkspaceRestClient ??= new OnlineExperimentWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(OnlineExperimentWorkspaceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets all experiment workspaces in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetOnlineExperimentWorkspacesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OnlineExperimentWorkspaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OnlineExperimentWorkspaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OnlineExperimentWorkspaceResource(Client, OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(e)), OnlineExperimentWorkspaceClientDiagnostics, Pipeline, "MockableOnlineExperimentationSubscriptionResource.GetOnlineExperimentWorkspaces", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all experiment workspaces in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetOnlineExperimentWorkspaces(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => OnlineExperimentWorkspaceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => OnlineExperimentWorkspaceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OnlineExperimentWorkspaceResource(Client, OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(e)), OnlineExperimentWorkspaceClientDiagnostics, Pipeline, "MockableOnlineExperimentationSubscriptionResource.GetOnlineExperimentWorkspaces", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/OnlineExperimentationExtensions.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/OnlineExperimentationExtensions.cs new file mode 100644 index 000000000000..c66a6e467b46 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Extensions/OnlineExperimentationExtensions.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.OnlineExperimentation.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + /// A class to add extension methods to Azure.ResourceManager.OnlineExperimentation. + public static partial class OnlineExperimentationExtensions + { + private static MockableOnlineExperimentationArmClient GetMockableOnlineExperimentationArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableOnlineExperimentationArmClient(client0)); + } + + private static MockableOnlineExperimentationResourceGroupResource GetMockableOnlineExperimentationResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableOnlineExperimentationResourceGroupResource(client, resource.Id)); + } + + private static MockableOnlineExperimentationSubscriptionResource GetMockableOnlineExperimentationSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableOnlineExperimentationSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static OnlineExperimentWorkspaceResource GetOnlineExperimentWorkspaceResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableOnlineExperimentationArmClient(client).GetOnlineExperimentWorkspaceResource(id); + } + + /// + /// Gets a collection of OnlineExperimentWorkspaceResources in the ResourceGroupResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of OnlineExperimentWorkspaceResources and their operations over a OnlineExperimentWorkspaceResource. + public static OnlineExperimentWorkspaceCollection GetOnlineExperimentWorkspaces(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableOnlineExperimentationResourceGroupResource(resourceGroupResource).GetOnlineExperimentWorkspaces(); + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetOnlineExperimentWorkspaceAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableOnlineExperimentationResourceGroupResource(resourceGroupResource).GetOnlineExperimentWorkspaceAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetOnlineExperimentWorkspace(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableOnlineExperimentationResourceGroupResource(resourceGroupResource).GetOnlineExperimentWorkspace(workspaceName, cancellationToken); + } + + /// + /// Gets all experiment workspaces in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetOnlineExperimentWorkspacesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableOnlineExperimentationSubscriptionResource(subscriptionResource).GetOnlineExperimentWorkspacesAsync(cancellationToken); + } + + /// + /// Gets all experiment workspaces in the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListBySubscription + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetOnlineExperimentWorkspaces(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableOnlineExperimentationSubscriptionResource(subscriptionResource).GetOnlineExperimentWorkspaces(cancellationToken); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Argument.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..c344bacf5812 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..5eec91d4d3ae --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingList.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..d2c1828f4017 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// 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.Linq; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..37bad1d6b51c --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,399 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + internal static class ModelSerializationExtensions + { + internal static readonly JsonDocumentOptions JsonDocumentOptions = new JsonDocumentOptions { MaxDepth = 256 }; + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Optional.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..fc4221ab7bbf --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..0859f0f298eb --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentWorkspaceOperationSource.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentWorkspaceOperationSource.cs new file mode 100644 index 000000000000..bde0879813fb --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentWorkspaceOperationSource.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.ClientModel.Primitives; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + internal class OnlineExperimentWorkspaceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal OnlineExperimentWorkspaceOperationSource(ArmClient client) + { + _client = client; + } + + OnlineExperimentWorkspaceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new OnlineExperimentWorkspaceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new OnlineExperimentWorkspaceResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperation.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperation.cs new file mode 100644 index 000000000000..b53676065fb1 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperation.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.OnlineExperimentation +{ +#pragma warning disable SA1649 // File name should match first type name + internal class OnlineExperimentationArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of OnlineExperimentationArmOperation for mocking. + protected OnlineExperimentationArmOperation() + { + } + + internal OnlineExperimentationArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal OnlineExperimentationArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "OnlineExperimentationArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); + + /// + public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperationOfT.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperationOfT.cs new file mode 100644 index 000000000000..0dc74894eb2a --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/LongRunningOperation/OnlineExperimentationArmOperationOfT.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.OnlineExperimentation +{ +#pragma warning disable SA1649 // File name should match first type name + internal class OnlineExperimentationArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of OnlineExperimentationArmOperation for mocking. + protected OnlineExperimentationArmOperation() + { + } + + internal OnlineExperimentationArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal OnlineExperimentationArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "OnlineExperimentationArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); + + /// + public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.Serialization.cs new file mode 100644 index 000000000000..fa29bd6ca65f --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + public partial class CustomerManagedKeyEncryption : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomerManagedKeyEncryption)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(KeyEncryptionKeyIdentity)) + { + writer.WritePropertyName("keyEncryptionKeyIdentity"u8); + writer.WriteObjectValue(KeyEncryptionKeyIdentity, options); + } + if (Optional.IsDefined(KeyEncryptionKeyUri)) + { + writer.WritePropertyName("keyEncryptionKeyUrl"u8); + writer.WriteStringValue(KeyEncryptionKeyUri.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CustomerManagedKeyEncryption IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CustomerManagedKeyEncryption)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCustomerManagedKeyEncryption(document.RootElement, options); + } + + internal static CustomerManagedKeyEncryption DeserializeCustomerManagedKeyEncryption(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyEncryptionKeyIdentity keyEncryptionKeyIdentity = default; + Uri keyEncryptionKeyUrl = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyEncryptionKeyIdentity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyEncryptionKeyIdentity = KeyEncryptionKeyIdentity.DeserializeKeyEncryptionKeyIdentity(property.Value, options); + continue; + } + if (property.NameEquals("keyEncryptionKeyUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyEncryptionKeyUrl = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CustomerManagedKeyEncryption(keyEncryptionKeyIdentity, keyEncryptionKeyUrl, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CustomerManagedKeyEncryption)} does not support writing '{options.Format}' format."); + } + } + + CustomerManagedKeyEncryption IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCustomerManagedKeyEncryption(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CustomerManagedKeyEncryption)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.cs new file mode 100644 index 000000000000..086b415c91c4 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/CustomerManagedKeyEncryption.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// Customer-managed key encryption properties for the resource. + public partial class CustomerManagedKeyEncryption + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CustomerManagedKeyEncryption() + { + } + + /// Initializes a new instance of . + /// All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. + /// key encryption key Url, versioned or non-versioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. + /// Keeps track of any properties unknown to the library. + internal CustomerManagedKeyEncryption(KeyEncryptionKeyIdentity keyEncryptionKeyIdentity, Uri keyEncryptionKeyUri, IDictionary serializedAdditionalRawData) + { + KeyEncryptionKeyIdentity = keyEncryptionKeyIdentity; + KeyEncryptionKeyUri = keyEncryptionKeyUri; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. + public KeyEncryptionKeyIdentity KeyEncryptionKeyIdentity { get; set; } + /// key encryption key Url, versioned or non-versioned. Ex: https://contosovault.vault.azure.net/keys/contosokek/562a4bb76b524a1493a6afe8e536ee78 or https://contosovault.vault.azure.net/keys/contosokek. + public Uri KeyEncryptionKeyUri { get; set; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.Serialization.cs new file mode 100644 index 000000000000..967d746855d2 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.Serialization.cs @@ -0,0 +1,163 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + public partial class KeyEncryptionKeyIdentity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyEncryptionKeyIdentity)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(IdentityType)) + { + writer.WritePropertyName("identityType"u8); + writer.WriteStringValue(IdentityType.Value.ToString()); + } + if (Optional.IsDefined(UserAssignedIdentityResourceId)) + { + writer.WritePropertyName("userAssignedIdentityResourceId"u8); + writer.WriteStringValue(UserAssignedIdentityResourceId); + } + if (Optional.IsDefined(FederatedClientId)) + { + writer.WritePropertyName("federatedClientId"u8); + writer.WriteStringValue(FederatedClientId.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + KeyEncryptionKeyIdentity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(KeyEncryptionKeyIdentity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyEncryptionKeyIdentity(document.RootElement, options); + } + + internal static KeyEncryptionKeyIdentity DeserializeKeyEncryptionKeyIdentity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyEncryptionKeyIdentityType? identityType = default; + ResourceIdentifier userAssignedIdentityResourceId = default; + Guid? federatedClientId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identityType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + identityType = new KeyEncryptionKeyIdentityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("userAssignedIdentityResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userAssignedIdentityResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("federatedClientId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + federatedClientId = property.Value.GetGuid(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyEncryptionKeyIdentity(identityType, userAssignedIdentityResourceId, federatedClientId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyEncryptionKeyIdentity)} does not support writing '{options.Format}' format."); + } + } + + KeyEncryptionKeyIdentity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeKeyEncryptionKeyIdentity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyEncryptionKeyIdentity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.cs new file mode 100644 index 000000000000..7f917da8f03e --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentity.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// All identity configuration for Customer-managed key settings defining which identity should be used to auth to Key Vault. + public partial class KeyEncryptionKeyIdentity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public KeyEncryptionKeyIdentity() + { + } + + /// Initializes a new instance of . + /// The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity. + /// User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<resource group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. + /// application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540. + /// Keeps track of any properties unknown to the library. + internal KeyEncryptionKeyIdentity(KeyEncryptionKeyIdentityType? identityType, ResourceIdentifier userAssignedIdentityResourceId, Guid? federatedClientId, IDictionary serializedAdditionalRawData) + { + IdentityType = identityType; + UserAssignedIdentityResourceId = userAssignedIdentityResourceId; + FederatedClientId = federatedClientId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type of identity to use. Values can be systemAssignedIdentity, userAssignedIdentity, or delegatedResourceIdentity. + public KeyEncryptionKeyIdentityType? IdentityType { get; set; } + /// User assigned identity to use for accessing key encryption key Url. Ex: /subscriptions/fa5fc227-a624-475e-b696-cdd604c735bc/resourceGroups/<resource group>/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myId. Mutually exclusive with identityType systemAssignedIdentity. + public ResourceIdentifier UserAssignedIdentityResourceId { get; set; } + /// application client identity to use for accessing key encryption key Url in a different tenant. Ex: f83c6b1b-4d34-47e4-bb34-9d83df58b540. + public Guid? FederatedClientId { get; set; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentityType.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentityType.cs new file mode 100644 index 000000000000..5dcc17dbd48e --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/KeyEncryptionKeyIdentityType.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.OnlineExperimentation.Models +{ + /// The type of identity to use. + public readonly partial struct KeyEncryptionKeyIdentityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public KeyEncryptionKeyIdentityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SystemAssignedIdentityValue = "SystemAssignedIdentity"; + private const string UserAssignedIdentityValue = "UserAssignedIdentity"; + + /// System assigned identity. + public static KeyEncryptionKeyIdentityType SystemAssignedIdentity { get; } = new KeyEncryptionKeyIdentityType(SystemAssignedIdentityValue); + /// User assigned identity. + public static KeyEncryptionKeyIdentityType UserAssignedIdentity { get; } = new KeyEncryptionKeyIdentityType(UserAssignedIdentityValue); + /// Determines if two values are the same. + public static bool operator ==(KeyEncryptionKeyIdentityType left, KeyEncryptionKeyIdentityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(KeyEncryptionKeyIdentityType left, KeyEncryptionKeyIdentityType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator KeyEncryptionKeyIdentityType(string value) => new KeyEncryptionKeyIdentityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KeyEncryptionKeyIdentityType other && Equals(other); + /// + public bool Equals(KeyEncryptionKeyIdentityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.Serialization.cs new file mode 100644 index 000000000000..9ea5d4525510 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + internal partial class OnlineExperimentWorkspaceListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OnlineExperimentWorkspaceListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOnlineExperimentWorkspaceListResult(document.RootElement, options); + } + + internal static OnlineExperimentWorkspaceListResult DeserializeOnlineExperimentWorkspaceListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OnlineExperimentWorkspaceListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceListResult)} does not support writing '{options.Format}' format."); + } + } + + OnlineExperimentWorkspaceListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOnlineExperimentWorkspaceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.cs new file mode 100644 index 000000000000..283ace09b30b --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// The response of a OnlineExperimentWorkspace list operation. + internal partial class OnlineExperimentWorkspaceListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The OnlineExperimentWorkspace items on this page. + /// is null. + internal OnlineExperimentWorkspaceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The OnlineExperimentWorkspace items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal OnlineExperimentWorkspaceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OnlineExperimentWorkspaceListResult() + { + } + + /// The OnlineExperimentWorkspace items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.Serialization.cs new file mode 100644 index 000000000000..d9b545861be3 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.Serialization.cs @@ -0,0 +1,206 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + public partial class OnlineExperimentWorkspaceProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(WorkspaceId)) + { + writer.WritePropertyName("workspaceId"u8); + writer.WriteStringValue(WorkspaceId); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("logAnalyticsWorkspaceResourceId"u8); + writer.WriteStringValue(LogAnalyticsWorkspaceResourceId); + writer.WritePropertyName("logsExporterStorageAccountResourceId"u8); + writer.WriteStringValue(LogsExporterStorageAccountResourceId); + writer.WritePropertyName("appConfigurationResourceId"u8); + writer.WriteStringValue(AppConfigurationResourceId); + if (Optional.IsDefined(Encryption)) + { + writer.WritePropertyName("encryption"u8); + writer.WriteObjectValue(Encryption, options); + } + if (options.Format != "W" && Optional.IsDefined(Endpoint)) + { + writer.WritePropertyName("endpoint"u8); + writer.WriteStringValue(Endpoint.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OnlineExperimentWorkspaceProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOnlineExperimentWorkspaceProperties(document.RootElement, options); + } + + internal static OnlineExperimentWorkspaceProperties DeserializeOnlineExperimentWorkspaceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string workspaceId = default; + ResourceProvisioningState? provisioningState = default; + ResourceIdentifier logAnalyticsWorkspaceResourceId = default; + ResourceIdentifier logsExporterStorageAccountResourceId = default; + ResourceIdentifier appConfigurationResourceId = default; + ResourceEncryptionConfiguration encryption = default; + Uri endpoint = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("workspaceId"u8)) + { + workspaceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ResourceProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("logAnalyticsWorkspaceResourceId"u8)) + { + logAnalyticsWorkspaceResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("logsExporterStorageAccountResourceId"u8)) + { + logsExporterStorageAccountResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("appConfigurationResourceId"u8)) + { + appConfigurationResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("encryption"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + encryption = ResourceEncryptionConfiguration.DeserializeResourceEncryptionConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("endpoint"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endpoint = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OnlineExperimentWorkspaceProperties( + workspaceId, + provisioningState, + logAnalyticsWorkspaceResourceId, + logsExporterStorageAccountResourceId, + appConfigurationResourceId, + encryption, + endpoint, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceProperties)} does not support writing '{options.Format}' format."); + } + } + + OnlineExperimentWorkspaceProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOnlineExperimentWorkspaceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.cs new file mode 100644 index 000000000000..371b76ee88f2 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentWorkspaceProperties.cs @@ -0,0 +1,118 @@ +// 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.OnlineExperimentation.Models +{ + /// The properties of an online experiment workspace. + public partial class OnlineExperimentWorkspaceProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The resource identifier of the Log Analytics workspace which online experiment workspace uses for generating experiment analysis results. + /// The resource identifier of storage account where logs are exported from Log Analytics workspace. Online Experiment workspace uses it generating experiment analysis results. + /// The resource identifier of App Configuration with which this online experiment workspace is tied for experimentation. This is a required field for creating an online experiment workspace. + /// , or is null. + public OnlineExperimentWorkspaceProperties(ResourceIdentifier logAnalyticsWorkspaceResourceId, ResourceIdentifier logsExporterStorageAccountResourceId, ResourceIdentifier appConfigurationResourceId) + { + Argument.AssertNotNull(logAnalyticsWorkspaceResourceId, nameof(logAnalyticsWorkspaceResourceId)); + Argument.AssertNotNull(logsExporterStorageAccountResourceId, nameof(logsExporterStorageAccountResourceId)); + Argument.AssertNotNull(appConfigurationResourceId, nameof(appConfigurationResourceId)); + + LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; + LogsExporterStorageAccountResourceId = logsExporterStorageAccountResourceId; + AppConfigurationResourceId = appConfigurationResourceId; + } + + /// Initializes a new instance of . + /// The Id of the workspace. + /// The provisioning state for the resource. + /// The resource identifier of the Log Analytics workspace which online experiment workspace uses for generating experiment analysis results. + /// The resource identifier of storage account where logs are exported from Log Analytics workspace. Online Experiment workspace uses it generating experiment analysis results. + /// The resource identifier of App Configuration with which this online experiment workspace is tied for experimentation. This is a required field for creating an online experiment workspace. + /// The encryption configuration for the online experiment workspace resource. + /// The data plane endpoint for the online experiment workspace resource. + /// Keeps track of any properties unknown to the library. + internal OnlineExperimentWorkspaceProperties(string workspaceId, ResourceProvisioningState? provisioningState, ResourceIdentifier logAnalyticsWorkspaceResourceId, ResourceIdentifier logsExporterStorageAccountResourceId, ResourceIdentifier appConfigurationResourceId, ResourceEncryptionConfiguration encryption, Uri endpoint, IDictionary serializedAdditionalRawData) + { + WorkspaceId = workspaceId; + ProvisioningState = provisioningState; + LogAnalyticsWorkspaceResourceId = logAnalyticsWorkspaceResourceId; + LogsExporterStorageAccountResourceId = logsExporterStorageAccountResourceId; + AppConfigurationResourceId = appConfigurationResourceId; + Encryption = encryption; + Endpoint = endpoint; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OnlineExperimentWorkspaceProperties() + { + } + + /// The Id of the workspace. + public string WorkspaceId { get; } + /// The provisioning state for the resource. + public ResourceProvisioningState? ProvisioningState { get; } + /// The resource identifier of the Log Analytics workspace which online experiment workspace uses for generating experiment analysis results. + public ResourceIdentifier LogAnalyticsWorkspaceResourceId { get; set; } + /// The resource identifier of storage account where logs are exported from Log Analytics workspace. Online Experiment workspace uses it generating experiment analysis results. + public ResourceIdentifier LogsExporterStorageAccountResourceId { get; set; } + /// The resource identifier of App Configuration with which this online experiment workspace is tied for experimentation. This is a required field for creating an online experiment workspace. + public ResourceIdentifier AppConfigurationResourceId { get; set; } + /// The encryption configuration for the online experiment workspace resource. + internal ResourceEncryptionConfiguration Encryption { get; set; } + /// All Customer-managed key encryption properties for the resource. + public CustomerManagedKeyEncryption CustomerManagedKeyEncryption + { + get => Encryption is null ? default : Encryption.CustomerManagedKeyEncryption; + set + { + if (Encryption is null) + Encryption = new ResourceEncryptionConfiguration(); + Encryption.CustomerManagedKeyEncryption = value; + } + } + + /// The data plane endpoint for the online experiment workspace resource. + public Uri Endpoint { get; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.Serialization.cs new file mode 100644 index 000000000000..7020ae79bacd --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + public partial class OnlineExperimentationWorkspaceSku : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OnlineExperimentationWorkspaceSku)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name.ToString()); + if (options.Format != "W" && Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + OnlineExperimentationWorkspaceSku IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OnlineExperimentationWorkspaceSku)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOnlineExperimentationWorkspaceSku(document.RootElement, options); + } + + internal static OnlineExperimentationWorkspaceSku DeserializeOnlineExperimentationWorkspaceSku(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OnlineExperimentationWorkspaceSkuName name = default; + OnlineExperimentationWorkspaceSkuTier? tier = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = new OnlineExperimentationWorkspaceSkuName(property.Value.GetString()); + continue; + } + if (property.NameEquals("tier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tier = new OnlineExperimentationWorkspaceSkuTier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OnlineExperimentationWorkspaceSku(name, tier, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OnlineExperimentationWorkspaceSku)} does not support writing '{options.Format}' format."); + } + } + + OnlineExperimentationWorkspaceSku IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOnlineExperimentationWorkspaceSku(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OnlineExperimentationWorkspaceSku)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.cs new file mode 100644 index 000000000000..6eca9afe394e --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSku.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// The SKU (Stock Keeping Unit) assigned to this resource. + public partial class OnlineExperimentationWorkspaceSku + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the SKU. Ex - F0, P0. It is typically a letter+number code. + public OnlineExperimentationWorkspaceSku(OnlineExperimentationWorkspaceSkuName name) + { + Name = name; + } + + /// Initializes a new instance of . + /// The name of the SKU. Ex - F0, P0. It is typically a letter+number code. + /// The name of the SKU tier. + /// Keeps track of any properties unknown to the library. + internal OnlineExperimentationWorkspaceSku(OnlineExperimentationWorkspaceSkuName name, OnlineExperimentationWorkspaceSkuTier? tier, IDictionary serializedAdditionalRawData) + { + Name = name; + Tier = tier; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OnlineExperimentationWorkspaceSku() + { + } + + /// The name of the SKU. Ex - F0, P0. It is typically a letter+number code. + public OnlineExperimentationWorkspaceSkuName Name { get; set; } + /// The name of the SKU tier. + public OnlineExperimentationWorkspaceSkuTier? Tier { get; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuName.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuName.cs new file mode 100644 index 000000000000..8a9bc528f7cf --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuName.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// The allowed SKU names for the online experimentation workspace. + public readonly partial struct OnlineExperimentationWorkspaceSkuName : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OnlineExperimentationWorkspaceSkuName(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string F0Value = "F0"; + private const string S0Value = "S0"; + private const string P0Value = "P0"; + private const string D0Value = "D0"; + + /// The Free service sku name. + public static OnlineExperimentationWorkspaceSkuName F0 { get; } = new OnlineExperimentationWorkspaceSkuName(F0Value); + /// The Standard service sku name. + public static OnlineExperimentationWorkspaceSkuName S0 { get; } = new OnlineExperimentationWorkspaceSkuName(S0Value); + /// The Premium service sku name. + public static OnlineExperimentationWorkspaceSkuName P0 { get; } = new OnlineExperimentationWorkspaceSkuName(P0Value); + /// The Developer service sku name. + public static OnlineExperimentationWorkspaceSkuName D0 { get; } = new OnlineExperimentationWorkspaceSkuName(D0Value); + /// Determines if two values are the same. + public static bool operator ==(OnlineExperimentationWorkspaceSkuName left, OnlineExperimentationWorkspaceSkuName right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OnlineExperimentationWorkspaceSkuName left, OnlineExperimentationWorkspaceSkuName right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OnlineExperimentationWorkspaceSkuName(string value) => new OnlineExperimentationWorkspaceSkuName(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OnlineExperimentationWorkspaceSkuName other && Equals(other); + /// + public bool Equals(OnlineExperimentationWorkspaceSkuName other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuTier.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuTier.cs new file mode 100644 index 000000000000..444b84a5c3ea --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/OnlineExperimentationWorkspaceSkuTier.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// The allowed SKU tiers for the online experimentation workspace. + public readonly partial struct OnlineExperimentationWorkspaceSkuTier : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OnlineExperimentationWorkspaceSkuTier(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FreeValue = "Free"; + private const string StandardValue = "Standard"; + private const string PremiumValue = "Premium"; + private const string DeveloperValue = "Developer"; + + /// The Free service tier. + public static OnlineExperimentationWorkspaceSkuTier Free { get; } = new OnlineExperimentationWorkspaceSkuTier(FreeValue); + /// The Standard service tier. + public static OnlineExperimentationWorkspaceSkuTier Standard { get; } = new OnlineExperimentationWorkspaceSkuTier(StandardValue); + /// The Premium service tier. + public static OnlineExperimentationWorkspaceSkuTier Premium { get; } = new OnlineExperimentationWorkspaceSkuTier(PremiumValue); + /// The Developer service tier. + public static OnlineExperimentationWorkspaceSkuTier Developer { get; } = new OnlineExperimentationWorkspaceSkuTier(DeveloperValue); + /// Determines if two values are the same. + public static bool operator ==(OnlineExperimentationWorkspaceSkuTier left, OnlineExperimentationWorkspaceSkuTier right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OnlineExperimentationWorkspaceSkuTier left, OnlineExperimentationWorkspaceSkuTier right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OnlineExperimentationWorkspaceSkuTier(string value) => new OnlineExperimentationWorkspaceSkuTier(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OnlineExperimentationWorkspaceSkuTier other && Equals(other); + /// + public bool Equals(OnlineExperimentationWorkspaceSkuTier other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.Serialization.cs new file mode 100644 index 000000000000..ce14517f4e15 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + internal partial class ResourceEncryptionConfiguration : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceEncryptionConfiguration)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(CustomerManagedKeyEncryption)) + { + writer.WritePropertyName("customerManagedKeyEncryption"u8); + writer.WriteObjectValue(CustomerManagedKeyEncryption, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceEncryptionConfiguration IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceEncryptionConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceEncryptionConfiguration(document.RootElement, options); + } + + internal static ResourceEncryptionConfiguration DeserializeResourceEncryptionConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CustomerManagedKeyEncryption customerManagedKeyEncryption = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("customerManagedKeyEncryption"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + customerManagedKeyEncryption = CustomerManagedKeyEncryption.DeserializeCustomerManagedKeyEncryption(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceEncryptionConfiguration(customerManagedKeyEncryption, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ResourceEncryptionConfiguration)} does not support writing '{options.Format}' format."); + } + } + + ResourceEncryptionConfiguration IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceEncryptionConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceEncryptionConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.cs new file mode 100644 index 000000000000..8e79d4cb8d3d --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceEncryptionConfiguration.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.OnlineExperimentation.Models +{ + /// The encryption configuration for the online experiment workspace resource. + internal partial class ResourceEncryptionConfiguration + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ResourceEncryptionConfiguration() + { + } + + /// Initializes a new instance of . + /// All Customer-managed key encryption properties for the resource. + /// Keeps track of any properties unknown to the library. + internal ResourceEncryptionConfiguration(CustomerManagedKeyEncryption customerManagedKeyEncryption, IDictionary serializedAdditionalRawData) + { + CustomerManagedKeyEncryption = customerManagedKeyEncryption; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// All Customer-managed key encryption properties for the resource. + public CustomerManagedKeyEncryption CustomerManagedKeyEncryption { get; set; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceProvisioningState.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceProvisioningState.cs new file mode 100644 index 000000000000..dcc279210b75 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/Models/ResourceProvisioningState.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.OnlineExperimentation.Models +{ + /// The provisioning state of a resource type. + public readonly partial struct ResourceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static ResourceProvisioningState Succeeded { get; } = new ResourceProvisioningState(SucceededValue); + /// Resource creation failed. + public static ResourceProvisioningState Failed { get; } = new ResourceProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ResourceProvisioningState Canceled { get; } = new ResourceProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceProvisioningState left, ResourceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceProvisioningState left, ResourceProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceProvisioningState(string value) => new ResourceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceProvisioningState other && Equals(other); + /// + public bool Equals(ResourceProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceCollection.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceCollection.cs new file mode 100644 index 000000000000..d2ae0bf7d049 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetOnlineExperimentWorkspaces method from an instance of . + /// + public partial class OnlineExperimentWorkspaceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _onlineExperimentWorkspaceClientDiagnostics; + private readonly OnlineExperimentWorkspacesRestOperations _onlineExperimentWorkspaceRestClient; + + /// Initializes a new instance of the class for mocking. + protected OnlineExperimentWorkspaceCollection() + { + } + + /// 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 OnlineExperimentWorkspaceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _onlineExperimentWorkspaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.OnlineExperimentation", OnlineExperimentWorkspaceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(OnlineExperimentWorkspaceResource.ResourceType, out string onlineExperimentWorkspaceApiVersion); + _onlineExperimentWorkspaceRestClient = new OnlineExperimentWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, onlineExperimentWorkspaceApiVersion); +#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 an experiment workspace, or update an existing workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the OnlineExperimentWorkspace. + /// Resource create parameters. + /// 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 workspaceName, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, data, cancellationToken).ConfigureAwait(false); + var operation = new OnlineExperimentationArmOperation(new OnlineExperimentWorkspaceOperationSource(Client), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, 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 an experiment workspace, or update an existing workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the OnlineExperimentWorkspace. + /// Resource create parameters. + /// 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 workspaceName, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, data, cancellationToken); + var operation = new OnlineExperimentationArmOperation(new OnlineExperimentWorkspaceOperationSource(Client), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.Get"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.Get"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets all experiment workspaces in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _onlineExperimentWorkspaceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _onlineExperimentWorkspaceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new OnlineExperimentWorkspaceResource(Client, OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(e)), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, "OnlineExperimentWorkspaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets all experiment workspaces in a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _onlineExperimentWorkspaceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _onlineExperimentWorkspaceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new OnlineExperimentWorkspaceResource(Client, OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(e)), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, "OnlineExperimentWorkspaceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.Exists"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, 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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.Exists"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, 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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(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.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the OnlineExperimentWorkspace. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(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/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.Serialization.cs new file mode 100644 index 000000000000..5477146b0b91 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.OnlineExperimentation.Models; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + public partial class OnlineExperimentWorkspaceData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + } + + OnlineExperimentWorkspaceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOnlineExperimentWorkspaceData(document.RootElement, options); + } + + internal static OnlineExperimentWorkspaceData DeserializeOnlineExperimentWorkspaceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + OnlineExperimentWorkspaceProperties properties = default; + ManagedServiceIdentity identity = default; + OnlineExperimentationWorkspaceSku sku = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = OnlineExperimentWorkspaceProperties.DeserializeOnlineExperimentWorkspaceProperties(property.Value, options); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = OnlineExperimentationWorkspaceSku.DeserializeOnlineExperimentationWorkspaceSku(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OnlineExperimentWorkspaceData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + identity, + sku, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceData)} does not support writing '{options.Format}' format."); + } + } + + OnlineExperimentWorkspaceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeOnlineExperimentWorkspaceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OnlineExperimentWorkspaceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.cs new file mode 100644 index 000000000000..54239ad0039c --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceData.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.OnlineExperimentation.Models; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + /// + /// A class representing the OnlineExperimentWorkspace data model. + /// An online experiment workspace resource. + /// + public partial class OnlineExperimentWorkspaceData : TrackedResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The location. + public OnlineExperimentWorkspaceData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The managed service identities assigned to this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal OnlineExperimentWorkspaceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, OnlineExperimentWorkspaceProperties properties, ManagedServiceIdentity identity, OnlineExperimentationWorkspaceSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OnlineExperimentWorkspaceData() + { + } + + /// The resource-specific properties for this resource. + public OnlineExperimentWorkspaceProperties Properties { get; set; } + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + public OnlineExperimentationWorkspaceSku Sku { get; set; } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.Serialization.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.Serialization.cs new file mode 100644 index 000000000000..95f593ce6d87 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + public partial class OnlineExperimentWorkspaceResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + OnlineExperimentWorkspaceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + OnlineExperimentWorkspaceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.cs new file mode 100644 index 000000000000..b374b1195ae7 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/OnlineExperimentWorkspaceResource.cs @@ -0,0 +1,706 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + /// + /// A Class representing an OnlineExperimentWorkspace along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetOnlineExperimentWorkspaceResource method. + /// Otherwise you can get one from its parent resource using the GetOnlineExperimentWorkspace method. + /// + public partial class OnlineExperimentWorkspaceResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The workspaceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _onlineExperimentWorkspaceClientDiagnostics; + private readonly OnlineExperimentWorkspacesRestOperations _onlineExperimentWorkspaceRestClient; + private readonly OnlineExperimentWorkspaceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.OnlineExperimentation/workspaces"; + + /// Initializes a new instance of the class for mocking. + protected OnlineExperimentWorkspaceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal OnlineExperimentWorkspaceResource(ArmClient client, OnlineExperimentWorkspaceData 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 OnlineExperimentWorkspaceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _onlineExperimentWorkspaceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.OnlineExperimentation", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string onlineExperimentWorkspaceApiVersion); + _onlineExperimentWorkspaceRestClient = new OnlineExperimentWorkspacesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, onlineExperimentWorkspaceApiVersion); +#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 OnlineExperimentWorkspaceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Get"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Get"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Delete + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Delete"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new OnlineExperimentationArmOperation(_onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Delete + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Delete"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new OnlineExperimentationArmOperation(_onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Update + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Update"); + scope.Start(); + try + { + var response = await _onlineExperimentWorkspaceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new OnlineExperimentationArmOperation(new OnlineExperimentWorkspaceOperationSource(Client), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Patch an experiment workspace + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Update + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.Update"); + scope.Start(); + try + { + var response = _onlineExperimentWorkspaceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); + var operation = new OnlineExperimentationArmOperation(new OnlineExperimentWorkspaceOperationSource(Client), _onlineExperimentWorkspaceClientDiagnostics, Pipeline, _onlineExperimentWorkspaceRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new OnlineExperimentWorkspaceData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new OnlineExperimentWorkspaceData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new OnlineExperimentWorkspaceData(current.Location); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new OnlineExperimentWorkspaceData(current.Location); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _onlineExperimentWorkspaceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new OnlineExperimentWorkspaceData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.OnlineExperimentation/workspaces/{workspaceName} + /// + /// + /// Operation Id + /// OnlineExperimentWorkspace_Get + /// + /// + /// Default Api Version + /// 2025-05-31-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _onlineExperimentWorkspaceClientDiagnostics.CreateScope("OnlineExperimentWorkspaceResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _onlineExperimentWorkspaceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new OnlineExperimentWorkspaceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new OnlineExperimentWorkspaceData(current.Location); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ProviderConstants.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..f27b73f85b77 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/ProviderConstants.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/RestOperations/OnlineExperimentWorkspacesRestOperations.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/RestOperations/OnlineExperimentWorkspacesRestOperations.cs new file mode 100644 index 000000000000..69662412aae9 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Generated/RestOperations/OnlineExperimentWorkspacesRestOperations.cs @@ -0,0 +1,723 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.OnlineExperimentation.Models; + +namespace Azure.ResourceManager.OnlineExperimentation +{ + internal partial class OnlineExperimentWorkspacesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of OnlineExperimentWorkspacesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public OnlineExperimentWorkspacesRestOperations(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 ?? "2025-05-31-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string workspaceName) + { + 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((OnlineExperimentWorkspaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OnlineExperimentWorkspaceData.DeserializeOnlineExperimentWorkspaceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((OnlineExperimentWorkspaceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, OnlineExperimentWorkspaceData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string workspaceName, OnlineExperimentWorkspaceData 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create an experiment workspace, or update an existing workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// Resource create parameters. + /// 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, string workspaceName, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, workspaceName, 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 an experiment workspace, or update an existing workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// Resource create parameters. + /// 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, string workspaceName, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, workspaceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string workspaceName, OnlineExperimentWorkspaceData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string workspaceName, OnlineExperimentWorkspaceData data) + { + 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Patch an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// The resource properties to be updated. + /// 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, string workspaceName, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Patch an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// The resource properties to be updated. + /// 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, string workspaceName, OnlineExperimentWorkspaceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string workspaceName) + { + 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + 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.OnlineExperimentation/workspaces/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Deletes an experiment workspace. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the OnlineExperimentWorkspace. + /// 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, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + { + 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.OnlineExperimentation/workspaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + 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.OnlineExperimentation/workspaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all experiment workspaces in a resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all experiment workspaces in a resource group. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.OnlineExperimentation/workspaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + 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("/providers/Microsoft.OnlineExperimentation/workspaces", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets all experiment workspaces in the specified subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all experiment workspaces in the specified subscription. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListByResourceGroupNextPageRequestUri(string nextLink, string subscriptionId, string resourceGroupName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + 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; + } + + /// Gets all experiment workspaces in a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all experiment workspaces in a resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + 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; + } + + /// Gets all experiment workspaces in the specified subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets all experiment workspaces in the specified subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + OnlineExperimentWorkspaceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = OnlineExperimentWorkspaceListResult.DeserializeOnlineExperimentWorkspaceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Properties/AssemblyInfo.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..4aeb666286c8 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.ResourceManager.OnlineExperimentation.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("OnlineExperimentation")] diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/Azure.ResourceManager.OnlineExperimentation.Tests.csproj b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/Azure.ResourceManager.OnlineExperimentation.Tests.csproj new file mode 100644 index 000000000000..509ef6525348 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/Azure.ResourceManager.OnlineExperimentation.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestBase.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestBase.cs new file mode 100644 index 000000000000..fac75bab168d --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestBase.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.OnlineExperimentation.Tests +{ + public class OnlineExperimentationManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected OnlineExperimentationManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected OnlineExperimentationManagementTestBase(bool isAsync) + : base(isAsync) + { + } + + [SetUp] + public async Task CreateCommonClient() + { + Client = GetArmClient(); + DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false); + } + + protected async Task CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location) + { + string rgName = Recording.GenerateAssetName(rgNamePrefix); + ResourceGroupData input = new ResourceGroupData(location); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input); + return lro.Value; + } + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestEnvironment.cs b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestEnvironment.cs new file mode 100644 index 000000000000..79cae7dfee21 --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tests/OnlineExperimentationManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.OnlineExperimentation.Tests +{ + public class OnlineExperimentationManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tsp-location.yaml b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tsp-location.yaml new file mode 100644 index 000000000000..574b0a96810c --- /dev/null +++ b/sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/onlineexperimentation/OnlineExperimentation.Management +commit: 1c71ea4dde7f56d8dda50967edc2e204a8b5e90a +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/onlineexperimentation/ci.mgmt.yml b/sdk/onlineexperimentation/ci.mgmt.yml new file mode 100644 index 000000000000..0fe2fec93cce --- /dev/null +++ b/sdk/onlineexperimentation/ci.mgmt.yml @@ -0,0 +1,26 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: none + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/onlineexperimentation /ci.mgmt.yml + - sdk/onlineexperimentation /Azure.ResourceManager.OnlineExperimentation / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: onlineexperimentation + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.OnlineExperimentation + safeName: AzureResourceManagerOnlineExperimentation diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index 4e3c032f60a4..1960beba532e 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -144,6 +144,7 @@ trigger: - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability - sdk/nginx/Azure.ResourceManager.Nginx - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs + - sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights - sdk/oracle/Azure.ResourceManager.OracleDatabase @@ -353,6 +354,7 @@ pr: - sdk/newrelicobservability/Azure.ResourceManager.NewRelicObservability - sdk/nginx/Azure.ResourceManager.Nginx - sdk/notificationhubs/Azure.ResourceManager.NotificationHubs + - sdk/onlineexperimentation/Azure.ResourceManager.OnlineExperimentation - sdk/openenergyplatform/Azure.ResourceManager.EnergyServices - sdk/operationalinsights/Azure.ResourceManager.OperationalInsights - sdk/oracle/Azure.ResourceManager.OracleDatabase diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/