diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Azure.ResourceManager.SecretsStoreExtension.sln b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Azure.ResourceManager.SecretsStoreExtension.sln new file mode 100644 index 000000000000..7fcb23ea74c2 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Azure.ResourceManager.SecretsStoreExtension.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.SecretsStoreExtension.Samples", "samples\Azure.ResourceManager.SecretsStoreExtension.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.SecretsStoreExtension", "src\Azure.ResourceManager.SecretsStoreExtension.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.SecretsStoreExtension.Tests", "tests\Azure.ResourceManager.SecretsStoreExtension.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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/CHANGELOG.md b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Directory.Build.props b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/README.md b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/README.md new file mode 100644 index 000000000000..9783f2218f26 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure SecretsStoreExtension 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 SecretsStoreExtension management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.SecretsStoreExtension --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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.net8.0.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.net8.0.cs new file mode 100644 index 000000000000..5405ecf534ab --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.net8.0.cs @@ -0,0 +1,346 @@ +namespace Azure.ResourceManager.SecretsStoreExtension +{ + public partial class KeyVaultSecretProviderClassCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected KeyVaultSecretProviderClassCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string azureKeyVaultSecretProviderClassName, Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string azureKeyVaultSecretProviderClassName, Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string azureKeyVaultSecretProviderClassName, 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 azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string azureKeyVaultSecretProviderClassName, 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 KeyVaultSecretProviderClassData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyVaultSecretProviderClassData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.KeyVaultSecretProviderClassProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassData 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.SecretsStoreExtension.KeyVaultSecretProviderClassData 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 KeyVaultSecretProviderClassResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected KeyVaultSecretProviderClassResource() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassData 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 azureKeyVaultSecretProviderClassName) { 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.SecretsStoreExtension.KeyVaultSecretProviderClassData 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.SecretsStoreExtension.KeyVaultSecretProviderClassData 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.SecretsStoreExtension.Models.KeyVaultSecretProviderClassPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecretsStoreExtension.Models.KeyVaultSecretProviderClassPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class SecretsStoreExtensionExtensions + { + public static Azure.Response GetKeyVaultSecretProviderClass(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetKeyVaultSecretProviderClassAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassCollection GetKeyVaultSecretProviderClasses(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetKeyVaultSecretProviderClasses(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetKeyVaultSecretProviderClassesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassResource GetKeyVaultSecretProviderClassResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetSecretSync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSecretSyncAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncResource GetSecretSyncResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncCollection GetSecretSyncs(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSecretSyncs(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSecretSyncsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SecretSyncCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SecretSyncCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string secretSyncName, Azure.ResourceManager.SecretsStoreExtension.SecretSyncData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string secretSyncName, Azure.ResourceManager.SecretsStoreExtension.SecretSyncData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string secretSyncName, 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 secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string secretSyncName, 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 SecretSyncData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.SecretSyncData 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 SecretSyncResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SecretSyncResource() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncData 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 secretSyncName) { 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.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.Models.SecretSyncPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.SecretsStoreExtension.Mocking +{ + public partial class MockableSecretsStoreExtensionArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionArmClient() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassResource GetKeyVaultSecretProviderClassResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncResource GetSecretSyncResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSecretsStoreExtensionResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionResourceGroupResource() { } + public virtual Azure.Response GetKeyVaultSecretProviderClass(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKeyVaultSecretProviderClassAsync(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassCollection GetKeyVaultSecretProviderClasses() { throw null; } + public virtual Azure.Response GetSecretSync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecretSyncAsync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncCollection GetSecretSyncs() { throw null; } + } + public partial class MockableSecretsStoreExtensionSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionSubscriptionResource() { } + public virtual Azure.Pageable GetKeyVaultSecretProviderClasses(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetKeyVaultSecretProviderClassesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSecretSyncs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecretSyncsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public static partial class ArmSecretsStoreExtensionModelFactory + { + public static Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassData KeyVaultSecretProviderClassData(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.SecretsStoreExtension.Models.KeyVaultSecretProviderClassProperties properties = null, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.KeyVaultSecretProviderClassProperties KeyVaultSecretProviderClassProperties(string keyvaultName = null, string clientId = null, string tenantId = null, string objects = null, Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState? provisioningState = default(Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState?)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncCondition SecretSyncCondition(System.DateTimeOffset? lastTransitionOn = default(System.DateTimeOffset?), string message = null, long? observedGeneration = default(long?), string reason = null, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType status = default(Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType), string type = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncData SecretSyncData(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.SecretsStoreExtension.Models.SecretSyncProperties properties = null, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties SecretSyncProperties(string secretProviderClassName = null, string serviceAccountName = null, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType kubernetesSecretType = default(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType), string forceSynchronization = null, System.Collections.Generic.IEnumerable objectSecretMapping = null, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus status = null, Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState? provisioningState = default(Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState?)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus SecretSyncStatus(System.DateTimeOffset? lastSuccessfulSyncOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable conditions = null) { throw null; } + } + public partial class AzureKeyVaultSecretProviderClassUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureKeyVaultSecretProviderClassUpdateProperties() { } + public string ClientId { get { throw null; } set { } } + public string KeyvaultName { get { throw null; } set { } } + public string Objects { get { throw null; } set { } } + public string TenantId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties 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 KeyVaultSecretProviderClassPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyVaultSecretProviderClassPatch() { } + public Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.KeyVaultSecretProviderClassPatch 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.SecretsStoreExtension.Models.KeyVaultSecretProviderClassPatch 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 KeyVaultSecretProviderClassProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyVaultSecretProviderClassProperties(string keyvaultName, string clientId, string tenantId) { } + public string ClientId { get { throw null; } set { } } + public string KeyvaultName { get { throw null; } set { } } + public string Objects { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState? ProvisioningState { get { throw null; } } + public string TenantId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.KeyVaultSecretProviderClassProperties 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.SecretsStoreExtension.Models.KeyVaultSecretProviderClassProperties 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 KubernetesSecretObjectMapping : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KubernetesSecretObjectMapping(string sourcePath, string targetKey) { } + public string SourcePath { get { throw null; } set { } } + public string TargetKey { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretObjectMapping 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.SecretsStoreExtension.Models.KubernetesSecretObjectMapping 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 KubernetesSecretType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public KubernetesSecretType(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType Opaque { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType Tls { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType 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.SecretsStoreExtension.Models.KubernetesSecretType left, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType left, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SecretsStoreExtensionProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SecretsStoreExtensionProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState 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.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState left, Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState left, Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SecretSyncCondition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SecretSyncCondition() { } + public System.DateTimeOffset? LastTransitionOn { get { throw null; } } + public string Message { get { throw null; } } + public long? ObservedGeneration { get { throw null; } } + public string Reason { get { throw null; } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType Status { get { throw null; } } + public string Type { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncCondition 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.SecretsStoreExtension.Models.SecretSyncCondition 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 SecretSyncConditionStatusType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SecretSyncConditionStatusType(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType False { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType True { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType 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.SecretsStoreExtension.Models.SecretSyncConditionStatusType left, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType left, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SecretSyncPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncPatch() { } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncPatch 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.SecretsStoreExtension.Models.SecretSyncPatch 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 SecretSyncProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncProperties(string secretProviderClassName, string serviceAccountName, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType kubernetesSecretType, System.Collections.Generic.IEnumerable objectSecretMapping) { } + public string ForceSynchronization { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType KubernetesSecretType { get { throw null; } set { } } + public System.Collections.Generic.IList ObjectSecretMapping { get { throw null; } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState? ProvisioningState { get { throw null; } } + public string SecretProviderClassName { get { throw null; } set { } } + public string ServiceAccountName { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties 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.SecretsStoreExtension.Models.SecretSyncProperties 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 SecretSyncStatus : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SecretSyncStatus() { } + public System.Collections.Generic.IReadOnlyList Conditions { get { throw null; } } + public System.DateTimeOffset? LastSuccessfulSyncOn { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus 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.SecretsStoreExtension.Models.SecretSyncStatus 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 SecretSyncUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncUpdateProperties() { } + public string ForceSynchronization { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType? KubernetesSecretType { get { throw null; } set { } } + public System.Collections.Generic.IList ObjectSecretMapping { get { throw null; } } + public string SecretProviderClassName { get { throw null; } set { } } + public string ServiceAccountName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncUpdateProperties 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.SecretsStoreExtension.Models.SecretSyncUpdateProperties 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; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.netstandard2.0.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.netstandard2.0.cs new file mode 100644 index 000000000000..5405ecf534ab --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/api/Azure.ResourceManager.SecretsStoreExtension.netstandard2.0.cs @@ -0,0 +1,346 @@ +namespace Azure.ResourceManager.SecretsStoreExtension +{ + public partial class KeyVaultSecretProviderClassCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected KeyVaultSecretProviderClassCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string azureKeyVaultSecretProviderClassName, Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string azureKeyVaultSecretProviderClassName, Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string azureKeyVaultSecretProviderClassName, 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 azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string azureKeyVaultSecretProviderClassName, 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 KeyVaultSecretProviderClassData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyVaultSecretProviderClassData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.KeyVaultSecretProviderClassProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassData 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.SecretsStoreExtension.KeyVaultSecretProviderClassData 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 KeyVaultSecretProviderClassResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected KeyVaultSecretProviderClassResource() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassData 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 azureKeyVaultSecretProviderClassName) { 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.SecretsStoreExtension.KeyVaultSecretProviderClassData 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.SecretsStoreExtension.KeyVaultSecretProviderClassData 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.SecretsStoreExtension.Models.KeyVaultSecretProviderClassPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecretsStoreExtension.Models.KeyVaultSecretProviderClassPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public static partial class SecretsStoreExtensionExtensions + { + public static Azure.Response GetKeyVaultSecretProviderClass(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetKeyVaultSecretProviderClassAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassCollection GetKeyVaultSecretProviderClasses(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetKeyVaultSecretProviderClasses(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetKeyVaultSecretProviderClassesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassResource GetKeyVaultSecretProviderClassResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetSecretSync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSecretSyncAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncResource GetSecretSyncResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncCollection GetSecretSyncs(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetSecretSyncs(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetSecretSyncsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class SecretSyncCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SecretSyncCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string secretSyncName, Azure.ResourceManager.SecretsStoreExtension.SecretSyncData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string secretSyncName, Azure.ResourceManager.SecretsStoreExtension.SecretSyncData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string secretSyncName, 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 secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string secretSyncName, 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 SecretSyncData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Resources.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.SecretSyncData 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 SecretSyncResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SecretSyncResource() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncData 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 secretSyncName) { 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.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.SecretSyncData 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.SecretsStoreExtension.Models.SecretSyncPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.SecretsStoreExtension.Mocking +{ + public partial class MockableSecretsStoreExtensionArmClient : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionArmClient() { } + public virtual Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassResource GetKeyVaultSecretProviderClassResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncResource GetSecretSyncResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableSecretsStoreExtensionResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionResourceGroupResource() { } + public virtual Azure.Response GetKeyVaultSecretProviderClass(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetKeyVaultSecretProviderClassAsync(string azureKeyVaultSecretProviderClassName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassCollection GetKeyVaultSecretProviderClasses() { throw null; } + public virtual Azure.Response GetSecretSync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSecretSyncAsync(string secretSyncName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.SecretsStoreExtension.SecretSyncCollection GetSecretSyncs() { throw null; } + } + public partial class MockableSecretsStoreExtensionSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableSecretsStoreExtensionSubscriptionResource() { } + public virtual Azure.Pageable GetKeyVaultSecretProviderClasses(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetKeyVaultSecretProviderClassesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSecretSyncs(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecretSyncsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public static partial class ArmSecretsStoreExtensionModelFactory + { + public static Azure.ResourceManager.SecretsStoreExtension.KeyVaultSecretProviderClassData KeyVaultSecretProviderClassData(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.SecretsStoreExtension.Models.KeyVaultSecretProviderClassProperties properties = null, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.KeyVaultSecretProviderClassProperties KeyVaultSecretProviderClassProperties(string keyvaultName = null, string clientId = null, string tenantId = null, string objects = null, Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState? provisioningState = default(Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState?)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncCondition SecretSyncCondition(System.DateTimeOffset? lastTransitionOn = default(System.DateTimeOffset?), string message = null, long? observedGeneration = default(long?), string reason = null, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType status = default(Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType), string type = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.SecretSyncData SecretSyncData(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.SecretsStoreExtension.Models.SecretSyncProperties properties = null, Azure.ResourceManager.Resources.Models.ExtendedLocation extendedLocation = null) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties SecretSyncProperties(string secretProviderClassName = null, string serviceAccountName = null, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType kubernetesSecretType = default(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType), string forceSynchronization = null, System.Collections.Generic.IEnumerable objectSecretMapping = null, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus status = null, Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState? provisioningState = default(Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState?)) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus SecretSyncStatus(System.DateTimeOffset? lastSuccessfulSyncOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable conditions = null) { throw null; } + } + public partial class AzureKeyVaultSecretProviderClassUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AzureKeyVaultSecretProviderClassUpdateProperties() { } + public string ClientId { get { throw null; } set { } } + public string KeyvaultName { get { throw null; } set { } } + public string Objects { get { throw null; } set { } } + public string TenantId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties 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.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties 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 KeyVaultSecretProviderClassPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyVaultSecretProviderClassPatch() { } + public Azure.ResourceManager.SecretsStoreExtension.Models.AzureKeyVaultSecretProviderClassUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.KeyVaultSecretProviderClassPatch 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.SecretsStoreExtension.Models.KeyVaultSecretProviderClassPatch 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 KeyVaultSecretProviderClassProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KeyVaultSecretProviderClassProperties(string keyvaultName, string clientId, string tenantId) { } + public string ClientId { get { throw null; } set { } } + public string KeyvaultName { get { throw null; } set { } } + public string Objects { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState? ProvisioningState { get { throw null; } } + public string TenantId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.KeyVaultSecretProviderClassProperties 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.SecretsStoreExtension.Models.KeyVaultSecretProviderClassProperties 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 KubernetesSecretObjectMapping : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public KubernetesSecretObjectMapping(string sourcePath, string targetKey) { } + public string SourcePath { get { throw null; } set { } } + public string TargetKey { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretObjectMapping 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.SecretsStoreExtension.Models.KubernetesSecretObjectMapping 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 KubernetesSecretType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public KubernetesSecretType(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType Opaque { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType Tls { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType 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.SecretsStoreExtension.Models.KubernetesSecretType left, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType left, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SecretsStoreExtensionProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SecretsStoreExtensionProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState 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.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState left, Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState left, Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SecretSyncCondition : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SecretSyncCondition() { } + public System.DateTimeOffset? LastTransitionOn { get { throw null; } } + public string Message { get { throw null; } } + public long? ObservedGeneration { get { throw null; } } + public string Reason { get { throw null; } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType Status { get { throw null; } } + public string Type { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncCondition 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.SecretsStoreExtension.Models.SecretSyncCondition 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 SecretSyncConditionStatusType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SecretSyncConditionStatusType(string value) { throw null; } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType False { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType True { get { throw null; } } + public static Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType 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.SecretsStoreExtension.Models.SecretSyncConditionStatusType left, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType right) { throw null; } + public static implicit operator Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType left, Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncConditionStatusType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SecretSyncPatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncPatch() { } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncUpdateProperties Properties { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncPatch 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.SecretsStoreExtension.Models.SecretSyncPatch 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 SecretSyncProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncProperties(string secretProviderClassName, string serviceAccountName, Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType kubernetesSecretType, System.Collections.Generic.IEnumerable objectSecretMapping) { } + public string ForceSynchronization { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType KubernetesSecretType { get { throw null; } set { } } + public System.Collections.Generic.IList ObjectSecretMapping { get { throw null; } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretsStoreExtensionProvisioningState? ProvisioningState { get { throw null; } } + public string SecretProviderClassName { get { throw null; } set { } } + public string ServiceAccountName { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncProperties 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.SecretsStoreExtension.Models.SecretSyncProperties 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 SecretSyncStatus : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal SecretSyncStatus() { } + public System.Collections.Generic.IReadOnlyList Conditions { get { throw null; } } + public System.DateTimeOffset? LastSuccessfulSyncOn { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncStatus 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.SecretsStoreExtension.Models.SecretSyncStatus 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 SecretSyncUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SecretSyncUpdateProperties() { } + public string ForceSynchronization { get { throw null; } set { } } + public Azure.ResourceManager.SecretsStoreExtension.Models.KubernetesSecretType? KubernetesSecretType { get { throw null; } set { } } + public System.Collections.Generic.IList ObjectSecretMapping { get { throw null; } } + public string SecretProviderClassName { get { throw null; } set { } } + public string ServiceAccountName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.SecretsStoreExtension.Models.SecretSyncUpdateProperties 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.SecretsStoreExtension.Models.SecretSyncUpdateProperties 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; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/assets.json b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/assets.json new file mode 100644 index 000000000000..ec76ab9ac35f --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/secretsstoreextension/Azure.ResourceManager.SecretsStoreExtension", + "Tag": "" +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Azure.ResourceManager.SecretsStoreExtension.Samples.csproj b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Azure.ResourceManager.SecretsStoreExtension.Samples.csproj new file mode 100644 index 000000000000..d0092ec948a0 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Azure.ResourceManager.SecretsStoreExtension.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_KeyVaultSecretProviderClassCollection.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_KeyVaultSecretProviderClassCollection.cs new file mode 100644 index 000000000000..5f2023622758 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_KeyVaultSecretProviderClassCollection.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Samples +{ + public partial class Sample_KeyVaultSecretProviderClassCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AzureKeyVaultSecretProviderClassesCreateOrUpdate() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KeyVaultSecretProviderClassResource + KeyVaultSecretProviderClassCollection collection = resourceGroupResource.GetKeyVaultSecretProviderClasses(); + + // invoke the operation + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + KeyVaultSecretProviderClassData data = new KeyVaultSecretProviderClassData(new AzureLocation("eastus")) + { + Properties = new KeyVaultSecretProviderClassProperties("example-ssc-key-vault", "00000000-0000-0000-0000-000000000000", "00000000-0000-0000-0000-000000000000") + { + Objects = "array: |\n - |\n objectName: my-secret-object\n objectType: secret\n objectVersionHistory: 1", + }, + ExtendedLocation = new ExtendedLocation + { + Name = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-ssc-example/providers/Microsoft.ExtendedLocation/customLocations/example-custom-location", + }, + Tags = +{ +["example-tag"] = "example-tag-value" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, azureKeyVaultSecretProviderClassName, data); + KeyVaultSecretProviderClassResource 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 + KeyVaultSecretProviderClassData 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_AzureKeyVaultSecretProviderClassesGet() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KeyVaultSecretProviderClassResource + KeyVaultSecretProviderClassCollection collection = resourceGroupResource.GetKeyVaultSecretProviderClasses(); + + // invoke the operation + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + KeyVaultSecretProviderClassResource result = await collection.GetAsync(azureKeyVaultSecretProviderClassName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + KeyVaultSecretProviderClassData 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_AzureKeyVaultSecretProviderClassesListByResourceGroup() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_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 = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KeyVaultSecretProviderClassResource + KeyVaultSecretProviderClassCollection collection = resourceGroupResource.GetKeyVaultSecretProviderClasses(); + + // invoke the operation and iterate over the result + await foreach (KeyVaultSecretProviderClassResource 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 + KeyVaultSecretProviderClassData 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_AzureKeyVaultSecretProviderClassesGet() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KeyVaultSecretProviderClassResource + KeyVaultSecretProviderClassCollection collection = resourceGroupResource.GetKeyVaultSecretProviderClasses(); + + // invoke the operation + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + bool result = await collection.ExistsAsync(azureKeyVaultSecretProviderClassName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AzureKeyVaultSecretProviderClassesGet() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this KeyVaultSecretProviderClassResource + KeyVaultSecretProviderClassCollection collection = resourceGroupResource.GetKeyVaultSecretProviderClasses(); + + // invoke the operation + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + NullableResponse response = await collection.GetIfExistsAsync(azureKeyVaultSecretProviderClassName); + KeyVaultSecretProviderClassResource 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 + KeyVaultSecretProviderClassData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_KeyVaultSecretProviderClassResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_KeyVaultSecretProviderClassResource.cs new file mode 100644 index 000000000000..b05569a427b5 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_KeyVaultSecretProviderClassResource.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.SecretsStoreExtension.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Samples +{ + public partial class Sample_KeyVaultSecretProviderClassResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AzureKeyVaultSecretProviderClassesGet() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_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 KeyVaultSecretProviderClassResource created on azure + // for more information of creating KeyVaultSecretProviderClassResource, please refer to the document of KeyVaultSecretProviderClassResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + ResourceIdentifier keyVaultSecretProviderClassResourceId = KeyVaultSecretProviderClassResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + KeyVaultSecretProviderClassResource keyVaultSecretProviderClass = client.GetKeyVaultSecretProviderClassResource(keyVaultSecretProviderClassResourceId); + + // invoke the operation + KeyVaultSecretProviderClassResource result = await keyVaultSecretProviderClass.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 + KeyVaultSecretProviderClassData 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_AzureKeyVaultSecretProviderClassesDelete() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_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 KeyVaultSecretProviderClassResource created on azure + // for more information of creating KeyVaultSecretProviderClassResource, please refer to the document of KeyVaultSecretProviderClassResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + ResourceIdentifier keyVaultSecretProviderClassResourceId = KeyVaultSecretProviderClassResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + KeyVaultSecretProviderClassResource keyVaultSecretProviderClass = client.GetKeyVaultSecretProviderClassResource(keyVaultSecretProviderClassResourceId); + + // invoke the operation + await keyVaultSecretProviderClass.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AzureKeyVaultSecretProviderClassesUpdate() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_Update_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_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 KeyVaultSecretProviderClassResource created on azure + // for more information of creating KeyVaultSecretProviderClassResource, please refer to the document of KeyVaultSecretProviderClassResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string azureKeyVaultSecretProviderClassName = "akvspc-ssc-example"; + ResourceIdentifier keyVaultSecretProviderClassResourceId = KeyVaultSecretProviderClassResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + KeyVaultSecretProviderClassResource keyVaultSecretProviderClass = client.GetKeyVaultSecretProviderClassResource(keyVaultSecretProviderClassResourceId); + + // invoke the operation + KeyVaultSecretProviderClassPatch patch = new KeyVaultSecretProviderClassPatch + { + Tags = +{ +["example-tag"] = "example-tag-value" +}, + Properties = new AzureKeyVaultSecretProviderClassUpdateProperties + { + KeyvaultName = "example-ssc-key-vault", + ClientId = "00000000-0000-0000-0000-000000000000", + TenantId = "00000000-0000-0000-0000-000000000000", + Objects = "array: |\n - |\n objectName: my-secret-object\n objectType: secret\n objectVersionHistory: 1", + }, + }; + ArmOperation lro = await keyVaultSecretProviderClass.UpdateAsync(WaitUntil.Completed, patch); + KeyVaultSecretProviderClassResource 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 + KeyVaultSecretProviderClassData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncCollection.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncCollection.cs new file mode 100644 index 000000000000..d778174dd80a --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncCollection.cs @@ -0,0 +1,208 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Samples +{ + public partial class Sample_SecretSyncCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_SecretSyncsCreateOrUpdate() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecretSyncResource + SecretSyncCollection collection = resourceGroupResource.GetSecretSyncs(); + + // invoke the operation + string secretSyncName = "secretsync-ssc-example"; + SecretSyncData data = new SecretSyncData(new AzureLocation("eastus")) + { + Properties = new SecretSyncProperties("akvspc-ssc-example", "example-k8s-sa-name", KubernetesSecretType.Opaque, new KubernetesSecretObjectMapping[] + { +new KubernetesSecretObjectMapping("kv-secret-name/0", "kv-secret-name/0") + }), + ExtendedLocation = new ExtendedLocation + { + Name = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg-ssc-example/providers/Microsoft.ExtendedLocation/customLocations/example-custom-location", + }, + Tags = +{ +["example-tag"] = "example-tag-value" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, secretSyncName, data); + SecretSyncResource 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 + SecretSyncData 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_SecretSyncsGet() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecretSyncResource + SecretSyncCollection collection = resourceGroupResource.GetSecretSyncs(); + + // invoke the operation + string secretSyncName = "secretsync-ssc-example"; + SecretSyncResource result = await collection.GetAsync(secretSyncName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + SecretSyncData 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_SecretSyncsListByResourceGroup() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_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 = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecretSyncResource + SecretSyncCollection collection = resourceGroupResource.GetSecretSyncs(); + + // invoke the operation and iterate over the result + await foreach (SecretSyncResource 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 + SecretSyncData 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_SecretSyncsGet() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecretSyncResource + SecretSyncCollection collection = resourceGroupResource.GetSecretSyncs(); + + // invoke the operation + string secretSyncName = "secretsync-ssc-example"; + bool result = await collection.ExistsAsync(secretSyncName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_SecretSyncsGet() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this SecretSyncResource + SecretSyncCollection collection = resourceGroupResource.GetSecretSyncs(); + + // invoke the operation + string secretSyncName = "secretsync-ssc-example"; + NullableResponse response = await collection.GetIfExistsAsync(secretSyncName); + SecretSyncResource 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 + SecretSyncData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncResource.cs new file mode 100644 index 000000000000..91beb50cc454 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SecretSyncResource.cs @@ -0,0 +1,121 @@ +// 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.SecretsStoreExtension.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Samples +{ + public partial class Sample_SecretSyncResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_SecretSyncsGet() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Get_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_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 SecretSyncResource created on azure + // for more information of creating SecretSyncResource, please refer to the document of SecretSyncResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string secretSyncName = "secretsync-ssc-example"; + ResourceIdentifier secretSyncResourceId = SecretSyncResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, secretSyncName); + SecretSyncResource secretSync = client.GetSecretSyncResource(secretSyncResourceId); + + // invoke the operation + SecretSyncResource result = await secretSync.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 + SecretSyncData 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_SecretSyncsDelete() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_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 SecretSyncResource created on azure + // for more information of creating SecretSyncResource, please refer to the document of SecretSyncResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string secretSyncName = "secretsync-ssc-example"; + ResourceIdentifier secretSyncResourceId = SecretSyncResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, secretSyncName); + SecretSyncResource secretSync = client.GetSecretSyncResource(secretSyncResourceId); + + // invoke the operation + await secretSync.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_SecretSyncsUpdate() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_Update_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_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 SecretSyncResource created on azure + // for more information of creating SecretSyncResource, please refer to the document of SecretSyncResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "rg-ssc-example"; + string secretSyncName = "secretsync-ssc-example"; + ResourceIdentifier secretSyncResourceId = SecretSyncResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, secretSyncName); + SecretSyncResource secretSync = client.GetSecretSyncResource(secretSyncResourceId); + + // invoke the operation + SecretSyncPatch patch = new SecretSyncPatch + { + Tags = +{ +["example-tag"] = "example-tag-value" +}, + Properties = new SecretSyncUpdateProperties + { + SecretProviderClassName = "jttlpenhtpxfrrlxdsmqqvmvtmgqrficvqngkggjwciilrexenlstxncyvkqcydxrivkioujssncoaiysdklfouukczzdbxniipbyiqsarqaespuqrbbydwtdaulllostoomntkadklihemfpeffvuyvyilequiqewzspaootvkibrynbqrsbiptjdhywynvydaadprdc", + ServiceAccountName = "fcldqfdfpktndlntuoxicsftelhefevovmlycflfwzckvamiqjnjugandqaqqeccsbzztfmmeunvhsafgerbcsdbnmsyqivygornebbkusuvphwghgouxvcbvmbydqjzoxextnyowsnyymadniwdrrxtogeveldpejixmsrzzfqkquaxdpzwvecevqwasxgxxchrfa", + KubernetesSecretType = KubernetesSecretType.Opaque, + ForceSynchronization = "arbitrarystring", + ObjectSecretMapping = { new KubernetesSecretObjectMapping("ssrzmbvdiomkvzrdsyilwlfzicfydnbjwjsnohrppkukjddrunfslkrnexunuckmghixdssposvndpiqchpqrkjuqbapoisvqdvgstvdonsmlpsmticfvuhqlofpaxfdg", "lojegeqiqfjxyblfxhxloccqzwgpgcelrwqwsbsltcjvjvceejgdrmxhenokxrylhynkltvqntjcvujjrppzvcxyivxeksgmzhifrcklizbpntdepzdl") }, + }, + }; + ArmOperation lro = await secretSync.UpdateAsync(WaitUntil.Completed, patch); + SecretSyncResource 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 + SecretSyncData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..94ce9f0cd1d5 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetKeyVaultSecretProviderClasses_AzureKeyVaultSecretProviderClassesListBySubscription() + { + // Generated from example definition: 2024-08-21-preview/AzureKeyVaultSecretProviderClasses_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "AzureKeyVaultSecretProviderClass_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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (KeyVaultSecretProviderClassResource item in subscriptionResource.GetKeyVaultSecretProviderClassesAsync()) + { + // 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 + KeyVaultSecretProviderClassData 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 GetSecretSyncs_SecretSyncsListBySubscription() + { + // Generated from example definition: 2024-08-21-preview/SecretSyncs_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "SecretSync_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 = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (SecretSyncResource item in subscriptionResource.GetSecretSyncsAsync()) + { + // 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 + SecretSyncData 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Azure.ResourceManager.SecretsStoreExtension.csproj b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Azure.ResourceManager.SecretsStoreExtension.csproj new file mode 100644 index 000000000000..1198b8554e01 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Azure.ResourceManager.SecretsStoreExtension.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider SecretsStoreExtension. + 1.0.0-beta.1 + azure;management;arm;resource manager;secretsstoreextension + Azure.ResourceManager.SecretsStoreExtension + + diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ArmSecretsStoreExtensionModelFactory.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ArmSecretsStoreExtensionModelFactory.cs new file mode 100644 index 000000000000..60310a2d9f42 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ArmSecretsStoreExtensionModelFactory.cs @@ -0,0 +1,145 @@ +// 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; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// Model factory for models. + public static partial class ArmSecretsStoreExtensionModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// + /// A new instance for mocking. + public static KeyVaultSecretProviderClassData KeyVaultSecretProviderClassData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, KeyVaultSecretProviderClassProperties properties = null, ExtendedLocation extendedLocation = null) + { + tags ??= new Dictionary(); + + return new KeyVaultSecretProviderClassData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the Azure Key Vault to sync secrets from. + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + /// Objects defines the desired state of synced K8s secret objects. + /// Provisioning state of the AzureKeyVaultSecretProviderClass instance. + /// A new instance for mocking. + public static KeyVaultSecretProviderClassProperties KeyVaultSecretProviderClassProperties(string keyvaultName = null, string clientId = null, string tenantId = null, string objects = null, SecretsStoreExtensionProvisioningState? provisioningState = null) + { + return new KeyVaultSecretProviderClassProperties( + keyvaultName, + clientId, + tenantId, + objects, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// + /// A new instance for mocking. + public static SecretSyncData SecretSyncData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, SecretSyncProperties properties = null, ExtendedLocation extendedLocation = null) + { + tags ??= new Dictionary(); + + return new SecretSyncData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + extendedLocation, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + /// ForceSynchronization can be used to force the secret synchronization. The secret synchronization is triggered by changing the value in this field. This field is not used to resolve synchronization conflicts. + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + /// SecretSyncStatus defines the observed state of the secret synchronization process. + /// Provisioning state of the SecretSync instance. + /// A new instance for mocking. + public static SecretSyncProperties SecretSyncProperties(string secretProviderClassName = null, string serviceAccountName = null, KubernetesSecretType kubernetesSecretType = default, string forceSynchronization = null, IEnumerable objectSecretMapping = null, SecretSyncStatus status = null, SecretsStoreExtensionProvisioningState? provisioningState = null) + { + objectSecretMapping ??= new List(); + + return new SecretSyncProperties( + secretProviderClassName, + serviceAccountName, + kubernetesSecretType, + forceSynchronization, + objectSecretMapping?.ToList(), + status, + provisioningState, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// LastSuccessfulSyncTime represents the last time the secret was retrieved from the Provider and updated. + /// Conditions represent the status of the secret create and update processes. The status can be True, False, or Unknown with various reasons and messages explaining the state. Examples of reasons include CreateSucceeded, ProviderError, InvalidClusterSecretLabelError, InvalidClusterSecretAnnotationError, UnknownError, ValidatingAdmissionPolicyCheckFailed, UserInputValidationFailed, ControllerSpcError, ControllerInternalError, NoValueChange, and ValueChangeOrForceUpdateDetected. + /// A new instance for mocking. + public static SecretSyncStatus SecretSyncStatus(DateTimeOffset? lastSuccessfulSyncOn = null, IEnumerable conditions = null) + { + conditions ??= new List(); + + return new SecretSyncStatus(lastSuccessfulSyncOn, conditions?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// LastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + /// Message is a human readable message indicating details about the transition. This may be an empty string. + /// ObservedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + /// Reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + /// Status of the condition, one of True, False, Unknown. + /// Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to de-conflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt). + /// A new instance for mocking. + public static SecretSyncCondition SecretSyncCondition(DateTimeOffset? lastTransitionOn = null, string message = null, long? observedGeneration = null, string reason = null, SecretSyncConditionStatusType status = default, string type = null) + { + return new SecretSyncCondition( + lastTransitionOn, + message, + observedGeneration, + reason, + status, + type, + serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionArmClient.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionArmClient.cs new file mode 100644 index 000000000000..2a734d1af04b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionArmClient.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableSecretsStoreExtensionArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSecretsStoreExtensionArmClient() + { + } + + /// 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 MockableSecretsStoreExtensionArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableSecretsStoreExtensionArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual KeyVaultSecretProviderClassResource GetKeyVaultSecretProviderClassResource(ResourceIdentifier id) + { + KeyVaultSecretProviderClassResource.ValidateResourceId(id); + return new KeyVaultSecretProviderClassResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual SecretSyncResource GetSecretSyncResource(ResourceIdentifier id) + { + SecretSyncResource.ValidateResourceId(id); + return new SecretSyncResource(Client, id); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionResourceGroupResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionResourceGroupResource.cs new file mode 100644 index 000000000000..00facdb5e297 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionResourceGroupResource.cs @@ -0,0 +1,174 @@ +// 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.SecretsStoreExtension.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableSecretsStoreExtensionResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableSecretsStoreExtensionResourceGroupResource() + { + } + + /// 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 MockableSecretsStoreExtensionResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of KeyVaultSecretProviderClassResources in the ResourceGroupResource. + /// An object representing collection of KeyVaultSecretProviderClassResources and their operations over a KeyVaultSecretProviderClassResource. + public virtual KeyVaultSecretProviderClassCollection GetKeyVaultSecretProviderClasses() + { + return GetCachedClient(client => new KeyVaultSecretProviderClassCollection(client, Id)); + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetKeyVaultSecretProviderClassAsync(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + return await GetKeyVaultSecretProviderClasses().GetAsync(azureKeyVaultSecretProviderClassName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetKeyVaultSecretProviderClass(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + return GetKeyVaultSecretProviderClasses().Get(azureKeyVaultSecretProviderClassName, cancellationToken); + } + + /// Gets a collection of SecretSyncResources in the ResourceGroupResource. + /// An object representing collection of SecretSyncResources and their operations over a SecretSyncResource. + public virtual SecretSyncCollection GetSecretSyncs() + { + return GetCachedClient(client => new SecretSyncCollection(client, Id)); + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetSecretSyncAsync(string secretSyncName, CancellationToken cancellationToken = default) + { + return await GetSecretSyncs().GetAsync(secretSyncName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetSecretSync(string secretSyncName, CancellationToken cancellationToken = default) + { + return GetSecretSyncs().Get(secretSyncName, cancellationToken); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionSubscriptionResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionSubscriptionResource.cs new file mode 100644 index 000000000000..f3956674a01d --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/MockableSecretsStoreExtensionSubscriptionResource.cs @@ -0,0 +1,166 @@ +// 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.SecretsStoreExtension.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableSecretsStoreExtensionSubscriptionResource : ArmResource + { + private ClientDiagnostics _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics; + private AzureKeyVaultSecretProviderClassesRestOperations _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient; + private ClientDiagnostics _secretSyncClientDiagnostics; + private SecretSyncsRestOperations _secretSyncRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableSecretsStoreExtensionSubscriptionResource() + { + } + + /// 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 MockableSecretsStoreExtensionSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics KeyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics => _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", KeyVaultSecretProviderClassResource.ResourceType.Namespace, Diagnostics); + private AzureKeyVaultSecretProviderClassesRestOperations KeyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient => _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient ??= new AzureKeyVaultSecretProviderClassesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(KeyVaultSecretProviderClassResource.ResourceType)); + private ClientDiagnostics SecretSyncClientDiagnostics => _secretSyncClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", SecretSyncResource.ResourceType.Namespace, Diagnostics); + private SecretSyncsRestOperations SecretSyncRestClient => _secretSyncRestClient ??= new SecretSyncsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(SecretSyncResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetKeyVaultSecretProviderClassesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => KeyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KeyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultSecretProviderClassResource(Client, KeyVaultSecretProviderClassData.DeserializeKeyVaultSecretProviderClassData(e)), KeyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics, Pipeline, "MockableSecretsStoreExtensionSubscriptionResource.GetKeyVaultSecretProviderClasses", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetKeyVaultSecretProviderClasses(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => KeyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => KeyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultSecretProviderClassResource(Client, KeyVaultSecretProviderClassData.DeserializeKeyVaultSecretProviderClassData(e)), KeyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics, Pipeline, "MockableSecretsStoreExtensionSubscriptionResource.GetKeyVaultSecretProviderClasses", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the SecretSync instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecretSyncsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecretSyncRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecretSyncRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecretSyncResource(Client, SecretSyncData.DeserializeSecretSyncData(e)), SecretSyncClientDiagnostics, Pipeline, "MockableSecretsStoreExtensionSubscriptionResource.GetSecretSyncs", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the SecretSync instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecretSyncs(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => SecretSyncRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => SecretSyncRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecretSyncResource(Client, SecretSyncData.DeserializeSecretSyncData(e)), SecretSyncClientDiagnostics, Pipeline, "MockableSecretsStoreExtensionSubscriptionResource.GetSecretSyncs", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/SecretsStoreExtensionExtensions.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/SecretsStoreExtensionExtensions.cs new file mode 100644 index 000000000000..6b6c7e86f7f4 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Extensions/SecretsStoreExtensionExtensions.cs @@ -0,0 +1,403 @@ +// 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.Resources; +using Azure.ResourceManager.SecretsStoreExtension.Mocking; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + /// A class to add extension methods to Azure.ResourceManager.SecretsStoreExtension. + public static partial class SecretsStoreExtensionExtensions + { + private static MockableSecretsStoreExtensionArmClient GetMockableSecretsStoreExtensionArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableSecretsStoreExtensionArmClient(client0)); + } + + private static MockableSecretsStoreExtensionResourceGroupResource GetMockableSecretsStoreExtensionResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableSecretsStoreExtensionResourceGroupResource(client, resource.Id)); + } + + private static MockableSecretsStoreExtensionSubscriptionResource GetMockableSecretsStoreExtensionSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableSecretsStoreExtensionSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static KeyVaultSecretProviderClassResource GetKeyVaultSecretProviderClassResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableSecretsStoreExtensionArmClient(client).GetKeyVaultSecretProviderClassResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static SecretSyncResource GetSecretSyncResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableSecretsStoreExtensionArmClient(client).GetSecretSyncResource(id); + } + + /// + /// Gets a collection of KeyVaultSecretProviderClassResources 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 KeyVaultSecretProviderClassResources and their operations over a KeyVaultSecretProviderClassResource. + public static KeyVaultSecretProviderClassCollection GetKeyVaultSecretProviderClasses(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetKeyVaultSecretProviderClasses(); + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetKeyVaultSecretProviderClassAsync(this ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetKeyVaultSecretProviderClassAsync(azureKeyVaultSecretProviderClassName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetKeyVaultSecretProviderClass(this ResourceGroupResource resourceGroupResource, string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetKeyVaultSecretProviderClass(azureKeyVaultSecretProviderClassName, cancellationToken); + } + + /// + /// Gets a collection of SecretSyncResources 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 SecretSyncResources and their operations over a SecretSyncResource. + public static SecretSyncCollection GetSecretSyncs(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetSecretSyncs(); + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the SecretSync. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetSecretSyncAsync(this ResourceGroupResource resourceGroupResource, string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetSecretSyncAsync(secretSyncName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the SecretSync. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetSecretSync(this ResourceGroupResource resourceGroupResource, string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableSecretsStoreExtensionResourceGroupResource(resourceGroupResource).GetSecretSync(secretSyncName, cancellationToken); + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-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 GetKeyVaultSecretProviderClassesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSecretsStoreExtensionSubscriptionResource(subscriptionResource).GetKeyVaultSecretProviderClassesAsync(cancellationToken); + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-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 GetKeyVaultSecretProviderClasses(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSecretsStoreExtensionSubscriptionResource(subscriptionResource).GetKeyVaultSecretProviderClasses(cancellationToken); + } + + /// + /// Lists the SecretSync instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-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 GetSecretSyncsAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSecretsStoreExtensionSubscriptionResource(subscriptionResource).GetSecretSyncsAsync(cancellationToken); + } + + /// + /// Lists the SecretSync instances within an Azure subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-08-21-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 GetSecretSyncs(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableSecretsStoreExtensionSubscriptionResource(subscriptionResource).GetSecretSyncs(cancellationToken); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Argument.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..6cdd3b1396e5 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..5192ce1963d5 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ChangeTrackingList.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..c7dafad335d0 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..e734e1a1562c --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Optional.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..644b867699a9 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..22b3c476099e --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassCollection.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassCollection.cs new file mode 100644 index 000000000000..592a33069f12 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassCollection.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.SecretsStoreExtension +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetKeyVaultSecretProviderClasses method from an instance of . + /// + public partial class KeyVaultSecretProviderClassCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics; + private readonly AzureKeyVaultSecretProviderClassesRestOperations _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient; + + /// Initializes a new instance of the class for mocking. + protected KeyVaultSecretProviderClassCollection() + { + } + + /// 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 KeyVaultSecretProviderClassCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", KeyVaultSecretProviderClassResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(KeyVaultSecretProviderClassResource.ResourceType, out string keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesApiVersion); + _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient = new AzureKeyVaultSecretProviderClassesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesApiVersion); +#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)); + } + + /// + /// Creates, or updates, an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-08-21-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 AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, KeyVaultSecretProviderClassData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, data, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(new KeyVaultSecretProviderClassOperationSource(Client), _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics, Pipeline, _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates, or updates, an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-08-21-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 AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, KeyVaultSecretProviderClassData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, data, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(new KeyVaultSecretProviderClassOperationSource(Client), _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics, Pipeline, _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassCollection.Get"); + scope.Start(); + try + { + var response = await _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new KeyVaultSecretProviderClassResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassCollection.Get"); + scope.Start(); + try + { + var response = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new KeyVaultSecretProviderClassResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-08-21-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) => _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new KeyVaultSecretProviderClassResource(Client, KeyVaultSecretProviderClassData.DeserializeKeyVaultSecretProviderClassData(e)), _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics, Pipeline, "KeyVaultSecretProviderClassCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the AzureKeyVaultSecretProviderClass instances within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-08-21-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) => _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new KeyVaultSecretProviderClassResource(Client, KeyVaultSecretProviderClassData.DeserializeKeyVaultSecretProviderClassData(e)), _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics, Pipeline, "KeyVaultSecretProviderClassCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassCollection.Exists"); + scope.Start(); + try + { + var response = await _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassCollection.Exists"); + scope.Start(); + try + { + var response = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KeyVaultSecretProviderClassResource(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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AzureKeyVaultSecretProviderClass. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassCollection.GetIfExists"); + scope.Start(); + try + { + var response = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, azureKeyVaultSecretProviderClassName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new KeyVaultSecretProviderClassResource(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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassData.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassData.Serialization.cs new file mode 100644 index 000000000000..355a82533c42 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassData.Serialization.cs @@ -0,0 +1,195 @@ +// 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.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + public partial class KeyVaultSecretProviderClassData : 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(KeyVaultSecretProviderClassData)} 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(ExtendedLocation)) + { + writer.WritePropertyName("extendedLocation"u8); + JsonSerializer.Serialize(writer, ExtendedLocation); + } + } + + KeyVaultSecretProviderClassData 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(KeyVaultSecretProviderClassData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultSecretProviderClassData(document.RootElement, options); + } + + internal static KeyVaultSecretProviderClassData DeserializeKeyVaultSecretProviderClassData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + KeyVaultSecretProviderClassProperties properties = default; + ExtendedLocation extendedLocation = 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 = KeyVaultSecretProviderClassProperties.DeserializeKeyVaultSecretProviderClassProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + extendedLocation = JsonSerializer.Deserialize(property.Value.GetRawText()); + 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 KeyVaultSecretProviderClassData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + extendedLocation, + 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(KeyVaultSecretProviderClassData)} does not support writing '{options.Format}' format."); + } + } + + KeyVaultSecretProviderClassData 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 DeserializeKeyVaultSecretProviderClassData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyVaultSecretProviderClassData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassData.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassData.cs new file mode 100644 index 000000000000..ac98e15ce2d6 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassData.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + /// + /// A class representing the KeyVaultSecretProviderClass data model. + /// The AzureKeyVaultSecretProviderClass resource. + /// + public partial class KeyVaultSecretProviderClassData : 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 KeyVaultSecretProviderClassData(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. + /// + /// Keeps track of any properties unknown to the library. + internal KeyVaultSecretProviderClassData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, KeyVaultSecretProviderClassProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyVaultSecretProviderClassData() + { + } + + /// The resource-specific properties for this resource. + public KeyVaultSecretProviderClassProperties Properties { get; set; } + /// Gets or sets the extended location. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassResource.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassResource.Serialization.cs new file mode 100644 index 000000000000..c7d4fb8d0756 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassResource.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.SecretsStoreExtension +{ + public partial class KeyVaultSecretProviderClassResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + KeyVaultSecretProviderClassData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + KeyVaultSecretProviderClassData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassResource.cs new file mode 100644 index 000000000000..ed48a120ec81 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/KeyVaultSecretProviderClassResource.cs @@ -0,0 +1,707 @@ +// 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; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + /// + /// A Class representing a KeyVaultSecretProviderClass along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetKeyVaultSecretProviderClassResource method. + /// Otherwise you can get one from its parent resource using the GetKeyVaultSecretProviderClass method. + /// + public partial class KeyVaultSecretProviderClassResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The azureKeyVaultSecretProviderClassName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics; + private readonly AzureKeyVaultSecretProviderClassesRestOperations _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient; + private readonly KeyVaultSecretProviderClassData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses"; + + /// Initializes a new instance of the class for mocking. + protected KeyVaultSecretProviderClassResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal KeyVaultSecretProviderClassResource(ArmClient client, KeyVaultSecretProviderClassData 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 KeyVaultSecretProviderClassResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesApiVersion); + _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient = new AzureKeyVaultSecretProviderClassesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesApiVersion); +#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 KeyVaultSecretProviderClassData 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 the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.Get"); + scope.Start(); + try + { + var response = await _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new KeyVaultSecretProviderClassResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.Get"); + scope.Start(); + try + { + var response = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new KeyVaultSecretProviderClassResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Delete + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.Delete"); + scope.Start(); + try + { + var response = await _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(_keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics, Pipeline, _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.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 AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Delete + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.Delete"); + scope.Start(); + try + { + var response = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(_keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics, Pipeline, _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.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; + } + } + + /// + /// Updates an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Update + /// + /// + /// Default Api Version + /// 2024-08-21-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, KeyVaultSecretProviderClassPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.Update"); + scope.Start(); + try + { + var response = await _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(new KeyVaultSecretProviderClassOperationSource(Client), _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics, Pipeline, _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates an AzureKeyVaultSecretProviderClass instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Update + /// + /// + /// Default Api Version + /// 2024-08-21-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, KeyVaultSecretProviderClassPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.Update"); + scope.Start(); + try + { + var response = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(new KeyVaultSecretProviderClassOperationSource(Client), _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics, Pipeline, _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.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 _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new KeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new KeyVaultSecretProviderClassPatch(); + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new KeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new KeyVaultSecretProviderClassPatch(); + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.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 _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new KeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new KeyVaultSecretProviderClassPatch(); + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new KeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new KeyVaultSecretProviderClassPatch(); + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.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 _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new KeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new KeyVaultSecretProviderClassPatch(); + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/{azureKeyVaultSecretProviderClassName} + /// + /// + /// Operation Id + /// AzureKeyVaultSecretProviderClass_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesClientDiagnostics.CreateScope("KeyVaultSecretProviderClassResource.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 = _keyVaultSecretProviderClassAzureKeyVaultSecretProviderClassesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new KeyVaultSecretProviderClassResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new KeyVaultSecretProviderClassPatch(); + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/KeyVaultSecretProviderClassOperationSource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/KeyVaultSecretProviderClassOperationSource.cs new file mode 100644 index 000000000000..3b7315a4ea4d --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/KeyVaultSecretProviderClassOperationSource.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.SecretsStoreExtension +{ + internal class KeyVaultSecretProviderClassOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal KeyVaultSecretProviderClassOperationSource(ArmClient client) + { + _client = client; + } + + KeyVaultSecretProviderClassResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new KeyVaultSecretProviderClassResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new KeyVaultSecretProviderClassResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretSyncOperationSource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretSyncOperationSource.cs new file mode 100644 index 000000000000..addff0b7bb5f --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretSyncOperationSource.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.SecretsStoreExtension +{ + internal class SecretSyncOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal SecretSyncOperationSource(ArmClient client) + { + _client = client; + } + + SecretSyncResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new SecretSyncResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new SecretSyncResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperation.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperation.cs new file mode 100644 index 000000000000..27aad176952b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperation.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.SecretsStoreExtension +{ +#pragma warning disable SA1649 // File name should match first type name + internal class SecretsStoreExtensionArmOperation : 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 SecretsStoreExtensionArmOperation for mocking. + protected SecretsStoreExtensionArmOperation() + { + } + + internal SecretsStoreExtensionArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal SecretsStoreExtensionArmOperation(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, "SecretsStoreExtensionArmOperation", 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperationOfT.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperationOfT.cs new file mode 100644 index 000000000000..f4bf9be94add --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/LongRunningOperation/SecretsStoreExtensionArmOperationOfT.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.SecretsStoreExtension +{ +#pragma warning disable SA1649 // File name should match first type name + internal class SecretsStoreExtensionArmOperation : 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 SecretsStoreExtensionArmOperation for mocking. + protected SecretsStoreExtensionArmOperation() + { + } + + internal SecretsStoreExtensionArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal SecretsStoreExtensionArmOperation(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, "SecretsStoreExtensionArmOperation", 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.Serialization.cs new file mode 100644 index 000000000000..53b56041dc9b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.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.SecretsStoreExtension.Models +{ + internal partial class AzureKeyVaultSecretProviderClassListResult : 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(AzureKeyVaultSecretProviderClassListResult)} 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 + } + } + } + + AzureKeyVaultSecretProviderClassListResult 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(AzureKeyVaultSecretProviderClassListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement, options); + } + + internal static AzureKeyVaultSecretProviderClassListResult DeserializeAzureKeyVaultSecretProviderClassListResult(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(KeyVaultSecretProviderClassData.DeserializeKeyVaultSecretProviderClassData(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 AzureKeyVaultSecretProviderClassListResult(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(AzureKeyVaultSecretProviderClassListResult)} does not support writing '{options.Format}' format."); + } + } + + AzureKeyVaultSecretProviderClassListResult 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 DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureKeyVaultSecretProviderClassListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.cs new file mode 100644 index 000000000000..73dda59dc324 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassListResult.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.SecretsStoreExtension.Models +{ + /// The response of a AzureKeyVaultSecretProviderClass list operation. + internal partial class AzureKeyVaultSecretProviderClassListResult + { + /// + /// 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 AzureKeyVaultSecretProviderClass items on this page. + /// is null. + internal AzureKeyVaultSecretProviderClassListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The AzureKeyVaultSecretProviderClass items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal AzureKeyVaultSecretProviderClassListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AzureKeyVaultSecretProviderClassListResult() + { + } + + /// The AzureKeyVaultSecretProviderClass items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..4a1e64d3963e --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public partial class AzureKeyVaultSecretProviderClassUpdateProperties : 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(AzureKeyVaultSecretProviderClassUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(KeyvaultName)) + { + writer.WritePropertyName("keyvaultName"u8); + writer.WriteStringValue(KeyvaultName); + } + if (Optional.IsDefined(ClientId)) + { + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + } + if (Optional.IsDefined(TenantId)) + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId); + } + if (Optional.IsDefined(Objects)) + { + writer.WritePropertyName("objects"u8); + writer.WriteStringValue(Objects); + } + 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 + } + } + } + + AzureKeyVaultSecretProviderClassUpdateProperties 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(AzureKeyVaultSecretProviderClassUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAzureKeyVaultSecretProviderClassUpdateProperties(document.RootElement, options); + } + + internal static AzureKeyVaultSecretProviderClassUpdateProperties DeserializeAzureKeyVaultSecretProviderClassUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string keyvaultName = default; + string clientId = default; + string tenantId = default; + string objects = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyvaultName"u8)) + { + keyvaultName = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId"u8)) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("objects"u8)) + { + objects = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AzureKeyVaultSecretProviderClassUpdateProperties(keyvaultName, clientId, tenantId, objects, 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(AzureKeyVaultSecretProviderClassUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + AzureKeyVaultSecretProviderClassUpdateProperties 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 DeserializeAzureKeyVaultSecretProviderClassUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AzureKeyVaultSecretProviderClassUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.cs new file mode 100644 index 000000000000..8871ec453a6f --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/AzureKeyVaultSecretProviderClassUpdateProperties.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// The updatable properties of the AzureKeyVaultSecretProviderClass. + public partial class AzureKeyVaultSecretProviderClassUpdateProperties + { + /// + /// 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 AzureKeyVaultSecretProviderClassUpdateProperties() + { + } + + /// Initializes a new instance of . + /// The name of the Azure Key Vault to sync secrets from. + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + /// Objects defines the desired state of synced K8s secret objects. + /// Keeps track of any properties unknown to the library. + internal AzureKeyVaultSecretProviderClassUpdateProperties(string keyvaultName, string clientId, string tenantId, string objects, IDictionary serializedAdditionalRawData) + { + KeyvaultName = keyvaultName; + ClientId = clientId; + TenantId = tenantId; + Objects = objects; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The name of the Azure Key Vault to sync secrets from. + public string KeyvaultName { get; set; } + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + public string ClientId { get; set; } + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + public string TenantId { get; set; } + /// Objects defines the desired state of synced K8s secret objects. + public string Objects { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassPatch.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassPatch.Serialization.cs new file mode 100644 index 000000000000..a1df615d824a --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassPatch.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public partial class KeyVaultSecretProviderClassPatch : 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(KeyVaultSecretProviderClassPatch)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, 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 + } + } + } + + KeyVaultSecretProviderClassPatch 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(KeyVaultSecretProviderClassPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultSecretProviderClassPatch(document.RootElement, options); + } + + internal static KeyVaultSecretProviderClassPatch DeserializeKeyVaultSecretProviderClassPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + AzureKeyVaultSecretProviderClassUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + 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("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = AzureKeyVaultSecretProviderClassUpdateProperties.DeserializeAzureKeyVaultSecretProviderClassUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyVaultSecretProviderClassPatch(tags ?? new ChangeTrackingDictionary(), properties, 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(KeyVaultSecretProviderClassPatch)} does not support writing '{options.Format}' format."); + } + } + + KeyVaultSecretProviderClassPatch 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 DeserializeKeyVaultSecretProviderClassPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyVaultSecretProviderClassPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassPatch.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassPatch.cs new file mode 100644 index 000000000000..fd611df8ecf9 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassPatch.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// The type used for update operations of the AzureKeyVaultSecretProviderClass. + public partial class KeyVaultSecretProviderClassPatch + { + /// + /// 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 KeyVaultSecretProviderClassPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal KeyVaultSecretProviderClassPatch(IDictionary tags, AzureKeyVaultSecretProviderClassUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public AzureKeyVaultSecretProviderClassUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassProperties.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassProperties.Serialization.cs new file mode 100644 index 000000000000..1ba25eab6c20 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassProperties.Serialization.cs @@ -0,0 +1,174 @@ +// 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.SecretsStoreExtension.Models +{ + public partial class KeyVaultSecretProviderClassProperties : 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(KeyVaultSecretProviderClassProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("keyvaultName"u8); + writer.WriteStringValue(KeyvaultName); + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId); + if (Optional.IsDefined(Objects)) + { + writer.WritePropertyName("objects"u8); + writer.WriteStringValue(Objects); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.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 + } + } + } + + KeyVaultSecretProviderClassProperties 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(KeyVaultSecretProviderClassProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKeyVaultSecretProviderClassProperties(document.RootElement, options); + } + + internal static KeyVaultSecretProviderClassProperties DeserializeKeyVaultSecretProviderClassProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string keyvaultName = default; + string clientId = default; + string tenantId = default; + string objects = default; + SecretsStoreExtensionProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("keyvaultName"u8)) + { + keyvaultName = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId"u8)) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("objects"u8)) + { + objects = property.Value.GetString(); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new SecretsStoreExtensionProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KeyVaultSecretProviderClassProperties( + keyvaultName, + clientId, + tenantId, + objects, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(KeyVaultSecretProviderClassProperties)} does not support writing '{options.Format}' format."); + } + } + + KeyVaultSecretProviderClassProperties 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 DeserializeKeyVaultSecretProviderClassProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KeyVaultSecretProviderClassProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassProperties.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassProperties.cs new file mode 100644 index 000000000000..4454af6394e9 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KeyVaultSecretProviderClassProperties.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// The properties of the AzureKeyVaultSecretProviderClass. + public partial class KeyVaultSecretProviderClassProperties + { + /// + /// 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 Azure Key Vault to sync secrets from. + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + /// , or is null. + public KeyVaultSecretProviderClassProperties(string keyvaultName, string clientId, string tenantId) + { + Argument.AssertNotNull(keyvaultName, nameof(keyvaultName)); + Argument.AssertNotNull(clientId, nameof(clientId)); + Argument.AssertNotNull(tenantId, nameof(tenantId)); + + KeyvaultName = keyvaultName; + ClientId = clientId; + TenantId = tenantId; + } + + /// Initializes a new instance of . + /// The name of the Azure Key Vault to sync secrets from. + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + /// Objects defines the desired state of synced K8s secret objects. + /// Provisioning state of the AzureKeyVaultSecretProviderClass instance. + /// Keeps track of any properties unknown to the library. + internal KeyVaultSecretProviderClassProperties(string keyvaultName, string clientId, string tenantId, string objects, SecretsStoreExtensionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + KeyvaultName = keyvaultName; + ClientId = clientId; + TenantId = tenantId; + Objects = objects; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KeyVaultSecretProviderClassProperties() + { + } + + /// The name of the Azure Key Vault to sync secrets from. + public string KeyvaultName { get; set; } + /// The user assigned managed identity client ID that should be used to access the Azure Key Vault. + public string ClientId { get; set; } + /// The Azure Active Directory tenant ID that should be used for authenticating requests to the Azure Key Vault. + public string TenantId { get; set; } + /// Objects defines the desired state of synced K8s secret objects. + public string Objects { get; set; } + /// Provisioning state of the AzureKeyVaultSecretProviderClass instance. + public SecretsStoreExtensionProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.Serialization.cs new file mode 100644 index 000000000000..2d5ea28c1c12 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public partial class KubernetesSecretObjectMapping : 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(KubernetesSecretObjectMapping)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("sourcePath"u8); + writer.WriteStringValue(SourcePath); + writer.WritePropertyName("targetKey"u8); + writer.WriteStringValue(TargetKey); + 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 + } + } + } + + KubernetesSecretObjectMapping 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(KubernetesSecretObjectMapping)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeKubernetesSecretObjectMapping(document.RootElement, options); + } + + internal static KubernetesSecretObjectMapping DeserializeKubernetesSecretObjectMapping(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string sourcePath = default; + string targetKey = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sourcePath"u8)) + { + sourcePath = property.Value.GetString(); + continue; + } + if (property.NameEquals("targetKey"u8)) + { + targetKey = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new KubernetesSecretObjectMapping(sourcePath, targetKey, 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(KubernetesSecretObjectMapping)} does not support writing '{options.Format}' format."); + } + } + + KubernetesSecretObjectMapping 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 DeserializeKubernetesSecretObjectMapping(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(KubernetesSecretObjectMapping)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.cs new file mode 100644 index 000000000000..6215cee11c1b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretObjectMapping.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// Properties defining the mapping between a cloud secret store object and a Kubernetes Secret. + public partial class KubernetesSecretObjectMapping + { + /// + /// 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 . + /// SourcePath is the identifier for the secret data as defined by the external secret provider. This is the key or path to the secret in the provider's system, which gets mounted to a specific path in the pod. The value should match the name of the secret as specified in the SecretProviderClass's objects array. + /// TargetKey is the key in the Kubernetes secret's data field where the secret value will be stored. This key is used to reference the secret data within Kubernetes, and it should be unique within the secret. + /// or is null. + public KubernetesSecretObjectMapping(string sourcePath, string targetKey) + { + Argument.AssertNotNull(sourcePath, nameof(sourcePath)); + Argument.AssertNotNull(targetKey, nameof(targetKey)); + + SourcePath = sourcePath; + TargetKey = targetKey; + } + + /// Initializes a new instance of . + /// SourcePath is the identifier for the secret data as defined by the external secret provider. This is the key or path to the secret in the provider's system, which gets mounted to a specific path in the pod. The value should match the name of the secret as specified in the SecretProviderClass's objects array. + /// TargetKey is the key in the Kubernetes secret's data field where the secret value will be stored. This key is used to reference the secret data within Kubernetes, and it should be unique within the secret. + /// Keeps track of any properties unknown to the library. + internal KubernetesSecretObjectMapping(string sourcePath, string targetKey, IDictionary serializedAdditionalRawData) + { + SourcePath = sourcePath; + TargetKey = targetKey; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal KubernetesSecretObjectMapping() + { + } + + /// SourcePath is the identifier for the secret data as defined by the external secret provider. This is the key or path to the secret in the provider's system, which gets mounted to a specific path in the pod. The value should match the name of the secret as specified in the SecretProviderClass's objects array. + public string SourcePath { get; set; } + /// TargetKey is the key in the Kubernetes secret's data field where the secret value will be stored. This key is used to reference the secret data within Kubernetes, and it should be unique within the secret. + public string TargetKey { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretType.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretType.cs new file mode 100644 index 000000000000..44a8f0b0c321 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/KubernetesSecretType.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.SecretsStoreExtension.Models +{ + /// Supported Kubernetes secret types. + public readonly partial struct KubernetesSecretType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public KubernetesSecretType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OpaqueValue = "Opaque"; + private const string TlsValue = "kubernetes.io/tls"; + + /// Opaque is the default secret type. + public static KubernetesSecretType Opaque { get; } = new KubernetesSecretType(OpaqueValue); + /// The kubernetes.io/tls secret type is for storing a certificate and its associated key that are typically used for TLS. + public static KubernetesSecretType Tls { get; } = new KubernetesSecretType(TlsValue); + /// Determines if two values are the same. + public static bool operator ==(KubernetesSecretType left, KubernetesSecretType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(KubernetesSecretType left, KubernetesSecretType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator KubernetesSecretType(string value) => new KubernetesSecretType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is KubernetesSecretType other && Equals(other); + /// + public bool Equals(KubernetesSecretType 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.Serialization.cs new file mode 100644 index 000000000000..bd897feef2d8 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.Serialization.cs @@ -0,0 +1,199 @@ +// 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.SecretsStoreExtension.Models +{ + public partial class SecretSyncCondition : 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(SecretSyncCondition)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(LastTransitionOn)) + { + writer.WritePropertyName("lastTransitionTime"u8); + writer.WriteStringValue(LastTransitionOn.Value, "O"); + } + if (options.Format != "W") + { + writer.WritePropertyName("message"u8); + writer.WriteStringValue(Message); + } + if (options.Format != "W" && Optional.IsDefined(ObservedGeneration)) + { + writer.WritePropertyName("observedGeneration"u8); + writer.WriteNumberValue(ObservedGeneration.Value); + } + if (options.Format != "W") + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + if (options.Format != "W") + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.ToString()); + } + if (options.Format != "W") + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + 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 + } + } + } + + SecretSyncCondition 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(SecretSyncCondition)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncCondition(document.RootElement, options); + } + + internal static SecretSyncCondition DeserializeSecretSyncCondition(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? lastTransitionTime = default; + string message = default; + long? observedGeneration = default; + string reason = default; + SecretSyncConditionStatusType status = default; + string type = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("lastTransitionTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastTransitionTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("observedGeneration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + observedGeneration = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = new SecretSyncConditionStatusType(property.Value.GetString()); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretSyncCondition( + lastTransitionTime, + message, + observedGeneration, + reason, + status, + type, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SecretSyncCondition)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncCondition 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 DeserializeSecretSyncCondition(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncCondition)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.cs new file mode 100644 index 000000000000..e5c90dc0021b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncCondition.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// A condition represents the status of the secret create and update processes. + public partial class SecretSyncCondition + { + /// + /// 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 . + /// Message is a human readable message indicating details about the transition. This may be an empty string. + /// Reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + /// Status of the condition, one of True, False, Unknown. + /// Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to de-conflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt). + internal SecretSyncCondition(string message, string reason, SecretSyncConditionStatusType status, string type) + { + Message = message; + Reason = reason; + Status = status; + Type = type; + } + + /// Initializes a new instance of . + /// LastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + /// Message is a human readable message indicating details about the transition. This may be an empty string. + /// ObservedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + /// Reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + /// Status of the condition, one of True, False, Unknown. + /// Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to de-conflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt). + /// Keeps track of any properties unknown to the library. + internal SecretSyncCondition(DateTimeOffset? lastTransitionOn, string message, long? observedGeneration, string reason, SecretSyncConditionStatusType status, string type, IDictionary serializedAdditionalRawData) + { + LastTransitionOn = lastTransitionOn; + Message = message; + ObservedGeneration = observedGeneration; + Reason = reason; + Status = status; + Type = type; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretSyncCondition() + { + } + + /// LastTransitionTime is the last time the condition transitioned from one status to another. This should be when the underlying condition changed. If that is not known, then using the time when the API field changed is acceptable. + public DateTimeOffset? LastTransitionOn { get; } + /// Message is a human readable message indicating details about the transition. This may be an empty string. + public string Message { get; } + /// ObservedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance. + public long? ObservedGeneration { get; } + /// Reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty. + public string Reason { get; } + /// Status of the condition, one of True, False, Unknown. + public SecretSyncConditionStatusType Status { get; } + /// Type of condition in CamelCase or in foo.example.com/CamelCase. Many .condition.type values are consistent across resources like Available, but because arbitrary conditions can be useful (see .node.status.conditions), the ability to de-conflict is important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt). + public string Type { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncConditionStatusType.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncConditionStatusType.cs new file mode 100644 index 000000000000..274cb0ff51df --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncConditionStatusType.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.SecretsStoreExtension.Models +{ + /// Status conditions types. + public readonly partial struct SecretSyncConditionStatusType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SecretSyncConditionStatusType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TrueValue = "True"; + private const string FalseValue = "False"; + private const string UnknownValue = "Unknown"; + + /// The status is true. + public static SecretSyncConditionStatusType True { get; } = new SecretSyncConditionStatusType(TrueValue); + /// The status is false. + public static SecretSyncConditionStatusType False { get; } = new SecretSyncConditionStatusType(FalseValue); + /// The status is unknown. + public static SecretSyncConditionStatusType Unknown { get; } = new SecretSyncConditionStatusType(UnknownValue); + /// Determines if two values are the same. + public static bool operator ==(SecretSyncConditionStatusType left, SecretSyncConditionStatusType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SecretSyncConditionStatusType left, SecretSyncConditionStatusType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SecretSyncConditionStatusType(string value) => new SecretSyncConditionStatusType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SecretSyncConditionStatusType other && Equals(other); + /// + public bool Equals(SecretSyncConditionStatusType 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.Serialization.cs new file mode 100644 index 000000000000..ba0bbfdeec5f --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.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.SecretsStoreExtension.Models +{ + internal partial class SecretSyncListResult : 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(SecretSyncListResult)} 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 + } + } + } + + SecretSyncListResult 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(SecretSyncListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncListResult(document.RootElement, options); + } + + internal static SecretSyncListResult DeserializeSecretSyncListResult(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(SecretSyncData.DeserializeSecretSyncData(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 SecretSyncListResult(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(SecretSyncListResult)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncListResult 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 DeserializeSecretSyncListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.cs new file mode 100644 index 000000000000..e127d189a9ab --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncListResult.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.SecretsStoreExtension.Models +{ + /// The response of a SecretSync list operation. + internal partial class SecretSyncListResult + { + /// + /// 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 SecretSync items on this page. + /// is null. + internal SecretSyncListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The SecretSync items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal SecretSyncListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretSyncListResult() + { + } + + /// The SecretSync items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.Serialization.cs new file mode 100644 index 000000000000..85f37199716e --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public partial class SecretSyncPatch : 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(SecretSyncPatch)} does not support writing '{format}' format."); + } + + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, 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 + } + } + } + + SecretSyncPatch 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(SecretSyncPatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncPatch(document.RootElement, options); + } + + internal static SecretSyncPatch DeserializeSecretSyncPatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + SecretSyncUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + 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("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = SecretSyncUpdateProperties.DeserializeSecretSyncUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretSyncPatch(tags ?? new ChangeTrackingDictionary(), properties, 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(SecretSyncPatch)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncPatch 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 DeserializeSecretSyncPatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncPatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.cs new file mode 100644 index 000000000000..01b1a16a1242 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncPatch.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// The type used for update operations of the SecretSync. + public partial class SecretSyncPatch + { + /// + /// 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 SecretSyncPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal SecretSyncPatch(IDictionary tags, SecretSyncUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public SecretSyncUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.Serialization.cs new file mode 100644 index 000000000000..0edf7f84cf1a --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.Serialization.cs @@ -0,0 +1,209 @@ +// 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.SecretsStoreExtension.Models +{ + public partial class SecretSyncProperties : 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(SecretSyncProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("secretProviderClassName"u8); + writer.WriteStringValue(SecretProviderClassName); + writer.WritePropertyName("serviceAccountName"u8); + writer.WriteStringValue(ServiceAccountName); + writer.WritePropertyName("kubernetesSecretType"u8); + writer.WriteStringValue(KubernetesSecretType.ToString()); + if (Optional.IsDefined(ForceSynchronization)) + { + writer.WritePropertyName("forceSynchronization"u8); + writer.WriteStringValue(ForceSynchronization); + } + writer.WritePropertyName("objectSecretMapping"u8); + writer.WriteStartArray(); + foreach (var item in ObjectSecretMapping) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteObjectValue(Status, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.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 + } + } + } + + SecretSyncProperties 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(SecretSyncProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncProperties(document.RootElement, options); + } + + internal static SecretSyncProperties DeserializeSecretSyncProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string secretProviderClassName = default; + string serviceAccountName = default; + KubernetesSecretType kubernetesSecretType = default; + string forceSynchronization = default; + IList objectSecretMapping = default; + SecretSyncStatus status = default; + SecretsStoreExtensionProvisioningState? provisioningState = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretProviderClassName"u8)) + { + secretProviderClassName = property.Value.GetString(); + continue; + } + if (property.NameEquals("serviceAccountName"u8)) + { + serviceAccountName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kubernetesSecretType"u8)) + { + kubernetesSecretType = new KubernetesSecretType(property.Value.GetString()); + continue; + } + if (property.NameEquals("forceSynchronization"u8)) + { + forceSynchronization = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectSecretMapping"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesSecretObjectMapping.DeserializeKubernetesSecretObjectMapping(item, options)); + } + objectSecretMapping = array; + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = SecretSyncStatus.DeserializeSecretSyncStatus(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new SecretsStoreExtensionProvisioningState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretSyncProperties( + secretProviderClassName, + serviceAccountName, + kubernetesSecretType, + forceSynchronization, + objectSecretMapping, + status, + provisioningState, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SecretSyncProperties)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncProperties 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 DeserializeSecretSyncProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.cs new file mode 100644 index 000000000000..42b52f76a42a --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncProperties.cs @@ -0,0 +1,108 @@ +// 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.SecretsStoreExtension.Models +{ + /// The properties of the SecretSync instance. + public partial class SecretSyncProperties + { + /// + /// 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 . + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + /// , or is null. + public SecretSyncProperties(string secretProviderClassName, string serviceAccountName, KubernetesSecretType kubernetesSecretType, IEnumerable objectSecretMapping) + { + Argument.AssertNotNull(secretProviderClassName, nameof(secretProviderClassName)); + Argument.AssertNotNull(serviceAccountName, nameof(serviceAccountName)); + Argument.AssertNotNull(objectSecretMapping, nameof(objectSecretMapping)); + + SecretProviderClassName = secretProviderClassName; + ServiceAccountName = serviceAccountName; + KubernetesSecretType = kubernetesSecretType; + ObjectSecretMapping = objectSecretMapping.ToList(); + } + + /// Initializes a new instance of . + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + /// ForceSynchronization can be used to force the secret synchronization. The secret synchronization is triggered by changing the value in this field. This field is not used to resolve synchronization conflicts. + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + /// SecretSyncStatus defines the observed state of the secret synchronization process. + /// Provisioning state of the SecretSync instance. + /// Keeps track of any properties unknown to the library. + internal SecretSyncProperties(string secretProviderClassName, string serviceAccountName, KubernetesSecretType kubernetesSecretType, string forceSynchronization, IList objectSecretMapping, SecretSyncStatus status, SecretsStoreExtensionProvisioningState? provisioningState, IDictionary serializedAdditionalRawData) + { + SecretProviderClassName = secretProviderClassName; + ServiceAccountName = serviceAccountName; + KubernetesSecretType = kubernetesSecretType; + ForceSynchronization = forceSynchronization; + ObjectSecretMapping = objectSecretMapping; + Status = status; + ProvisioningState = provisioningState; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretSyncProperties() + { + } + + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + public string SecretProviderClassName { get; set; } + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + public string ServiceAccountName { get; set; } + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + public KubernetesSecretType KubernetesSecretType { get; set; } + /// ForceSynchronization can be used to force the secret synchronization. The secret synchronization is triggered by changing the value in this field. This field is not used to resolve synchronization conflicts. + public string ForceSynchronization { get; set; } + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + public IList ObjectSecretMapping { get; } + /// SecretSyncStatus defines the observed state of the secret synchronization process. + public SecretSyncStatus Status { get; } + /// Provisioning state of the SecretSync instance. + public SecretsStoreExtensionProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.Serialization.cs new file mode 100644 index 000000000000..1304ec97393d --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.Serialization.cs @@ -0,0 +1,158 @@ +// 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.SecretsStoreExtension.Models +{ + public partial class SecretSyncStatus : 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(SecretSyncStatus)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(LastSuccessfulSyncOn)) + { + writer.WritePropertyName("lastSuccessfulSyncTime"u8); + writer.WriteStringValue(LastSuccessfulSyncOn.Value, "O"); + } + if (options.Format != "W" && Optional.IsCollectionDefined(Conditions)) + { + writer.WritePropertyName("conditions"u8); + writer.WriteStartArray(); + foreach (var item in Conditions) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SecretSyncStatus 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(SecretSyncStatus)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncStatus(document.RootElement, options); + } + + internal static SecretSyncStatus DeserializeSecretSyncStatus(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset? lastSuccessfulSyncTime = default; + IReadOnlyList conditions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("lastSuccessfulSyncTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSuccessfulSyncTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("conditions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SecretSyncCondition.DeserializeSecretSyncCondition(item, options)); + } + conditions = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretSyncStatus(lastSuccessfulSyncTime, conditions ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SecretSyncStatus)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncStatus 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 DeserializeSecretSyncStatus(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncStatus)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.cs new file mode 100644 index 000000000000..66e1646e429b --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncStatus.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// SecretSyncStatus defines the observed state of the secret synchronization process. + public partial class SecretSyncStatus + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal SecretSyncStatus() + { + Conditions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// LastSuccessfulSyncTime represents the last time the secret was retrieved from the Provider and updated. + /// Conditions represent the status of the secret create and update processes. The status can be True, False, or Unknown with various reasons and messages explaining the state. Examples of reasons include CreateSucceeded, ProviderError, InvalidClusterSecretLabelError, InvalidClusterSecretAnnotationError, UnknownError, ValidatingAdmissionPolicyCheckFailed, UserInputValidationFailed, ControllerSpcError, ControllerInternalError, NoValueChange, and ValueChangeOrForceUpdateDetected. + /// Keeps track of any properties unknown to the library. + internal SecretSyncStatus(DateTimeOffset? lastSuccessfulSyncOn, IReadOnlyList conditions, IDictionary serializedAdditionalRawData) + { + LastSuccessfulSyncOn = lastSuccessfulSyncOn; + Conditions = conditions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// LastSuccessfulSyncTime represents the last time the secret was retrieved from the Provider and updated. + public DateTimeOffset? LastSuccessfulSyncOn { get; } + /// Conditions represent the status of the secret create and update processes. The status can be True, False, or Unknown with various reasons and messages explaining the state. Examples of reasons include CreateSucceeded, ProviderError, InvalidClusterSecretLabelError, InvalidClusterSecretAnnotationError, UnknownError, ValidatingAdmissionPolicyCheckFailed, UserInputValidationFailed, ControllerSpcError, ControllerInternalError, NoValueChange, and ValueChangeOrForceUpdateDetected. + public IReadOnlyList Conditions { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..1090d01db305 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.Serialization.cs @@ -0,0 +1,197 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + public partial class SecretSyncUpdateProperties : 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(SecretSyncUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SecretProviderClassName)) + { + writer.WritePropertyName("secretProviderClassName"u8); + writer.WriteStringValue(SecretProviderClassName); + } + if (Optional.IsDefined(ServiceAccountName)) + { + writer.WritePropertyName("serviceAccountName"u8); + writer.WriteStringValue(ServiceAccountName); + } + if (Optional.IsDefined(KubernetesSecretType)) + { + writer.WritePropertyName("kubernetesSecretType"u8); + writer.WriteStringValue(KubernetesSecretType.Value.ToString()); + } + if (Optional.IsDefined(ForceSynchronization)) + { + writer.WritePropertyName("forceSynchronization"u8); + writer.WriteStringValue(ForceSynchronization); + } + if (Optional.IsCollectionDefined(ObjectSecretMapping)) + { + writer.WritePropertyName("objectSecretMapping"u8); + writer.WriteStartArray(); + foreach (var item in ObjectSecretMapping) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SecretSyncUpdateProperties 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(SecretSyncUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncUpdateProperties(document.RootElement, options); + } + + internal static SecretSyncUpdateProperties DeserializeSecretSyncUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string secretProviderClassName = default; + string serviceAccountName = default; + KubernetesSecretType? kubernetesSecretType = default; + string forceSynchronization = default; + IList objectSecretMapping = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("secretProviderClassName"u8)) + { + secretProviderClassName = property.Value.GetString(); + continue; + } + if (property.NameEquals("serviceAccountName"u8)) + { + serviceAccountName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kubernetesSecretType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kubernetesSecretType = new KubernetesSecretType(property.Value.GetString()); + continue; + } + if (property.NameEquals("forceSynchronization"u8)) + { + forceSynchronization = property.Value.GetString(); + continue; + } + if (property.NameEquals("objectSecretMapping"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(KubernetesSecretObjectMapping.DeserializeKubernetesSecretObjectMapping(item, options)); + } + objectSecretMapping = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SecretSyncUpdateProperties( + secretProviderClassName, + serviceAccountName, + kubernetesSecretType, + forceSynchronization, + objectSecretMapping ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SecretSyncUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncUpdateProperties 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 DeserializeSecretSyncUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.cs new file mode 100644 index 000000000000..7efa6c10509f --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretSyncUpdateProperties.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.SecretsStoreExtension.Models +{ + /// The updatable properties of the SecretSync. + public partial class SecretSyncUpdateProperties + { + /// + /// 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 SecretSyncUpdateProperties() + { + ObjectSecretMapping = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + /// ForceSynchronization can be used to force the secret synchronization. The secret synchronization is triggered by changing the value in this field. This field is not used to resolve synchronization conflicts. + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + /// Keeps track of any properties unknown to the library. + internal SecretSyncUpdateProperties(string secretProviderClassName, string serviceAccountName, KubernetesSecretType? kubernetesSecretType, string forceSynchronization, IList objectSecretMapping, IDictionary serializedAdditionalRawData) + { + SecretProviderClassName = secretProviderClassName; + ServiceAccountName = serviceAccountName; + KubernetesSecretType = kubernetesSecretType; + ForceSynchronization = forceSynchronization; + ObjectSecretMapping = objectSecretMapping; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// SecretProviderClassName specifies the name of the SecretProviderClass resource, which contains the information needed to access the cloud provider secret store. + public string SecretProviderClassName { get; set; } + /// ServiceAccountName specifies the name of the service account used to access the cloud provider secret store. The audience field in the service account token must be passed as parameter in the controller configuration. The audience is used when requesting a token from the API server for the service account; the supported audiences are defined by each provider. + public string ServiceAccountName { get; set; } + /// Type specifies the type of the Kubernetes secret object, e.g. "Opaque" or"kubernetes.io/tls". The controller must have permission to create secrets of the specified type. + public KubernetesSecretType? KubernetesSecretType { get; set; } + /// ForceSynchronization can be used to force the secret synchronization. The secret synchronization is triggered by changing the value in this field. This field is not used to resolve synchronization conflicts. + public string ForceSynchronization { get; set; } + /// An array of SecretObjectData that maps secret data from the external secret provider to the Kubernetes secret. Each entry specifies the source secret in the external provider and the corresponding key in the Kubernetes secret. + public IList ObjectSecretMapping { get; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretsStoreExtensionProvisioningState.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretsStoreExtensionProvisioningState.cs new file mode 100644 index 000000000000..38b3831cf302 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/Models/SecretsStoreExtensionProvisioningState.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.SecretsStoreExtension.Models +{ + /// Provisioning state of the resource. + public readonly partial struct SecretsStoreExtensionProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SecretsStoreExtensionProvisioningState(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 SecretsStoreExtensionProvisioningState Succeeded { get; } = new SecretsStoreExtensionProvisioningState(SucceededValue); + /// Resource creation failed. + public static SecretsStoreExtensionProvisioningState Failed { get; } = new SecretsStoreExtensionProvisioningState(FailedValue); + /// Resource creation was canceled. + public static SecretsStoreExtensionProvisioningState Canceled { get; } = new SecretsStoreExtensionProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(SecretsStoreExtensionProvisioningState left, SecretsStoreExtensionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SecretsStoreExtensionProvisioningState left, SecretsStoreExtensionProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SecretsStoreExtensionProvisioningState(string value) => new SecretsStoreExtensionProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SecretsStoreExtensionProvisioningState other && Equals(other); + /// + public bool Equals(SecretsStoreExtensionProvisioningState 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ProviderConstants.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..1b9edbef5fd9 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/AzureKeyVaultSecretProviderClassesRestOperations.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/AzureKeyVaultSecretProviderClassesRestOperations.cs new file mode 100644 index 000000000000..12d1f9f831cf --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/AzureKeyVaultSecretProviderClassesRestOperations.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.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + internal partial class AzureKeyVaultSecretProviderClassesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AzureKeyVaultSecretProviderClassesRestOperations. + /// 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 AzureKeyVaultSecretProviderClassesRestOperations(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 ?? "2024-08-21-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName) + { + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName) + { + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// 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 AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + KeyVaultSecretProviderClassData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = KeyVaultSecretProviderClassData.DeserializeKeyVaultSecretProviderClassData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((KeyVaultSecretProviderClassData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the properties of an AzureKeyVaultSecretProviderClass instance. + /// 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 AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + KeyVaultSecretProviderClassData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = KeyVaultSecretProviderClassData.DeserializeKeyVaultSecretProviderClassData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((KeyVaultSecretProviderClassData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName, KeyVaultSecretProviderClassData 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName, KeyVaultSecretProviderClassData 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, 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; + } + + /// Creates, or updates, an AzureKeyVaultSecretProviderClass instance. + /// 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 AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, KeyVaultSecretProviderClassData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName, 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); + } + } + + /// Creates, or updates, an AzureKeyVaultSecretProviderClass instance. + /// 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 AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, KeyVaultSecretProviderClassData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName, 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 azureKeyVaultSecretProviderClassName, KeyVaultSecretProviderClassPatch 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName, KeyVaultSecretProviderClassPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates an AzureKeyVaultSecretProviderClass instance. + /// 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 AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, KeyVaultSecretProviderClassPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates an AzureKeyVaultSecretProviderClass instance. + /// 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 AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, KeyVaultSecretProviderClassPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName, patch); + _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 azureKeyVaultSecretProviderClassName) + { + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string azureKeyVaultSecretProviderClassName) + { + 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.SecretSyncController/azureKeyVaultSecretProviderClasses/", false); + uri.AppendPath(azureKeyVaultSecretProviderClassName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes an AzureKeyVaultSecretProviderClass instance. + /// 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 AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + 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 AzureKeyVaultSecretProviderClass instance. + /// 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 AzureKeyVaultSecretProviderClass. + /// 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 azureKeyVaultSecretProviderClassName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(azureKeyVaultSecretProviderClassName, nameof(azureKeyVaultSecretProviderClassName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, azureKeyVaultSecretProviderClassName); + _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.SecretSyncController/azureKeyVaultSecretProviderClasses", 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.SecretSyncController/azureKeyVaultSecretProviderClasses", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(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.SecretSyncController/azureKeyVaultSecretProviderClasses", 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.SecretSyncController/azureKeyVaultSecretProviderClasses", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(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; + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(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; + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the AzureKeyVaultSecretProviderClass instances within an Azure 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: + { + AzureKeyVaultSecretProviderClassListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AzureKeyVaultSecretProviderClassListResult.DeserializeAzureKeyVaultSecretProviderClassListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/SecretSyncsRestOperations.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/SecretSyncsRestOperations.cs new file mode 100644 index 000000000000..dbc1198406d5 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/RestOperations/SecretSyncsRestOperations.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.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + internal partial class SecretSyncsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SecretSyncsRestOperations. + /// 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 SecretSyncsRestOperations(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 ?? "2024-08-21-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string secretSyncName) + { + 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string secretSyncName) + { + 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the properties of a SecretSync instance. + /// 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 SecretSync. + /// 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 secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, secretSyncName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + SecretSyncData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SecretSyncData.DeserializeSecretSyncData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SecretSyncData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the properties of a SecretSync instance. + /// 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 SecretSync. + /// 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 secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, secretSyncName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + SecretSyncData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SecretSyncData.DeserializeSecretSyncData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((SecretSyncData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string secretSyncName, SecretSyncData 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string secretSyncName, SecretSyncData 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, 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; + } + + /// Creates new or updates a SecretSync instance. + /// 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 SecretSync. + /// 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 secretSyncName, SecretSyncData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, secretSyncName, 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); + } + } + + /// Creates new or updates a SecretSync instance. + /// 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 SecretSync. + /// 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 secretSyncName, SecretSyncData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, secretSyncName, 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 secretSyncName, SecretSyncPatch 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string secretSyncName, SecretSyncPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Updates a SecretSync instance. + /// 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 SecretSync. + /// 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 secretSyncName, SecretSyncPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, secretSyncName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Updates a SecretSync instance. + /// 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 SecretSync. + /// 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 secretSyncName, SecretSyncPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, secretSyncName, patch); + _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 secretSyncName) + { + 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string secretSyncName) + { + 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.SecretSyncController/secretSyncs/", false); + uri.AppendPath(secretSyncName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Deletes a SecretSync instance. + /// 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 SecretSync. + /// 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 secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, secretSyncName); + 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 a SecretSync instance. + /// 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 SecretSync. + /// 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 secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, secretSyncName); + _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.SecretSyncController/secretSyncs", 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.SecretSyncController/secretSyncs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the SecretSync instances within 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: + { + SecretSyncListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the SecretSync instances within 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: + { + SecretSyncListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SecretSyncListResult.DeserializeSecretSyncListResult(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.SecretSyncController/secretSyncs", 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.SecretSyncController/secretSyncs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the SecretSync instances within an Azure 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: + { + SecretSyncListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the SecretSync instances within an Azure 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: + { + SecretSyncListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SecretSyncListResult.DeserializeSecretSyncListResult(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; + } + + /// Lists the SecretSync instances within 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: + { + SecretSyncListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the SecretSync instances within 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: + { + SecretSyncListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SecretSyncListResult.DeserializeSecretSyncListResult(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; + } + + /// Lists the SecretSync instances within an Azure 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: + { + SecretSyncListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the SecretSync instances within an Azure 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: + { + SecretSyncListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = SecretSyncListResult.DeserializeSecretSyncListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncCollection.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncCollection.cs new file mode 100644 index 000000000000..90636837d6f8 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncCollection.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.SecretsStoreExtension +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetSecretSyncs method from an instance of . + /// + public partial class SecretSyncCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _secretSyncClientDiagnostics; + private readonly SecretSyncsRestOperations _secretSyncRestClient; + + /// Initializes a new instance of the class for mocking. + protected SecretSyncCollection() + { + } + + /// 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 SecretSyncCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _secretSyncClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", SecretSyncResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SecretSyncResource.ResourceType, out string secretSyncApiVersion); + _secretSyncRestClient = new SecretSyncsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, secretSyncApiVersion); +#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)); + } + + /// + /// Creates new or updates a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-08-21-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 SecretSync. + /// 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 secretSyncName, SecretSyncData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, data, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(new SecretSyncOperationSource(Client), _secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates new or updates a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-08-21-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 SecretSync. + /// 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 secretSyncName, SecretSyncData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _secretSyncRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, data, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(new SecretSyncOperationSource(Client), _secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.Get"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.Get"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists the SecretSync instances within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-08-21-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) => _secretSyncRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _secretSyncRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SecretSyncResource(Client, SecretSyncData.DeserializeSecretSyncData(e)), _secretSyncClientDiagnostics, Pipeline, "SecretSyncCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists the SecretSync instances within a resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs + /// + /// + /// Operation Id + /// SecretSync_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-08-21-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) => _secretSyncRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _secretSyncRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SecretSyncResource(Client, SecretSyncData.DeserializeSecretSyncData(e)), _secretSyncClientDiagnostics, Pipeline, "SecretSyncCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.Exists"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.Exists"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the SecretSync. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string secretSyncName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(secretSyncName, nameof(secretSyncName)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncCollection.GetIfExists"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, secretSyncName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.Serialization.cs new file mode 100644 index 000000000000..c1d853803495 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.Serialization.cs @@ -0,0 +1,195 @@ +// 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.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + public partial class SecretSyncData : 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(SecretSyncData)} 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(ExtendedLocation)) + { + writer.WritePropertyName("extendedLocation"u8); + JsonSerializer.Serialize(writer, ExtendedLocation); + } + } + + SecretSyncData 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(SecretSyncData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSecretSyncData(document.RootElement, options); + } + + internal static SecretSyncData DeserializeSecretSyncData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SecretSyncProperties properties = default; + ExtendedLocation extendedLocation = 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 = SecretSyncProperties.DeserializeSecretSyncProperties(property.Value, options); + continue; + } + if (property.NameEquals("extendedLocation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + extendedLocation = JsonSerializer.Deserialize(property.Value.GetRawText()); + 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 SecretSyncData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + extendedLocation, + 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(SecretSyncData)} does not support writing '{options.Format}' format."); + } + } + + SecretSyncData 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 DeserializeSecretSyncData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SecretSyncData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.cs new file mode 100644 index 000000000000..7e2eef8e5d51 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncData.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + /// + /// A class representing the SecretSync data model. + /// The SecretSync resource. + /// + public partial class SecretSyncData : 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 SecretSyncData(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. + /// + /// Keeps track of any properties unknown to the library. + internal SecretSyncData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, SecretSyncProperties properties, ExtendedLocation extendedLocation, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + ExtendedLocation = extendedLocation; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SecretSyncData() + { + } + + /// The resource-specific properties for this resource. + public SecretSyncProperties Properties { get; set; } + /// Gets or sets the extended location. + public ExtendedLocation ExtendedLocation { get; set; } + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.Serialization.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.Serialization.cs new file mode 100644 index 000000000000..f1813c853f61 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.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.SecretsStoreExtension +{ + public partial class SecretSyncResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + SecretSyncData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + SecretSyncData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.cs new file mode 100644 index 000000000000..b93aa29c7797 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Generated/SecretSyncResource.cs @@ -0,0 +1,707 @@ +// 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; +using Azure.ResourceManager.SecretsStoreExtension.Models; + +namespace Azure.ResourceManager.SecretsStoreExtension +{ + /// + /// A Class representing a SecretSync along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSecretSyncResource method. + /// Otherwise you can get one from its parent resource using the GetSecretSync method. + /// + public partial class SecretSyncResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The secretSyncName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string secretSyncName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _secretSyncClientDiagnostics; + private readonly SecretSyncsRestOperations _secretSyncRestClient; + private readonly SecretSyncData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.SecretSyncController/secretSyncs"; + + /// Initializes a new instance of the class for mocking. + protected SecretSyncResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SecretSyncResource(ArmClient client, SecretSyncData 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 SecretSyncResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _secretSyncClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.SecretsStoreExtension", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string secretSyncApiVersion); + _secretSyncRestClient = new SecretSyncsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, secretSyncApiVersion); +#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 SecretSyncData 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 the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Get"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the properties of a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Get"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SecretSyncResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Deletes a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Delete + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Delete"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(_secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.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 a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Delete + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Delete"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(_secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.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; + } + } + + /// + /// Updates a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Update + /// + /// + /// Default Api Version + /// 2024-08-21-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, SecretSyncPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Update"); + scope.Start(); + try + { + var response = await _secretSyncRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new SecretsStoreExtensionArmOperation(new SecretSyncOperationSource(Client), _secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).Request, response, OperationFinalStateVia.Location); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Updates a SecretSync instance. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Update + /// + /// + /// Default Api Version + /// 2024-08-21-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, SecretSyncPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.Update"); + scope.Start(); + try + { + var response = _secretSyncRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new SecretsStoreExtensionArmOperation(new SecretSyncOperationSource(Client), _secretSyncClientDiagnostics, Pipeline, _secretSyncRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch).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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SecretSyncPatch(); + 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SecretSyncPatch(); + 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SecretSyncPatch(); + 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SecretSyncPatch(); + 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 _secretSyncRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new SecretSyncPatch(); + 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.SecretSyncController/secretSyncs/{secretSyncName} + /// + /// + /// Operation Id + /// SecretSync_Get + /// + /// + /// Default Api Version + /// 2024-08-21-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 = _secretSyncClientDiagnostics.CreateScope("SecretSyncResource.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 = _secretSyncRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new SecretSyncResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new SecretSyncPatch(); + 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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Properties/AssemblyInfo.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..c524cff48064 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/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.SecretsStoreExtension.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("SecretsStoreExtension")] diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/Azure.ResourceManager.SecretsStoreExtension.Tests.csproj b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/Azure.ResourceManager.SecretsStoreExtension.Tests.csproj new file mode 100644 index 000000000000..59bad16dad6e --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/Azure.ResourceManager.SecretsStoreExtension.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestBase.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestBase.cs new file mode 100644 index 000000000000..7e9627fca2f5 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestBase.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.SecretsStoreExtension.Tests +{ + public class SecretsStoreExtensionManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected SecretsStoreExtensionManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected SecretsStoreExtensionManagementTestBase(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/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestEnvironment.cs b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestEnvironment.cs new file mode 100644 index 000000000000..5cf2a0cf0b72 --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tests/SecretsStoreExtensionManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.SecretsStoreExtension.Tests +{ + public class SecretsStoreExtensionManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tsp-location.yaml b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tsp-location.yaml new file mode 100644 index 000000000000..d0410d09864e --- /dev/null +++ b/sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/ews/SecretSyncController.Management +commit: e80784b9c77ec082a22deedd236ee78b872db334 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/edgeworkloadsecurity/ci.mgmt.yml b/sdk/edgeworkloadsecurity/ci.mgmt.yml new file mode 100644 index 000000000000..c2472957d0de --- /dev/null +++ b/sdk/edgeworkloadsecurity/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/edgeworkloadsecurity /ci.mgmt.yml + - sdk/edgeworkloadsecurity /Azure.ResourceManager.SecretsStoreExtension / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: edgeworkloadsecurity + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.SecretsStoreExtension + safeName: AzureResourceManagerSecretsStoreExtension diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index 9ae0a7e75290..34e9bc6e0434 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -83,6 +83,7 @@ trigger: - sdk/durabletask/Azure.ResourceManager.DurableTask - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder + - sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension - sdk/edgezones/Azure.ResourceManager.EdgeZones - sdk/elastic/Azure.ResourceManager.Elastic - sdk/elasticsan/Azure.ResourceManager.ElasticSan @@ -299,6 +300,7 @@ pr: - sdk/durabletask/Azure.ResourceManager.DurableTask - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder + - sdk/edgeworkloadsecurity/Azure.ResourceManager.SecretsStoreExtension - sdk/edgezones/Azure.ResourceManager.EdgeZones - sdk/elastic/Azure.ResourceManager.Elastic - sdk/elasticsan/Azure.ResourceManager.ElasticSan 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/