diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Azure.ResourceManager.AgriculturePlatform.sln b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Azure.ResourceManager.AgriculturePlatform.sln new file mode 100644 index 000000000000..6ab8d706f738 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Azure.ResourceManager.AgriculturePlatform.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.AgriculturePlatform.Samples", "samples\Azure.ResourceManager.AgriculturePlatform.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.AgriculturePlatform", "src\Azure.ResourceManager.AgriculturePlatform.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.AgriculturePlatform.Tests", "tests\Azure.ResourceManager.AgriculturePlatform.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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/CHANGELOG.md b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Directory.Build.props b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/README.md b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/README.md new file mode 100644 index 000000000000..32e0e8fbfd8c --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure AgriculturePlatform 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 AgriculturePlatform management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.AgriculturePlatform --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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.net8.0.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.net8.0.cs new file mode 100644 index 000000000000..a43a0317c229 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.net8.0.cs @@ -0,0 +1,321 @@ +namespace Azure.ResourceManager.AgriculturePlatform +{ + public static partial class AgriculturePlatformExtensions + { + public static Azure.Response GetAgricultureService(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetAgricultureServiceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.AgricultureServiceResource GetAgricultureServiceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.AgricultureServiceCollection GetAgricultureServices(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetAgricultureServices(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetAgricultureServicesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AgricultureServiceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected AgricultureServiceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string agriServiceResourceName, Azure.ResourceManager.AgriculturePlatform.AgricultureServiceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string agriServiceResourceName, Azure.ResourceManager.AgriculturePlatform.AgricultureServiceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string agriServiceResourceName, 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 agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string agriServiceResourceName, 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 AgricultureServiceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgricultureServiceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku Sku { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.AgricultureServiceData 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.AgriculturePlatform.AgricultureServiceData 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 AgricultureServiceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected AgricultureServiceResource() { } + public virtual Azure.ResourceManager.AgriculturePlatform.AgricultureServiceData 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 agriServiceResourceName) { 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 GetAvailableSolutions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvailableSolutionsAsync(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.AgriculturePlatform.AgricultureServiceData 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.AgriculturePlatform.AgricultureServiceData 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.AgriculturePlatform.Models.AgricultureServicePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServicePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.AgriculturePlatform.Mocking +{ + public partial class MockableAgriculturePlatformArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformArmClient() { } + public virtual Azure.ResourceManager.AgriculturePlatform.AgricultureServiceResource GetAgricultureServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAgriculturePlatformResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformResourceGroupResource() { } + public virtual Azure.Response GetAgricultureService(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAgricultureServiceAsync(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AgriculturePlatform.AgricultureServiceCollection GetAgricultureServices() { throw null; } + } + public partial class MockableAgriculturePlatformSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformSubscriptionResource() { } + public virtual Azure.Pageable GetAgricultureServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAgricultureServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AgriculturePlatformProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AgriculturePlatformProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState 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.AgriculturePlatform.Models.AgriculturePlatformProvisioningState left, Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState left, Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AgriculturePlatformSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriculturePlatformSku(string name) { } + public int? Capacity { get { throw null; } set { } } + public string Family { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Size { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSkuTier? Tier { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku 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.AgriculturePlatform.Models.AgriculturePlatformSku 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 enum AgriculturePlatformSkuTier + { + Free = 0, + Basic = 1, + Standard = 2, + Premium = 3, + } + public partial class AgricultureServiceConfig : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgricultureServiceConfig() { } + public Azure.Core.ResourceIdentifier AppServiceResourceId { get { throw null; } } + public Azure.Core.ResourceIdentifier CosmosDBResourceId { get { throw null; } } + public string InstanceUri { get { throw null; } } + public Azure.Core.ResourceIdentifier KeyVaultResourceId { get { throw null; } } + public Azure.Core.ResourceIdentifier RedisCacheResourceId { get { throw null; } } + public Azure.Core.ResourceIdentifier StorageAccountResourceId { get { throw null; } } + public string Version { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceConfig 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.AgriculturePlatform.Models.AgricultureServiceConfig 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 AgricultureServicePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgricultureServicePatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku Sku { 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.AgriculturePlatform.Models.AgricultureServicePatch 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.AgriculturePlatform.Models.AgricultureServicePatch 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 AgricultureServiceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgricultureServiceProperties() { } + public Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceConfig Config { get { throw null; } set { } } + public System.Collections.Generic.IList DataConnectorCredentials { get { throw null; } } + public System.Collections.Generic.IList InstalledSolutions { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ManagedOnBehalfOfMoboBrokerResources { get { throw null; } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceProperties 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.AgriculturePlatform.Models.AgricultureServiceProperties 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 AgricultureSolution : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgricultureSolution() { } + public string ApplicationName { get { throw null; } set { } } + public string MarketPlacePublisherId { get { throw null; } set { } } + public string PartnerId { get { throw null; } set { } } + public string PlanId { get { throw null; } set { } } + public string SaasSubscriptionId { get { throw null; } set { } } + public string SaasSubscriptionName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgricultureSolution 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.AgriculturePlatform.Models.AgricultureSolution 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 AgriServiceResourceUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceResourceUpdateProperties() { } + public Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceConfig Config { get { throw null; } set { } } + public System.Collections.Generic.IList DataConnectorCredentials { get { throw null; } } + public System.Collections.Generic.IList InstalledSolutions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties 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.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties 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 static partial class ArmAgriculturePlatformModelFactory + { + public static Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceConfig AgricultureServiceConfig(string instanceUri = null, string version = null, Azure.Core.ResourceIdentifier appServiceResourceId = null, Azure.Core.ResourceIdentifier cosmosDBResourceId = null, Azure.Core.ResourceIdentifier storageAccountResourceId = null, Azure.Core.ResourceIdentifier keyVaultResourceId = null, Azure.Core.ResourceIdentifier redisCacheResourceId = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.AgricultureServiceData AgricultureServiceData(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.AgriculturePlatform.Models.AgricultureServiceProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku sku = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceProperties AgricultureServiceProperties(Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState? provisioningState = default(Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState?), Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceConfig config = null, System.Collections.Generic.IEnumerable managedOnBehalfOfMoboBrokerResources = null, System.Collections.Generic.IEnumerable dataConnectorCredentials = null, System.Collections.Generic.IEnumerable installedSolutions = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AvailableAgriSolutionListResult AvailableAgriSolutionListResult(System.Collections.Generic.IEnumerable solutions = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.DataManagerForAgricultureSolution DataManagerForAgricultureSolution(string partnerId = null, string solutionId = null, string partnerTenantId = null, System.Collections.Generic.IEnumerable dataAccessScopes = null, Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails marketPlaceOfferDetails = null, string saasApplicationId = null, string accessAzureDataManagerForAgricultureApplicationId = null, string accessAzureDataManagerForAgricultureApplicationName = null, bool isValidateInput = false) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails MarketPlaceOfferDetails(string saasOfferId = null, string publisherId = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AuthCredentialsKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AuthCredentialsKind(string value) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind ApiKeyAuthCredentials { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind OAuthClientCredentials { get { throw null; } } + public bool Equals(Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind 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.AgriculturePlatform.Models.AuthCredentialsKind left, Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind right) { throw null; } + public static implicit operator Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind left, Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AvailableAgriSolutionListResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AvailableAgriSolutionListResult() { } + public System.Collections.Generic.IReadOnlyList Solutions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AvailableAgriSolutionListResult 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.AgriculturePlatform.Models.AvailableAgriSolutionListResult 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 DataConnectorCredentialMap : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DataConnectorCredentialMap(string key, Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials value) { } + public string Key { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials Value { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentialMap 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.AgriculturePlatform.Models.DataConnectorCredentialMap 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 DataConnectorCredentials : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DataConnectorCredentials() { } + public string ClientId { get { throw null; } set { } } + public string KeyName { get { throw null; } set { } } + public string KeyVaultUri { get { throw null; } set { } } + public string KeyVersion { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind? Kind { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials 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.AgriculturePlatform.Models.DataConnectorCredentials 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 DataManagerForAgricultureSolution : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DataManagerForAgricultureSolution() { } + public string AccessAzureDataManagerForAgricultureApplicationId { get { throw null; } } + public string AccessAzureDataManagerForAgricultureApplicationName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList DataAccessScopes { get { throw null; } } + public bool IsValidateInput { get { throw null; } } + public Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails MarketPlaceOfferDetails { get { throw null; } } + public string PartnerId { get { throw null; } } + public string PartnerTenantId { get { throw null; } } + public string SaasApplicationId { get { throw null; } } + public string SolutionId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataManagerForAgricultureSolution 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.AgriculturePlatform.Models.DataManagerForAgricultureSolution 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 InstalledSolutionMap : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InstalledSolutionMap(string key, Azure.ResourceManager.AgriculturePlatform.Models.AgricultureSolution value) { } + public string Key { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgricultureSolution Value { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.InstalledSolutionMap 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.AgriculturePlatform.Models.InstalledSolutionMap 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 MarketPlaceOfferDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal MarketPlaceOfferDetails() { } + public string PublisherId { get { throw null; } } + public string SaasOfferId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails 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.AgriculturePlatform.Models.MarketPlaceOfferDetails 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.netstandard2.0.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.netstandard2.0.cs new file mode 100644 index 000000000000..a43a0317c229 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/api/Azure.ResourceManager.AgriculturePlatform.netstandard2.0.cs @@ -0,0 +1,321 @@ +namespace Azure.ResourceManager.AgriculturePlatform +{ + public static partial class AgriculturePlatformExtensions + { + public static Azure.Response GetAgricultureService(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetAgricultureServiceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.AgricultureServiceResource GetAgricultureServiceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.AgricultureServiceCollection GetAgricultureServices(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetAgricultureServices(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetAgricultureServicesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class AgricultureServiceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected AgricultureServiceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string agriServiceResourceName, Azure.ResourceManager.AgriculturePlatform.AgricultureServiceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string agriServiceResourceName, Azure.ResourceManager.AgriculturePlatform.AgricultureServiceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string agriServiceResourceName, 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 agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string agriServiceResourceName, 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 AgricultureServiceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgricultureServiceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku Sku { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.AgricultureServiceData 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.AgriculturePlatform.AgricultureServiceData 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 AgricultureServiceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected AgricultureServiceResource() { } + public virtual Azure.ResourceManager.AgriculturePlatform.AgricultureServiceData 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 agriServiceResourceName) { 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 GetAvailableSolutions(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAvailableSolutionsAsync(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.AgriculturePlatform.AgricultureServiceData 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.AgriculturePlatform.AgricultureServiceData 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.AgriculturePlatform.Models.AgricultureServicePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServicePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.AgriculturePlatform.Mocking +{ + public partial class MockableAgriculturePlatformArmClient : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformArmClient() { } + public virtual Azure.ResourceManager.AgriculturePlatform.AgricultureServiceResource GetAgricultureServiceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableAgriculturePlatformResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformResourceGroupResource() { } + public virtual Azure.Response GetAgricultureService(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAgricultureServiceAsync(string agriServiceResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.AgriculturePlatform.AgricultureServiceCollection GetAgricultureServices() { throw null; } + } + public partial class MockableAgriculturePlatformSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableAgriculturePlatformSubscriptionResource() { } + public virtual Azure.Pageable GetAgricultureServices(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAgricultureServicesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AgriculturePlatformProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AgriculturePlatformProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Provisioning { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState 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.AgriculturePlatform.Models.AgriculturePlatformProvisioningState left, Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState left, Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AgriculturePlatformSku : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriculturePlatformSku(string name) { } + public int? Capacity { get { throw null; } set { } } + public string Family { get { throw null; } set { } } + public string Name { get { throw null; } set { } } + public string Size { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSkuTier? Tier { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku 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.AgriculturePlatform.Models.AgriculturePlatformSku 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 enum AgriculturePlatformSkuTier + { + Free = 0, + Basic = 1, + Standard = 2, + Premium = 3, + } + public partial class AgricultureServiceConfig : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgricultureServiceConfig() { } + public Azure.Core.ResourceIdentifier AppServiceResourceId { get { throw null; } } + public Azure.Core.ResourceIdentifier CosmosDBResourceId { get { throw null; } } + public string InstanceUri { get { throw null; } } + public Azure.Core.ResourceIdentifier KeyVaultResourceId { get { throw null; } } + public Azure.Core.ResourceIdentifier RedisCacheResourceId { get { throw null; } } + public Azure.Core.ResourceIdentifier StorageAccountResourceId { get { throw null; } } + public string Version { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceConfig 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.AgriculturePlatform.Models.AgricultureServiceConfig 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 AgricultureServicePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgricultureServicePatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku Sku { 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.AgriculturePlatform.Models.AgricultureServicePatch 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.AgriculturePlatform.Models.AgricultureServicePatch 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 AgricultureServiceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgricultureServiceProperties() { } + public Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceConfig Config { get { throw null; } set { } } + public System.Collections.Generic.IList DataConnectorCredentials { get { throw null; } } + public System.Collections.Generic.IList InstalledSolutions { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ManagedOnBehalfOfMoboBrokerResources { get { throw null; } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState? ProvisioningState { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceProperties 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.AgriculturePlatform.Models.AgricultureServiceProperties 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 AgricultureSolution : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgricultureSolution() { } + public string ApplicationName { get { throw null; } set { } } + public string MarketPlacePublisherId { get { throw null; } set { } } + public string PartnerId { get { throw null; } set { } } + public string PlanId { get { throw null; } set { } } + public string SaasSubscriptionId { get { throw null; } set { } } + public string SaasSubscriptionName { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgricultureSolution 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.AgriculturePlatform.Models.AgricultureSolution 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 AgriServiceResourceUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public AgriServiceResourceUpdateProperties() { } + public Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceConfig Config { get { throw null; } set { } } + public System.Collections.Generic.IList DataConnectorCredentials { get { throw null; } } + public System.Collections.Generic.IList InstalledSolutions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties 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.AgriculturePlatform.Models.AgriServiceResourceUpdateProperties 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 static partial class ArmAgriculturePlatformModelFactory + { + public static Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceConfig AgricultureServiceConfig(string instanceUri = null, string version = null, Azure.Core.ResourceIdentifier appServiceResourceId = null, Azure.Core.ResourceIdentifier cosmosDBResourceId = null, Azure.Core.ResourceIdentifier storageAccountResourceId = null, Azure.Core.ResourceIdentifier keyVaultResourceId = null, Azure.Core.ResourceIdentifier redisCacheResourceId = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.AgricultureServiceData AgricultureServiceData(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.AgriculturePlatform.Models.AgricultureServiceProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null, Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformSku sku = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceProperties AgricultureServiceProperties(Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState? provisioningState = default(Azure.ResourceManager.AgriculturePlatform.Models.AgriculturePlatformProvisioningState?), Azure.ResourceManager.AgriculturePlatform.Models.AgricultureServiceConfig config = null, System.Collections.Generic.IEnumerable managedOnBehalfOfMoboBrokerResources = null, System.Collections.Generic.IEnumerable dataConnectorCredentials = null, System.Collections.Generic.IEnumerable installedSolutions = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AvailableAgriSolutionListResult AvailableAgriSolutionListResult(System.Collections.Generic.IEnumerable solutions = null) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.DataManagerForAgricultureSolution DataManagerForAgricultureSolution(string partnerId = null, string solutionId = null, string partnerTenantId = null, System.Collections.Generic.IEnumerable dataAccessScopes = null, Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails marketPlaceOfferDetails = null, string saasApplicationId = null, string accessAzureDataManagerForAgricultureApplicationId = null, string accessAzureDataManagerForAgricultureApplicationName = null, bool isValidateInput = false) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails MarketPlaceOfferDetails(string saasOfferId = null, string publisherId = null) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AuthCredentialsKind : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AuthCredentialsKind(string value) { throw null; } + public static Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind ApiKeyAuthCredentials { get { throw null; } } + public static Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind OAuthClientCredentials { get { throw null; } } + public bool Equals(Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind 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.AgriculturePlatform.Models.AuthCredentialsKind left, Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind right) { throw null; } + public static implicit operator Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind left, Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AvailableAgriSolutionListResult : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal AvailableAgriSolutionListResult() { } + public System.Collections.Generic.IReadOnlyList Solutions { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.AvailableAgriSolutionListResult 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.AgriculturePlatform.Models.AvailableAgriSolutionListResult 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 DataConnectorCredentialMap : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DataConnectorCredentialMap(string key, Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials value) { } + public string Key { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials Value { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentialMap 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.AgriculturePlatform.Models.DataConnectorCredentialMap 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 DataConnectorCredentials : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public DataConnectorCredentials() { } + public string ClientId { get { throw null; } set { } } + public string KeyName { get { throw null; } set { } } + public string KeyVaultUri { get { throw null; } set { } } + public string KeyVersion { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AuthCredentialsKind? Kind { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataConnectorCredentials 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.AgriculturePlatform.Models.DataConnectorCredentials 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 DataManagerForAgricultureSolution : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal DataManagerForAgricultureSolution() { } + public string AccessAzureDataManagerForAgricultureApplicationId { get { throw null; } } + public string AccessAzureDataManagerForAgricultureApplicationName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList DataAccessScopes { get { throw null; } } + public bool IsValidateInput { get { throw null; } } + public Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails MarketPlaceOfferDetails { get { throw null; } } + public string PartnerId { get { throw null; } } + public string PartnerTenantId { get { throw null; } } + public string SaasApplicationId { get { throw null; } } + public string SolutionId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.DataManagerForAgricultureSolution 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.AgriculturePlatform.Models.DataManagerForAgricultureSolution 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 InstalledSolutionMap : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InstalledSolutionMap(string key, Azure.ResourceManager.AgriculturePlatform.Models.AgricultureSolution value) { } + public string Key { get { throw null; } set { } } + public Azure.ResourceManager.AgriculturePlatform.Models.AgricultureSolution Value { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.InstalledSolutionMap 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.AgriculturePlatform.Models.InstalledSolutionMap 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 MarketPlaceOfferDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal MarketPlaceOfferDetails() { } + public string PublisherId { get { throw null; } } + public string SaasOfferId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.AgriculturePlatform.Models.MarketPlaceOfferDetails 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.AgriculturePlatform.Models.MarketPlaceOfferDetails 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/assets.json b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/assets.json new file mode 100644 index 000000000000..86863301e28a --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/agricultureplatform/Azure.ResourceManager.AgriculturePlatform", + "Tag": "" +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Azure.ResourceManager.AgriculturePlatform.Samples.csproj b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Azure.ResourceManager.AgriculturePlatform.Samples.csproj new file mode 100644 index 000000000000..7142d3cd9660 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Azure.ResourceManager.AgriculturePlatform.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgricultureServiceCollection.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgricultureServiceCollection.cs new file mode 100644 index 000000000000..8da09f7c0ad1 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgricultureServiceCollection.cs @@ -0,0 +1,226 @@ +// 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.AgriculturePlatform.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.AgriculturePlatform.Samples +{ + public partial class Sample_AgricultureServiceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_AgriServiceCreateOrUpdate() + { + // Generated from example definition: 2024-06-01-preview/AgriService_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AgricultureServiceResource + AgricultureServiceCollection collection = resourceGroupResource.GetAgricultureServices(); + + // invoke the operation + string agriServiceResourceName = "abc123"; + AgricultureServiceData data = new AgricultureServiceData(new AzureLocation("pkneuknooprpqirnugzwbkiie")) + { + Properties = new AgricultureServiceProperties + { + Config = new AgricultureServiceConfig(), + DataConnectorCredentials = {new DataConnectorCredentialMap("BackendAADApplicationCredentials", new DataConnectorCredentials +{ +ClientId = "dce298a8-1eec-481a-a8f9-a3cd5a8257b2", +})}, + InstalledSolutions = {new InstalledSolutionMap("bayerAgPowered.cwum", new AgricultureSolution +{ +ApplicationName = "bayerAgPowered.cwum", +})}, + }, + Identity = new ManagedServiceIdentity("None") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("key4955")] = new UserAssignedIdentity() +}, + }, + Sku = new AgriculturePlatformSku("kfl") + { + Tier = AgriculturePlatformSkuTier.Free, + Size = "r", + Family = "xerdhxyjwrypvxphavgrtjphtohf", + Capacity = 20, + }, + Tags = +{ +["key137"] = "oxwansfetzzgdwl" +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, agriServiceResourceName, data); + AgricultureServiceResource 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 + AgricultureServiceData 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_AgriServiceGet() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AgricultureServiceResource + AgricultureServiceCollection collection = resourceGroupResource.GetAgricultureServices(); + + // invoke the operation + string agriServiceResourceName = "abc123"; + AgricultureServiceResource result = await collection.GetAsync(agriServiceResourceName); + + // 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 + AgricultureServiceData 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_AgriServiceListByResourceGroup() + { + // Generated from example definition: 2024-06-01-preview/AgriService_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AgricultureServiceResource + AgricultureServiceCollection collection = resourceGroupResource.GetAgricultureServices(); + + // invoke the operation and iterate over the result + await foreach (AgricultureServiceResource 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 + AgricultureServiceData 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_AgriServiceGet() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AgricultureServiceResource + AgricultureServiceCollection collection = resourceGroupResource.GetAgricultureServices(); + + // invoke the operation + string agriServiceResourceName = "abc123"; + bool result = await collection.ExistsAsync(agriServiceResourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_AgriServiceGet() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this AgricultureServiceResource + AgricultureServiceCollection collection = resourceGroupResource.GetAgricultureServices(); + + // invoke the operation + string agriServiceResourceName = "abc123"; + NullableResponse response = await collection.GetIfExistsAsync(agriServiceResourceName); + AgricultureServiceResource 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 + AgricultureServiceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgricultureServiceResource.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgricultureServiceResource.cs new file mode 100644 index 000000000000..6b64ecf4e23b --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_AgricultureServiceResource.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.AgriculturePlatform.Models; +using Azure.ResourceManager.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.AgriculturePlatform.Samples +{ + public partial class Sample_AgricultureServiceResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_AgriServiceGet() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Get_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 AgricultureServiceResource created on azure + // for more information of creating AgricultureServiceResource, please refer to the document of AgricultureServiceResource + string subscriptionId = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + string agriServiceResourceName = "abc123"; + ResourceIdentifier agricultureServiceResourceId = AgricultureServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, agriServiceResourceName); + AgricultureServiceResource agricultureService = client.GetAgricultureServiceResource(agricultureServiceResourceId); + + // invoke the operation + AgricultureServiceResource result = await agricultureService.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 + AgricultureServiceData 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_AgriServiceDelete() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 AgricultureServiceResource created on azure + // for more information of creating AgricultureServiceResource, please refer to the document of AgricultureServiceResource + string subscriptionId = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + string agriServiceResourceName = "abc123"; + ResourceIdentifier agricultureServiceResourceId = AgricultureServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, agriServiceResourceName); + AgricultureServiceResource agricultureService = client.GetAgricultureServiceResource(agricultureServiceResourceId); + + // invoke the operation + await agricultureService.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_AgriServiceUpdate() + { + // Generated from example definition: 2024-06-01-preview/AgriService_Update_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 AgricultureServiceResource created on azure + // for more information of creating AgricultureServiceResource, please refer to the document of AgricultureServiceResource + string subscriptionId = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + string agriServiceResourceName = "abc123"; + ResourceIdentifier agricultureServiceResourceId = AgricultureServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, agriServiceResourceName); + AgricultureServiceResource agricultureService = client.GetAgricultureServiceResource(agricultureServiceResourceId); + + // invoke the operation + AgricultureServicePatch patch = new AgricultureServicePatch + { + Identity = new ManagedServiceIdentity("None") + { + UserAssignedIdentities = +{ +[new ResourceIdentifier("key4771")] = new UserAssignedIdentity() +}, + }, + Sku = new AgriculturePlatformSku("tbdtdfffkar") + { + Tier = AgriculturePlatformSkuTier.Free, + Size = "iusaqqj", + Family = "hxojswlgs", + Capacity = 22, + }, + Tags = +{ +["key9006"] = "kuzlwpujbql" +}, + Properties = new AgriServiceResourceUpdateProperties + { + Config = new AgricultureServiceConfig(), + DataConnectorCredentials = {new DataConnectorCredentialMap("BackendAADApplicationCredentials", new DataConnectorCredentials +{ +ClientId = "dce298a8-1eec-481a-a8f9-a3cd5a8257b2", +})}, + InstalledSolutions = {new InstalledSolutionMap("bayerAgPowered.cwum", new AgricultureSolution +{ +ApplicationName = "bayerAgPowered.cwum", +})}, + }, + }; + ArmOperation lro = await agricultureService.UpdateAsync(WaitUntil.Completed, patch); + AgricultureServiceResource 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 + AgricultureServiceData 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 GetAvailableSolutions_AgriServiceListAvailableSolutions() + { + // Generated from example definition: 2024-06-01-preview/AgriService_ListAvailableSolutions_MaximumSet_Gen.json + // this example is just showing the usage of "AgriService_ListAvailableSolutions" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details 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 AgricultureServiceResource created on azure + // for more information of creating AgricultureServiceResource, please refer to the document of AgricultureServiceResource + string subscriptionId = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + string resourceGroupName = "rgopenapi"; + string agriServiceResourceName = "abc123"; + ResourceIdentifier agricultureServiceResourceId = AgricultureServiceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, agriServiceResourceName); + AgricultureServiceResource agricultureService = client.GetAgricultureServiceResource(agricultureServiceResourceId); + + // invoke the operation + AvailableAgriSolutionListResult result = await agricultureService.GetAvailableSolutionsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..5bc776ddf57d --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.AgriculturePlatform.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAgricultureServices_AgriServiceListBySubscription() + { + // Generated from example definition: 2024-06-01-preview/AgriService_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "AgriServiceResource_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 = "83D293F5-DEFD-4D48-B120-1DC713BE338A"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (AgricultureServiceResource item in subscriptionResource.GetAgricultureServicesAsync()) + { + // 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 + AgricultureServiceData 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Azure.ResourceManager.AgriculturePlatform.csproj b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Azure.ResourceManager.AgriculturePlatform.csproj new file mode 100644 index 000000000000..d8d4e6fdf5ce --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Azure.ResourceManager.AgriculturePlatform.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider AgriculturePlatform. + 1.0.0-beta.1 + azure;management;arm;resource manager;agricultureplatform + Azure.ResourceManager.AgriculturePlatform + + diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceCollection.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceCollection.cs new file mode 100644 index 000000000000..c15a1c9e5717 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceCollection.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.AgriculturePlatform +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetAgricultureServices method from an instance of . + /// + public partial class AgricultureServiceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _agricultureServiceAgriServiceClientDiagnostics; + private readonly AgriServiceRestOperations _agricultureServiceAgriServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected AgricultureServiceCollection() + { + } + + /// 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 AgricultureServiceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _agricultureServiceAgriServiceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.AgriculturePlatform", AgricultureServiceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(AgricultureServiceResource.ResourceType, out string agricultureServiceAgriServiceApiVersion); + _agricultureServiceAgriServiceRestClient = new AgriServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, agricultureServiceAgriServiceApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the AgriService resource. + /// 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 agriServiceResourceName, AgricultureServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _agricultureServiceAgriServiceRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, data, cancellationToken).ConfigureAwait(false); + var operation = new AgriculturePlatformArmOperation(new AgricultureServiceOperationSource(Client), _agricultureServiceAgriServiceClientDiagnostics, Pipeline, _agricultureServiceAgriServiceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the AgriService resource. + /// 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 agriServiceResourceName, AgricultureServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _agricultureServiceAgriServiceRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, data, cancellationToken); + var operation = new AgriculturePlatformArmOperation(new AgricultureServiceOperationSource(Client), _agricultureServiceAgriServiceClientDiagnostics, Pipeline, _agricultureServiceAgriServiceRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceCollection.Get"); + scope.Start(); + try + { + var response = await _agricultureServiceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AgricultureServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceCollection.Get"); + scope.Start(); + try + { + var response = _agricultureServiceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AgricultureServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List AgriServiceResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _agricultureServiceAgriServiceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _agricultureServiceAgriServiceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AgricultureServiceResource(Client, AgricultureServiceData.DeserializeAgricultureServiceData(e)), _agricultureServiceAgriServiceClientDiagnostics, Pipeline, "AgricultureServiceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List AgriServiceResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _agricultureServiceAgriServiceRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _agricultureServiceAgriServiceRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgricultureServiceResource(Client, AgricultureServiceData.DeserializeAgricultureServiceData(e)), _agricultureServiceAgriServiceClientDiagnostics, Pipeline, "AgricultureServiceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceCollection.Exists"); + scope.Start(); + try + { + var response = await _agricultureServiceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceCollection.Exists"); + scope.Start(); + try + { + var response = _agricultureServiceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _agricultureServiceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AgricultureServiceResource(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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _agricultureServiceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, agriServiceResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new AgricultureServiceResource(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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceData.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceData.Serialization.cs new file mode 100644 index 000000000000..af5955e8154c --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceData.Serialization.cs @@ -0,0 +1,212 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.AgriculturePlatform.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + public partial class AgricultureServiceData : 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(AgricultureServiceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + } + + AgricultureServiceData 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(AgricultureServiceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgricultureServiceData(document.RootElement, options); + } + + internal static AgricultureServiceData DeserializeAgricultureServiceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AgricultureServiceProperties properties = default; + ManagedServiceIdentity identity = default; + AgriculturePlatformSku sku = default; + IDictionary tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = AgricultureServiceProperties.DeserializeAgricultureServiceProperties(property.Value, options); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = AgriculturePlatformSku.DeserializeAgriculturePlatformSku(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgricultureServiceData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + identity, + sku, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AgricultureServiceData)} does not support writing '{options.Format}' format."); + } + } + + AgricultureServiceData 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 DeserializeAgricultureServiceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgricultureServiceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceData.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceData.cs new file mode 100644 index 000000000000..bc38ead182b0 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceData.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.AgriculturePlatform.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + /// + /// A class representing the AgricultureService data model. + /// Schema of the AgriService resource from Microsoft.AgriculturePlatform resource provider. + /// + public partial class AgricultureServiceData : 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 AgricultureServiceData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The managed service identities assigned to this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal AgricultureServiceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, AgricultureServiceProperties properties, ManagedServiceIdentity identity, AgriculturePlatformSku sku, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + Sku = sku; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgricultureServiceData() + { + } + + /// The resource-specific properties for this resource. + public AgricultureServiceProperties Properties { get; set; } + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + public AgriculturePlatformSku Sku { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceResource.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceResource.Serialization.cs new file mode 100644 index 000000000000..7722cef2b6d7 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceResource.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.AgriculturePlatform +{ + public partial class AgricultureServiceResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + AgricultureServiceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + AgricultureServiceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceResource.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceResource.cs new file mode 100644 index 000000000000..39a60527109f --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/AgricultureServiceResource.cs @@ -0,0 +1,783 @@ +// 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.AgriculturePlatform.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + /// + /// A Class representing an AgricultureService along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetAgricultureServiceResource method. + /// Otherwise you can get one from its parent resource using the GetAgricultureService method. + /// + public partial class AgricultureServiceResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The agriServiceResourceName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _agricultureServiceAgriServiceClientDiagnostics; + private readonly AgriServiceRestOperations _agricultureServiceAgriServiceRestClient; + private readonly AgricultureServiceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.AgriculturePlatform/agriServices"; + + /// Initializes a new instance of the class for mocking. + protected AgricultureServiceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AgricultureServiceResource(ArmClient client, AgricultureServiceData 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 AgricultureServiceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _agricultureServiceAgriServiceClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.AgriculturePlatform", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string agricultureServiceAgriServiceApiVersion); + _agricultureServiceAgriServiceRestClient = new AgriServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, agricultureServiceAgriServiceApiVersion); +#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 AgricultureServiceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.Get"); + scope.Start(); + try + { + var response = await _agricultureServiceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AgricultureServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.Get"); + scope.Start(); + try + { + var response = _agricultureServiceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AgricultureServiceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Delete + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.Delete"); + scope.Start(); + try + { + var response = await _agricultureServiceAgriServiceRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new AgriculturePlatformArmOperation(_agricultureServiceAgriServiceClientDiagnostics, Pipeline, _agricultureServiceAgriServiceRestClient.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; + } + } + + /// + /// Delete a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Delete + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.Delete"); + scope.Start(); + try + { + var response = _agricultureServiceAgriServiceRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new AgriculturePlatformArmOperation(_agricultureServiceAgriServiceClientDiagnostics, Pipeline, _agricultureServiceAgriServiceRestClient.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; + } + } + + /// + /// Update a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Update + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, AgricultureServicePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.Update"); + scope.Start(); + try + { + var response = await _agricultureServiceAgriServiceRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new AgriculturePlatformArmOperation(new AgricultureServiceOperationSource(Client), _agricultureServiceAgriServiceClientDiagnostics, Pipeline, _agricultureServiceAgriServiceRestClient.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; + } + } + + /// + /// Update a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Update + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, AgricultureServicePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.Update"); + scope.Start(); + try + { + var response = _agricultureServiceAgriServiceRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + var operation = new AgriculturePlatformArmOperation(new AgricultureServiceOperationSource(Client), _agricultureServiceAgriServiceClientDiagnostics, Pipeline, _agricultureServiceAgriServiceRestClient.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; + } + } + + /// + /// Returns the list of available agri solutions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}/listAvailableSolutions + /// + /// + /// Operation Id + /// AgriService_ListAvailableSolutions + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAvailableSolutionsAsync(CancellationToken cancellationToken = default) + { + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.GetAvailableSolutions"); + scope.Start(); + try + { + var response = await _agricultureServiceAgriServiceRestClient.ListAvailableSolutionsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Returns the list of available agri solutions. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName}/listAvailableSolutions + /// + /// + /// Operation Id + /// AgriService_ListAvailableSolutions + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response GetAvailableSolutions(CancellationToken cancellationToken = default) + { + using var scope = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.GetAvailableSolutions"); + scope.Start(); + try + { + var response = _agricultureServiceAgriServiceRestClient.ListAvailableSolutions(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-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 = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.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 _agricultureServiceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AgricultureServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AgricultureServicePatch(); + 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-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 = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.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 = _agricultureServiceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AgricultureServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AgricultureServicePatch(); + 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-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 = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.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 _agricultureServiceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AgricultureServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AgricultureServicePatch(); + 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-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 = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.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 = _agricultureServiceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AgricultureServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AgricultureServicePatch(); + 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-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 = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.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 _agricultureServiceAgriServiceRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new AgricultureServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new AgricultureServicePatch(); + 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.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-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 = _agricultureServiceAgriServiceClientDiagnostics.CreateScope("AgricultureServiceResource.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 = _agricultureServiceAgriServiceRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new AgricultureServiceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new AgricultureServicePatch(); + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ArmAgriculturePlatformModelFactory.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ArmAgriculturePlatformModelFactory.cs new file mode 100644 index 000000000000..1f974950aba0 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ArmAgriculturePlatformModelFactory.cs @@ -0,0 +1,139 @@ +// 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.AgriculturePlatform.Models +{ + /// Model factory for models. + public static partial class ArmAgriculturePlatformModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The managed service identities assigned to this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// A new instance for mocking. + public static AgricultureServiceData AgricultureServiceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, AgricultureServiceProperties properties = null, ManagedServiceIdentity identity = null, AgriculturePlatformSku sku = null) + { + tags ??= new Dictionary(); + + return new AgricultureServiceData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + identity, + sku, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// Config of the AgriService instance. + /// Managed On Behalf Of Configuration. + /// Data connector credentials of AgriService instance. + /// AgriService installed solutions. + /// A new instance for mocking. + public static AgricultureServiceProperties AgricultureServiceProperties(AgriculturePlatformProvisioningState? provisioningState = null, AgricultureServiceConfig config = null, IEnumerable managedOnBehalfOfMoboBrokerResources = null, IEnumerable dataConnectorCredentials = null, IEnumerable installedSolutions = null) + { + managedOnBehalfOfMoboBrokerResources ??= new List(); + dataConnectorCredentials ??= new List(); + installedSolutions ??= new List(); + + return new AgricultureServiceProperties( + provisioningState, + config, + managedOnBehalfOfMoboBrokerResources != null ? new ManagedOnBehalfOfConfiguration(managedOnBehalfOfMoboBrokerResources?.ToList(), serializedAdditionalRawData: null) : null, + dataConnectorCredentials?.ToList(), + installedSolutions?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Instance URI of the AgriService instance. + /// Version of AgriService instance. + /// App service resource Id. + /// Cosmos Db resource Id. + /// Storage account resource Id. + /// Key vault resource Id. + /// Redis cache resource Id. + /// A new instance for mocking. + public static AgricultureServiceConfig AgricultureServiceConfig(string instanceUri = null, string version = null, ResourceIdentifier appServiceResourceId = null, ResourceIdentifier cosmosDBResourceId = null, ResourceIdentifier storageAccountResourceId = null, ResourceIdentifier keyVaultResourceId = null, ResourceIdentifier redisCacheResourceId = null) + { + return new AgricultureServiceConfig( + instanceUri, + version, + appServiceResourceId, + cosmosDBResourceId, + storageAccountResourceId, + keyVaultResourceId, + redisCacheResourceId, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Agri solutions list. + /// A new instance for mocking. + public static AvailableAgriSolutionListResult AvailableAgriSolutionListResult(IEnumerable solutions = null) + { + solutions ??= new List(); + + return new AvailableAgriSolutionListResult(solutions?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Partner Id. + /// Solution Id. + /// Partner tenant Id. + /// Data access scopes. + /// Marketplace offer details. + /// Saas application Id. + /// Entra application Id used to access azure data manager for agriculture instance. + /// Entra application name used to access azure data manager for agriculture instance. + /// Whether solution inference will validate input. + /// A new instance for mocking. + public static DataManagerForAgricultureSolution DataManagerForAgricultureSolution(string partnerId = null, string solutionId = null, string partnerTenantId = null, IEnumerable dataAccessScopes = null, MarketPlaceOfferDetails marketPlaceOfferDetails = null, string saasApplicationId = null, string accessAzureDataManagerForAgricultureApplicationId = null, string accessAzureDataManagerForAgricultureApplicationName = null, bool isValidateInput = default) + { + dataAccessScopes ??= new List(); + + return new DataManagerForAgricultureSolution( + partnerId, + solutionId, + partnerTenantId, + dataAccessScopes?.ToList(), + marketPlaceOfferDetails, + saasApplicationId, + accessAzureDataManagerForAgricultureApplicationId, + accessAzureDataManagerForAgricultureApplicationName, + isValidateInput, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Saas offer Id. + /// Publisher Id. + /// A new instance for mocking. + public static MarketPlaceOfferDetails MarketPlaceOfferDetails(string saasOfferId = null, string publisherId = null) + { + return new MarketPlaceOfferDetails(saasOfferId, publisherId, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/AgriculturePlatformExtensions.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/AgriculturePlatformExtensions.cs new file mode 100644 index 000000000000..3f5c348fff2b --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/AgriculturePlatformExtensions.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.AgriculturePlatform.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + /// A class to add extension methods to Azure.ResourceManager.AgriculturePlatform. + public static partial class AgriculturePlatformExtensions + { + private static MockableAgriculturePlatformArmClient GetMockableAgriculturePlatformArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableAgriculturePlatformArmClient(client0)); + } + + private static MockableAgriculturePlatformResourceGroupResource GetMockableAgriculturePlatformResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableAgriculturePlatformResourceGroupResource(client, resource.Id)); + } + + private static MockableAgriculturePlatformSubscriptionResource GetMockableAgriculturePlatformSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableAgriculturePlatformSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static AgricultureServiceResource GetAgricultureServiceResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableAgriculturePlatformArmClient(client).GetAgricultureServiceResource(id); + } + + /// + /// Gets a collection of AgricultureServiceResources 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 AgricultureServiceResources and their operations over a AgricultureServiceResource. + public static AgricultureServiceCollection GetAgricultureServices(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableAgriculturePlatformResourceGroupResource(resourceGroupResource).GetAgricultureServices(); + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the AgriService resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetAgricultureServiceAsync(this ResourceGroupResource resourceGroupResource, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableAgriculturePlatformResourceGroupResource(resourceGroupResource).GetAgricultureServiceAsync(agriServiceResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the AgriService resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetAgricultureService(this ResourceGroupResource resourceGroupResource, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableAgriculturePlatformResourceGroupResource(resourceGroupResource).GetAgricultureService(agriServiceResourceName, cancellationToken); + } + + /// + /// List AgriServiceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-06-01-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 GetAgricultureServicesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAgriculturePlatformSubscriptionResource(subscriptionResource).GetAgricultureServicesAsync(cancellationToken); + } + + /// + /// List AgriServiceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-06-01-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 GetAgricultureServices(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableAgriculturePlatformSubscriptionResource(subscriptionResource).GetAgricultureServices(cancellationToken); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformArmClient.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformArmClient.cs new file mode 100644 index 000000000000..d499314c3349 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformArmClient.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableAgriculturePlatformArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAgriculturePlatformArmClient() + { + } + + /// 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 MockableAgriculturePlatformArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableAgriculturePlatformArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual AgricultureServiceResource GetAgricultureServiceResource(ResourceIdentifier id) + { + AgricultureServiceResource.ValidateResourceId(id); + return new AgricultureServiceResource(Client, id); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformResourceGroupResource.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformResourceGroupResource.cs new file mode 100644 index 000000000000..dd6ffd8bb8dc --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformResourceGroupResource.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableAgriculturePlatformResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableAgriculturePlatformResourceGroupResource() + { + } + + /// 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 MockableAgriculturePlatformResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of AgricultureServiceResources in the ResourceGroupResource. + /// An object representing collection of AgricultureServiceResources and their operations over a AgricultureServiceResource. + public virtual AgricultureServiceCollection GetAgricultureServices() + { + return GetCachedClient(client => new AgricultureServiceCollection(client, Id)); + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetAgricultureServiceAsync(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + return await GetAgricultureServices().GetAsync(agriServiceResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a AgriServiceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AgriculturePlatform/agriServices/{agriServiceResourceName} + /// + /// + /// Operation Id + /// AgriServiceResource_Get + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the AgriService resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetAgricultureService(string agriServiceResourceName, CancellationToken cancellationToken = default) + { + return GetAgricultureServices().Get(agriServiceResourceName, cancellationToken); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformSubscriptionResource.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformSubscriptionResource.cs new file mode 100644 index 000000000000..570a33d947aa --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Extensions/MockableAgriculturePlatformSubscriptionResource.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.AgriculturePlatform.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableAgriculturePlatformSubscriptionResource : ArmResource + { + private ClientDiagnostics _agricultureServiceAgriServiceClientDiagnostics; + private AgriServiceRestOperations _agricultureServiceAgriServiceRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableAgriculturePlatformSubscriptionResource() + { + } + + /// 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 MockableAgriculturePlatformSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics AgricultureServiceAgriServiceClientDiagnostics => _agricultureServiceAgriServiceClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.AgriculturePlatform", AgricultureServiceResource.ResourceType.Namespace, Diagnostics); + private AgriServiceRestOperations AgricultureServiceAgriServiceRestClient => _agricultureServiceAgriServiceRestClient ??= new AgriServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(AgricultureServiceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List AgriServiceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAgricultureServicesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AgricultureServiceAgriServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgricultureServiceAgriServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new AgricultureServiceResource(Client, AgricultureServiceData.DeserializeAgricultureServiceData(e)), AgricultureServiceAgriServiceClientDiagnostics, Pipeline, "MockableAgriculturePlatformSubscriptionResource.GetAgricultureServices", "value", "nextLink", cancellationToken); + } + + /// + /// List AgriServiceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.AgriculturePlatform/agriServices + /// + /// + /// Operation Id + /// AgriServiceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-06-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAgricultureServices(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => AgricultureServiceAgriServiceRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => AgricultureServiceAgriServiceRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new AgricultureServiceResource(Client, AgricultureServiceData.DeserializeAgricultureServiceData(e)), AgricultureServiceAgriServiceClientDiagnostics, Pipeline, "MockableAgriculturePlatformSubscriptionResource.GetAgricultureServices", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Argument.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..179c68864933 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..ecea3d3eef83 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ChangeTrackingList.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..3d961834ccb2 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..175c8aeb11fc --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Optional.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..edc449f09f8a --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..829294f41cb2 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperation.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperation.cs new file mode 100644 index 000000000000..4a50bda8752b --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperation.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.AgriculturePlatform +{ +#pragma warning disable SA1649 // File name should match first type name + internal class AgriculturePlatformArmOperation : 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 AgriculturePlatformArmOperation for mocking. + protected AgriculturePlatformArmOperation() + { + } + + internal AgriculturePlatformArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal AgriculturePlatformArmOperation(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, "AgriculturePlatformArmOperation", 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperationOfT.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperationOfT.cs new file mode 100644 index 000000000000..29ae9cc5c8ec --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgriculturePlatformArmOperationOfT.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.AgriculturePlatform +{ +#pragma warning disable SA1649 // File name should match first type name + internal class AgriculturePlatformArmOperation : 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 AgriculturePlatformArmOperation for mocking. + protected AgriculturePlatformArmOperation() + { + } + + internal AgriculturePlatformArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal AgriculturePlatformArmOperation(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, "AgriculturePlatformArmOperation", 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgricultureServiceOperationSource.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgricultureServiceOperationSource.cs new file mode 100644 index 000000000000..68a956f6f1a6 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/LongRunningOperation/AgricultureServiceOperationSource.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.AgriculturePlatform +{ + internal class AgricultureServiceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal AgricultureServiceOperationSource(ArmClient client) + { + _client = client; + } + + AgricultureServiceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new AgricultureServiceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new AgricultureServiceResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.Serialization.cs new file mode 100644 index 000000000000..202bbb39a5e4 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.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.AgriculturePlatform.Models +{ + internal partial class AgriServiceResourceListResult : 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(AgriServiceResourceListResult)} 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 + } + } + } + + AgriServiceResourceListResult 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(AgriServiceResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgriServiceResourceListResult(document.RootElement, options); + } + + internal static AgriServiceResourceListResult DeserializeAgriServiceResourceListResult(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(AgricultureServiceData.DeserializeAgricultureServiceData(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 AgriServiceResourceListResult(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(AgriServiceResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + AgriServiceResourceListResult 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 DeserializeAgriServiceResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgriServiceResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.cs new file mode 100644 index 000000000000..5daacaa0b538 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceListResult.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.AgriculturePlatform.Models +{ + /// The response of a AgriServiceResource list operation. + internal partial class AgriServiceResourceListResult + { + /// + /// 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 AgriServiceResource items on this page. + /// is null. + internal AgriServiceResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The AgriServiceResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal AgriServiceResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgriServiceResourceListResult() + { + } + + /// The AgriServiceResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..e12b81d32dab --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.Serialization.cs @@ -0,0 +1,183 @@ +// 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.AgriculturePlatform.Models +{ + public partial class AgriServiceResourceUpdateProperties : 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(AgriServiceResourceUpdateProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Config)) + { + writer.WritePropertyName("config"u8); + writer.WriteObjectValue(Config, options); + } + if (Optional.IsCollectionDefined(DataConnectorCredentials)) + { + writer.WritePropertyName("dataConnectorCredentials"u8); + writer.WriteStartArray(); + foreach (var item in DataConnectorCredentials) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(InstalledSolutions)) + { + writer.WritePropertyName("installedSolutions"u8); + writer.WriteStartArray(); + foreach (var item in InstalledSolutions) + { + 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 + } + } + } + + AgriServiceResourceUpdateProperties 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(AgriServiceResourceUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgriServiceResourceUpdateProperties(document.RootElement, options); + } + + internal static AgriServiceResourceUpdateProperties DeserializeAgriServiceResourceUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AgricultureServiceConfig config = default; + IList dataConnectorCredentials = default; + IList installedSolutions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("config"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + config = AgricultureServiceConfig.DeserializeAgricultureServiceConfig(property.Value, options); + continue; + } + if (property.NameEquals("dataConnectorCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataConnectorCredentialMap.DeserializeDataConnectorCredentialMap(item, options)); + } + dataConnectorCredentials = array; + continue; + } + if (property.NameEquals("installedSolutions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(InstalledSolutionMap.DeserializeInstalledSolutionMap(item, options)); + } + installedSolutions = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgriServiceResourceUpdateProperties(config, dataConnectorCredentials ?? new ChangeTrackingList(), installedSolutions ?? 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(AgriServiceResourceUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + AgriServiceResourceUpdateProperties 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 DeserializeAgriServiceResourceUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgriServiceResourceUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.cs new file mode 100644 index 000000000000..121843e4c479 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriServiceResourceUpdateProperties.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The updatable properties of the AgriServiceResource. + public partial class AgriServiceResourceUpdateProperties + { + /// + /// 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 AgriServiceResourceUpdateProperties() + { + DataConnectorCredentials = new ChangeTrackingList(); + InstalledSolutions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Config of the AgriService instance. + /// Data connector credentials of AgriService instance. + /// AgriService installed solutions. + /// Keeps track of any properties unknown to the library. + internal AgriServiceResourceUpdateProperties(AgricultureServiceConfig config, IList dataConnectorCredentials, IList installedSolutions, IDictionary serializedAdditionalRawData) + { + Config = config; + DataConnectorCredentials = dataConnectorCredentials; + InstalledSolutions = installedSolutions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Config of the AgriService instance. + public AgricultureServiceConfig Config { get; set; } + /// Data connector credentials of AgriService instance. + public IList DataConnectorCredentials { get; } + /// AgriService installed solutions. + public IList InstalledSolutions { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformProvisioningState.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformProvisioningState.cs new file mode 100644 index 000000000000..0026cba971aa --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformProvisioningState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The status of the current operation. + public readonly partial struct AgriculturePlatformProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AgriculturePlatformProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string ProvisioningValue = "Provisioning"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string AcceptedValue = "Accepted"; + + /// Resource has been created. + public static AgriculturePlatformProvisioningState Succeeded { get; } = new AgriculturePlatformProvisioningState(SucceededValue); + /// Resource creation failed. + public static AgriculturePlatformProvisioningState Failed { get; } = new AgriculturePlatformProvisioningState(FailedValue); + /// Resource creation was canceled. + public static AgriculturePlatformProvisioningState Canceled { get; } = new AgriculturePlatformProvisioningState(CanceledValue); + /// The resource is being provisioned. + public static AgriculturePlatformProvisioningState Provisioning { get; } = new AgriculturePlatformProvisioningState(ProvisioningValue); + /// The resource is updating. + public static AgriculturePlatformProvisioningState Updating { get; } = new AgriculturePlatformProvisioningState(UpdatingValue); + /// The resource is being deleted. + public static AgriculturePlatformProvisioningState Deleting { get; } = new AgriculturePlatformProvisioningState(DeletingValue); + /// The resource create request has been accepted. + public static AgriculturePlatformProvisioningState Accepted { get; } = new AgriculturePlatformProvisioningState(AcceptedValue); + /// Determines if two values are the same. + public static bool operator ==(AgriculturePlatformProvisioningState left, AgriculturePlatformProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AgriculturePlatformProvisioningState left, AgriculturePlatformProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AgriculturePlatformProvisioningState(string value) => new AgriculturePlatformProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AgriculturePlatformProvisioningState other && Equals(other); + /// + public bool Equals(AgriculturePlatformProvisioningState 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.Serialization.cs new file mode 100644 index 000000000000..7ad0735d3e71 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.Serialization.cs @@ -0,0 +1,184 @@ +// 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.AgriculturePlatform.Models +{ + public partial class AgriculturePlatformSku : 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(AgriculturePlatformSku)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier.Value.ToSerialString()); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteStringValue(Size); + } + if (Optional.IsDefined(Family)) + { + writer.WritePropertyName("family"u8); + writer.WriteStringValue(Family); + } + if (Optional.IsDefined(Capacity)) + { + writer.WritePropertyName("capacity"u8); + writer.WriteNumberValue(Capacity.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AgriculturePlatformSku 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(AgriculturePlatformSku)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgriculturePlatformSku(document.RootElement, options); + } + + internal static AgriculturePlatformSku DeserializeAgriculturePlatformSku(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + AgriculturePlatformSkuTier? tier = default; + string size = default; + string family = default; + int? capacity = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("tier"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tier = property.Value.GetString().ToAgriculturePlatformSkuTier(); + continue; + } + if (property.NameEquals("size"u8)) + { + size = property.Value.GetString(); + continue; + } + if (property.NameEquals("family"u8)) + { + family = property.Value.GetString(); + continue; + } + if (property.NameEquals("capacity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + capacity = property.Value.GetInt32(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgriculturePlatformSku( + name, + tier, + size, + family, + capacity, + 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(AgriculturePlatformSku)} does not support writing '{options.Format}' format."); + } + } + + AgriculturePlatformSku 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 DeserializeAgriculturePlatformSku(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgriculturePlatformSku)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.cs new file mode 100644 index 000000000000..2d3161a91e82 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSku.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The resource model definition representing SKU. + public partial class AgriculturePlatformSku + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the SKU. Ex - P3. It is typically a letter+number code. + /// is null. + public AgriculturePlatformSku(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Initializes a new instance of . + /// The name of the SKU. Ex - P3. It is typically a letter+number code. + /// This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + /// The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + /// If the service has different generations of hardware, for the same SKU, then that can be captured here. + /// If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + /// Keeps track of any properties unknown to the library. + internal AgriculturePlatformSku(string name, AgriculturePlatformSkuTier? tier, string size, string family, int? capacity, IDictionary serializedAdditionalRawData) + { + Name = name; + Tier = tier; + Size = size; + Family = family; + Capacity = capacity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AgriculturePlatformSku() + { + } + + /// The name of the SKU. Ex - P3. It is typically a letter+number code. + public string Name { get; set; } + /// This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + public AgriculturePlatformSkuTier? Tier { get; set; } + /// The SKU size. When the name field is the combination of tier and some other value, this would be the standalone code. + public string Size { get; set; } + /// If the service has different generations of hardware, for the same SKU, then that can be captured here. + public string Family { get; set; } + /// If the SKU supports scale out/in then the capacity integer should be included. If scale out/in is not possible for the resource this may be omitted. + public int? Capacity { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.Serialization.cs new file mode 100644 index 000000000000..69b2f10d444d --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + internal static partial class AgriculturePlatformSkuTierExtensions + { + public static string ToSerialString(this AgriculturePlatformSkuTier value) => value switch + { + AgriculturePlatformSkuTier.Free => "Free", + AgriculturePlatformSkuTier.Basic => "Basic", + AgriculturePlatformSkuTier.Standard => "Standard", + AgriculturePlatformSkuTier.Premium => "Premium", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AgriculturePlatformSkuTier value.") + }; + + public static AgriculturePlatformSkuTier ToAgriculturePlatformSkuTier(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Free")) return AgriculturePlatformSkuTier.Free; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Basic")) return AgriculturePlatformSkuTier.Basic; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Standard")) return AgriculturePlatformSkuTier.Standard; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Premium")) return AgriculturePlatformSkuTier.Premium; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown AgriculturePlatformSkuTier value."); + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.cs new file mode 100644 index 000000000000..003792193cf8 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgriculturePlatformSkuTier.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// This field is required to be implemented by the Resource Provider if the service has more than one tier, but is not required on a PUT. + public enum AgriculturePlatformSkuTier + { + /// The Free service tier. + Free, + /// The Basic service tier. + Basic, + /// The Standard service tier. + Standard, + /// The Premium service tier. + Premium + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceConfig.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceConfig.Serialization.cs new file mode 100644 index 000000000000..8f7d0cae2238 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceConfig.Serialization.cs @@ -0,0 +1,223 @@ +// 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.AgriculturePlatform.Models +{ + public partial class AgricultureServiceConfig : 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(AgricultureServiceConfig)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(InstanceUri)) + { + writer.WritePropertyName("instanceUri"u8); + writer.WriteStringValue(InstanceUri); + } + if (options.Format != "W" && Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (options.Format != "W" && Optional.IsDefined(AppServiceResourceId)) + { + writer.WritePropertyName("appServiceResourceId"u8); + writer.WriteStringValue(AppServiceResourceId); + } + if (options.Format != "W" && Optional.IsDefined(CosmosDBResourceId)) + { + writer.WritePropertyName("cosmosDbResourceId"u8); + writer.WriteStringValue(CosmosDBResourceId); + } + if (options.Format != "W" && Optional.IsDefined(StorageAccountResourceId)) + { + writer.WritePropertyName("storageAccountResourceId"u8); + writer.WriteStringValue(StorageAccountResourceId); + } + if (options.Format != "W" && Optional.IsDefined(KeyVaultResourceId)) + { + writer.WritePropertyName("keyVaultResourceId"u8); + writer.WriteStringValue(KeyVaultResourceId); + } + if (options.Format != "W" && Optional.IsDefined(RedisCacheResourceId)) + { + writer.WritePropertyName("redisCacheResourceId"u8); + writer.WriteStringValue(RedisCacheResourceId); + } + 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 + } + } + } + + AgricultureServiceConfig 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(AgricultureServiceConfig)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgricultureServiceConfig(document.RootElement, options); + } + + internal static AgricultureServiceConfig DeserializeAgricultureServiceConfig(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string instanceUri = default; + string version = default; + ResourceIdentifier appServiceResourceId = default; + ResourceIdentifier cosmosDbResourceId = default; + ResourceIdentifier storageAccountResourceId = default; + ResourceIdentifier keyVaultResourceId = default; + ResourceIdentifier redisCacheResourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("instanceUri"u8)) + { + instanceUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("appServiceResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + appServiceResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("cosmosDbResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cosmosDbResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("storageAccountResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + storageAccountResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("keyVaultResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keyVaultResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("redisCacheResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redisCacheResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgricultureServiceConfig( + instanceUri, + version, + appServiceResourceId, + cosmosDbResourceId, + storageAccountResourceId, + keyVaultResourceId, + redisCacheResourceId, + 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(AgricultureServiceConfig)} does not support writing '{options.Format}' format."); + } + } + + AgricultureServiceConfig 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 DeserializeAgricultureServiceConfig(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgricultureServiceConfig)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceConfig.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceConfig.cs new file mode 100644 index 000000000000..4f9c863f3cc7 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceConfig.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Config of the AgriService resource instance. + public partial class AgricultureServiceConfig + { + /// + /// 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 AgricultureServiceConfig() + { + } + + /// Initializes a new instance of . + /// Instance URI of the AgriService instance. + /// Version of AgriService instance. + /// App service resource Id. + /// Cosmos Db resource Id. + /// Storage account resource Id. + /// Key vault resource Id. + /// Redis cache resource Id. + /// Keeps track of any properties unknown to the library. + internal AgricultureServiceConfig(string instanceUri, string version, ResourceIdentifier appServiceResourceId, ResourceIdentifier cosmosDBResourceId, ResourceIdentifier storageAccountResourceId, ResourceIdentifier keyVaultResourceId, ResourceIdentifier redisCacheResourceId, IDictionary serializedAdditionalRawData) + { + InstanceUri = instanceUri; + Version = version; + AppServiceResourceId = appServiceResourceId; + CosmosDBResourceId = cosmosDBResourceId; + StorageAccountResourceId = storageAccountResourceId; + KeyVaultResourceId = keyVaultResourceId; + RedisCacheResourceId = redisCacheResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Instance URI of the AgriService instance. + public string InstanceUri { get; } + /// Version of AgriService instance. + public string Version { get; } + /// App service resource Id. + public ResourceIdentifier AppServiceResourceId { get; } + /// Cosmos Db resource Id. + public ResourceIdentifier CosmosDBResourceId { get; } + /// Storage account resource Id. + public ResourceIdentifier StorageAccountResourceId { get; } + /// Key vault resource Id. + public ResourceIdentifier KeyVaultResourceId { get; } + /// Redis cache resource Id. + public ResourceIdentifier RedisCacheResourceId { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServicePatch.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServicePatch.Serialization.cs new file mode 100644 index 000000000000..3fd35decc5eb --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServicePatch.Serialization.cs @@ -0,0 +1,192 @@ +// 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; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class AgricultureServicePatch : 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(AgricultureServicePatch)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku, options); + } + 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 + } + } + } + + AgricultureServicePatch 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(AgricultureServicePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgricultureServicePatch(document.RootElement, options); + } + + internal static AgricultureServicePatch DeserializeAgricultureServicePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ManagedServiceIdentity identity = default; + AgriculturePlatformSku sku = default; + IDictionary tags = default; + AgriServiceResourceUpdateProperties properties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = AgriculturePlatformSku.DeserializeAgriculturePlatformSku(property.Value, options); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = AgriServiceResourceUpdateProperties.DeserializeAgriServiceResourceUpdateProperties(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgricultureServicePatch(identity, sku, 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(AgricultureServicePatch)} does not support writing '{options.Format}' format."); + } + } + + AgricultureServicePatch 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 DeserializeAgricultureServicePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgricultureServicePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServicePatch.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServicePatch.cs new file mode 100644 index 000000000000..559cf78a8150 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServicePatch.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The type used for update operations of the AgriServiceResource. + public partial class AgricultureServicePatch + { + /// + /// 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 AgricultureServicePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// The managed service identities assigned to this resource. + /// The SKU (Stock Keeping Unit) assigned to this resource. + /// Resource tags. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal AgricultureServicePatch(ManagedServiceIdentity identity, AgriculturePlatformSku sku, IDictionary tags, AgriServiceResourceUpdateProperties properties, IDictionary serializedAdditionalRawData) + { + Identity = identity; + Sku = sku; + Tags = tags; + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + /// The SKU (Stock Keeping Unit) assigned to this resource. + public AgriculturePlatformSku Sku { get; set; } + /// Resource tags. + public IDictionary Tags { get; } + /// The resource-specific properties for this resource. + public AgriServiceResourceUpdateProperties Properties { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceProperties.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceProperties.Serialization.cs new file mode 100644 index 000000000000..3a533cf7981d --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceProperties.Serialization.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + public partial class AgricultureServiceProperties : 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(AgricultureServiceProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(Config)) + { + writer.WritePropertyName("config"u8); + writer.WriteObjectValue(Config, options); + } + if (options.Format != "W" && Optional.IsDefined(ManagedOnBehalfOfConfiguration)) + { + writer.WritePropertyName("managedOnBehalfOfConfiguration"u8); + writer.WriteObjectValue(ManagedOnBehalfOfConfiguration, options); + } + if (Optional.IsCollectionDefined(DataConnectorCredentials)) + { + writer.WritePropertyName("dataConnectorCredentials"u8); + writer.WriteStartArray(); + foreach (var item in DataConnectorCredentials) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(InstalledSolutions)) + { + writer.WritePropertyName("installedSolutions"u8); + writer.WriteStartArray(); + foreach (var item in InstalledSolutions) + { + 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 + } + } + } + + AgricultureServiceProperties 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(AgricultureServiceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgricultureServiceProperties(document.RootElement, options); + } + + internal static AgricultureServiceProperties DeserializeAgricultureServiceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AgriculturePlatformProvisioningState? provisioningState = default; + AgricultureServiceConfig config = default; + ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration = default; + IList dataConnectorCredentials = default; + IList installedSolutions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new AgriculturePlatformProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("config"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + config = AgricultureServiceConfig.DeserializeAgricultureServiceConfig(property.Value, options); + continue; + } + if (property.NameEquals("managedOnBehalfOfConfiguration"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + managedOnBehalfOfConfiguration = ManagedOnBehalfOfConfiguration.DeserializeManagedOnBehalfOfConfiguration(property.Value, options); + continue; + } + if (property.NameEquals("dataConnectorCredentials"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataConnectorCredentialMap.DeserializeDataConnectorCredentialMap(item, options)); + } + dataConnectorCredentials = array; + continue; + } + if (property.NameEquals("installedSolutions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(InstalledSolutionMap.DeserializeInstalledSolutionMap(item, options)); + } + installedSolutions = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgricultureServiceProperties( + provisioningState, + config, + managedOnBehalfOfConfiguration, + dataConnectorCredentials ?? new ChangeTrackingList(), + installedSolutions ?? 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(AgricultureServiceProperties)} does not support writing '{options.Format}' format."); + } + } + + AgricultureServiceProperties 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 DeserializeAgricultureServiceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgricultureServiceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceProperties.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceProperties.cs new file mode 100644 index 000000000000..9955e4c110d9 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureServiceProperties.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Details of the Agriculture AgriDataManager. + public partial class AgricultureServiceProperties + { + /// + /// 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 AgricultureServiceProperties() + { + DataConnectorCredentials = new ChangeTrackingList(); + InstalledSolutions = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The status of the last operation. + /// Config of the AgriService instance. + /// Managed On Behalf Of Configuration. + /// Data connector credentials of AgriService instance. + /// AgriService installed solutions. + /// Keeps track of any properties unknown to the library. + internal AgricultureServiceProperties(AgriculturePlatformProvisioningState? provisioningState, AgricultureServiceConfig config, ManagedOnBehalfOfConfiguration managedOnBehalfOfConfiguration, IList dataConnectorCredentials, IList installedSolutions, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + Config = config; + ManagedOnBehalfOfConfiguration = managedOnBehalfOfConfiguration; + DataConnectorCredentials = dataConnectorCredentials; + InstalledSolutions = installedSolutions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The status of the last operation. + public AgriculturePlatformProvisioningState? ProvisioningState { get; } + /// Config of the AgriService instance. + public AgricultureServiceConfig Config { get; set; } + /// Managed On Behalf Of Configuration. + internal ManagedOnBehalfOfConfiguration ManagedOnBehalfOfConfiguration { get; } + /// Associated MoboBrokerResources. + public IReadOnlyList ManagedOnBehalfOfMoboBrokerResources + { + get => ManagedOnBehalfOfConfiguration?.MoboBrokerResources; + } + + /// Data connector credentials of AgriService instance. + public IList DataConnectorCredentials { get; } + /// AgriService installed solutions. + public IList InstalledSolutions { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureSolution.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureSolution.Serialization.cs new file mode 100644 index 000000000000..9d553cf85b8d --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureSolution.Serialization.cs @@ -0,0 +1,191 @@ +// 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.AgriculturePlatform.Models +{ + public partial class AgricultureSolution : 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(AgricultureSolution)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ApplicationName)) + { + writer.WritePropertyName("applicationName"u8); + writer.WriteStringValue(ApplicationName); + } + if (Optional.IsDefined(PartnerId)) + { + writer.WritePropertyName("partnerId"u8); + writer.WriteStringValue(PartnerId); + } + if (Optional.IsDefined(MarketPlacePublisherId)) + { + writer.WritePropertyName("marketPlacePublisherId"u8); + writer.WriteStringValue(MarketPlacePublisherId); + } + if (Optional.IsDefined(SaasSubscriptionId)) + { + writer.WritePropertyName("saasSubscriptionId"u8); + writer.WriteStringValue(SaasSubscriptionId); + } + if (Optional.IsDefined(SaasSubscriptionName)) + { + writer.WritePropertyName("saasSubscriptionName"u8); + writer.WriteStringValue(SaasSubscriptionName); + } + if (Optional.IsDefined(PlanId)) + { + writer.WritePropertyName("planId"u8); + writer.WriteStringValue(PlanId); + } + 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 + } + } + } + + AgricultureSolution 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(AgricultureSolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAgricultureSolution(document.RootElement, options); + } + + internal static AgricultureSolution DeserializeAgricultureSolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string applicationName = default; + string partnerId = default; + string marketPlacePublisherId = default; + string saasSubscriptionId = default; + string saasSubscriptionName = default; + string planId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("applicationName"u8)) + { + applicationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("partnerId"u8)) + { + partnerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("marketPlacePublisherId"u8)) + { + marketPlacePublisherId = property.Value.GetString(); + continue; + } + if (property.NameEquals("saasSubscriptionId"u8)) + { + saasSubscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("saasSubscriptionName"u8)) + { + saasSubscriptionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("planId"u8)) + { + planId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AgricultureSolution( + applicationName, + partnerId, + marketPlacePublisherId, + saasSubscriptionId, + saasSubscriptionName, + planId, + 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(AgricultureSolution)} does not support writing '{options.Format}' format."); + } + } + + AgricultureSolution 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 DeserializeAgricultureSolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AgricultureSolution)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureSolution.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureSolution.cs new file mode 100644 index 000000000000..5b3ea3ca01c6 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AgricultureSolution.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Installed data manager for Agriculture solution detail. + public partial class AgricultureSolution + { + /// + /// 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 AgricultureSolution() + { + } + + /// Initializes a new instance of . + /// Application name of the solution. + /// Partner Id. + /// Marketplace publisher Id. + /// Saas subscription Id. + /// Saas subscription name. + /// Plan Id. + /// Keeps track of any properties unknown to the library. + internal AgricultureSolution(string applicationName, string partnerId, string marketPlacePublisherId, string saasSubscriptionId, string saasSubscriptionName, string planId, IDictionary serializedAdditionalRawData) + { + ApplicationName = applicationName; + PartnerId = partnerId; + MarketPlacePublisherId = marketPlacePublisherId; + SaasSubscriptionId = saasSubscriptionId; + SaasSubscriptionName = saasSubscriptionName; + PlanId = planId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Application name of the solution. + public string ApplicationName { get; set; } + /// Partner Id. + public string PartnerId { get; set; } + /// Marketplace publisher Id. + public string MarketPlacePublisherId { get; set; } + /// Saas subscription Id. + public string SaasSubscriptionId { get; set; } + /// Saas subscription name. + public string SaasSubscriptionName { get; set; } + /// Plan Id. + public string PlanId { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AuthCredentialsKind.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AuthCredentialsKind.cs new file mode 100644 index 000000000000..b7984bad0c37 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AuthCredentialsKind.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.AgriculturePlatform.Models +{ + /// Types of different kind of Data connector auth credentials supported. + public readonly partial struct AuthCredentialsKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuthCredentialsKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OAuthClientCredentialsValue = "OAuthClientCredentials"; + private const string ApiKeyAuthCredentialsValue = "ApiKeyAuthCredentials"; + + /// OAuth Client Credential type. + public static AuthCredentialsKind OAuthClientCredentials { get; } = new AuthCredentialsKind(OAuthClientCredentialsValue); + /// API Key Auth Credential type. + public static AuthCredentialsKind ApiKeyAuthCredentials { get; } = new AuthCredentialsKind(ApiKeyAuthCredentialsValue); + /// Determines if two values are the same. + public static bool operator ==(AuthCredentialsKind left, AuthCredentialsKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuthCredentialsKind left, AuthCredentialsKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AuthCredentialsKind(string value) => new AuthCredentialsKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuthCredentialsKind other && Equals(other); + /// + public bool Equals(AuthCredentialsKind 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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.Serialization.cs new file mode 100644 index 000000000000..48d2fc9bc9ce --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.Serialization.cs @@ -0,0 +1,136 @@ +// 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.AgriculturePlatform.Models +{ + public partial class AvailableAgriSolutionListResult : 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(AvailableAgriSolutionListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("solutions"u8); + writer.WriteStartArray(); + foreach (var item in Solutions) + { + 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 + } + } + } + + AvailableAgriSolutionListResult 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(AvailableAgriSolutionListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAvailableAgriSolutionListResult(document.RootElement, options); + } + + internal static AvailableAgriSolutionListResult DeserializeAvailableAgriSolutionListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList solutions = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("solutions"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DataManagerForAgricultureSolution.DeserializeDataManagerForAgricultureSolution(item, options)); + } + solutions = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AvailableAgriSolutionListResult(solutions, 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(AvailableAgriSolutionListResult)} does not support writing '{options.Format}' format."); + } + } + + AvailableAgriSolutionListResult 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 DeserializeAvailableAgriSolutionListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AvailableAgriSolutionListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.cs new file mode 100644 index 000000000000..1952a13cd701 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/AvailableAgriSolutionListResult.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The list of available agri solutions. + public partial class AvailableAgriSolutionListResult + { + /// + /// 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 . + /// Agri solutions list. + /// is null. + internal AvailableAgriSolutionListResult(IEnumerable solutions) + { + Argument.AssertNotNull(solutions, nameof(solutions)); + + Solutions = solutions.ToList(); + } + + /// Initializes a new instance of . + /// Agri solutions list. + /// Keeps track of any properties unknown to the library. + internal AvailableAgriSolutionListResult(IReadOnlyList solutions, IDictionary serializedAdditionalRawData) + { + Solutions = solutions; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AvailableAgriSolutionListResult() + { + } + + /// Agri solutions list. + public IReadOnlyList Solutions { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.Serialization.cs new file mode 100644 index 000000000000..82fc488a1674 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.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.AgriculturePlatform.Models +{ + public partial class DataConnectorCredentialMap : 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(DataConnectorCredentialMap)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("value"u8); + writer.WriteObjectValue(Value, 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 + } + } + } + + DataConnectorCredentialMap 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(DataConnectorCredentialMap)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataConnectorCredentialMap(document.RootElement, options); + } + + internal static DataConnectorCredentialMap DeserializeDataConnectorCredentialMap(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + DataConnectorCredentials value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = DataConnectorCredentials.DeserializeDataConnectorCredentials(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataConnectorCredentialMap(key, value, 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(DataConnectorCredentialMap)} does not support writing '{options.Format}' format."); + } + } + + DataConnectorCredentialMap 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 DeserializeDataConnectorCredentialMap(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataConnectorCredentialMap)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.cs new file mode 100644 index 000000000000..7ae5b121f387 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentialMap.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.AgriculturePlatform.Models +{ + /// Mapping of data connector credentials. + public partial class DataConnectorCredentialMap + { + /// + /// 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 key representing the credential. + /// The data connector credential value. + /// or is null. + public DataConnectorCredentialMap(string key, DataConnectorCredentials value) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + Key = key; + Value = value; + } + + /// Initializes a new instance of . + /// The key representing the credential. + /// The data connector credential value. + /// Keeps track of any properties unknown to the library. + internal DataConnectorCredentialMap(string key, DataConnectorCredentials value, IDictionary serializedAdditionalRawData) + { + Key = key; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataConnectorCredentialMap() + { + } + + /// The key representing the credential. + public string Key { get; set; } + /// The data connector credential value. + public DataConnectorCredentials Value { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.Serialization.cs new file mode 100644 index 000000000000..6260b2b8af26 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.Serialization.cs @@ -0,0 +1,183 @@ +// 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.AgriculturePlatform.Models +{ + public partial class DataConnectorCredentials : 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(DataConnectorCredentials)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsDefined(ClientId)) + { + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + } + if (Optional.IsDefined(KeyVaultUri)) + { + writer.WritePropertyName("keyVaultUri"u8); + writer.WriteStringValue(KeyVaultUri); + } + if (Optional.IsDefined(KeyName)) + { + writer.WritePropertyName("keyName"u8); + writer.WriteStringValue(KeyName); + } + if (Optional.IsDefined(KeyVersion)) + { + writer.WritePropertyName("keyVersion"u8); + writer.WriteStringValue(KeyVersion); + } + 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 + } + } + } + + DataConnectorCredentials 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(DataConnectorCredentials)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataConnectorCredentials(document.RootElement, options); + } + + internal static DataConnectorCredentials DeserializeDataConnectorCredentials(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AuthCredentialsKind? kind = default; + string clientId = default; + string keyVaultUri = default; + string keyName = default; + string keyVersion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new AuthCredentialsKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("clientId"u8)) + { + clientId = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyVaultUri"u8)) + { + keyVaultUri = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyName"u8)) + { + keyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("keyVersion"u8)) + { + keyVersion = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataConnectorCredentials( + kind, + clientId, + keyVaultUri, + keyName, + keyVersion, + 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(DataConnectorCredentials)} does not support writing '{options.Format}' format."); + } + } + + DataConnectorCredentials 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 DeserializeDataConnectorCredentials(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataConnectorCredentials)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.cs new file mode 100644 index 000000000000..7ec398320298 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataConnectorCredentials.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// The properties related to an AgriService data connector. + public partial class DataConnectorCredentials + { + /// + /// 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 DataConnectorCredentials() + { + } + + /// Initializes a new instance of . + /// Type of credential. + /// Client Id associated with the provider, if type of credentials is OAuthClientCredentials. + /// Uri of the key vault. + /// Name of the key vault key. + /// Version of the key vault key. + /// Keeps track of any properties unknown to the library. + internal DataConnectorCredentials(AuthCredentialsKind? kind, string clientId, string keyVaultUri, string keyName, string keyVersion, IDictionary serializedAdditionalRawData) + { + Kind = kind; + ClientId = clientId; + KeyVaultUri = keyVaultUri; + KeyName = keyName; + KeyVersion = keyVersion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Type of credential. + public AuthCredentialsKind? Kind { get; set; } + /// Client Id associated with the provider, if type of credentials is OAuthClientCredentials. + public string ClientId { get; set; } + /// Uri of the key vault. + public string KeyVaultUri { get; set; } + /// Name of the key vault key. + public string KeyName { get; set; } + /// Version of the key vault key. + public string KeyVersion { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.Serialization.cs new file mode 100644 index 000000000000..50a693e4f7d6 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.Serialization.cs @@ -0,0 +1,210 @@ +// 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.AgriculturePlatform.Models +{ + public partial class DataManagerForAgricultureSolution : 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(DataManagerForAgricultureSolution)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("partnerId"u8); + writer.WriteStringValue(PartnerId); + writer.WritePropertyName("solutionId"u8); + writer.WriteStringValue(SolutionId); + writer.WritePropertyName("partnerTenantId"u8); + writer.WriteStringValue(PartnerTenantId); + writer.WritePropertyName("dataAccessScopes"u8); + writer.WriteStartArray(); + foreach (var item in DataAccessScopes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("marketPlaceOfferDetails"u8); + writer.WriteObjectValue(MarketPlaceOfferDetails, options); + writer.WritePropertyName("saasApplicationId"u8); + writer.WriteStringValue(SaasApplicationId); + writer.WritePropertyName("accessAzureDataManagerForAgricultureApplicationId"u8); + writer.WriteStringValue(AccessAzureDataManagerForAgricultureApplicationId); + writer.WritePropertyName("accessAzureDataManagerForAgricultureApplicationName"u8); + writer.WriteStringValue(AccessAzureDataManagerForAgricultureApplicationName); + writer.WritePropertyName("isValidateInput"u8); + writer.WriteBooleanValue(IsValidateInput); + 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 + } + } + } + + DataManagerForAgricultureSolution 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(DataManagerForAgricultureSolution)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDataManagerForAgricultureSolution(document.RootElement, options); + } + + internal static DataManagerForAgricultureSolution DeserializeDataManagerForAgricultureSolution(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string partnerId = default; + string solutionId = default; + string partnerTenantId = default; + IReadOnlyList dataAccessScopes = default; + MarketPlaceOfferDetails marketPlaceOfferDetails = default; + string saasApplicationId = default; + string accessAzureDataManagerForAgricultureApplicationId = default; + string accessAzureDataManagerForAgricultureApplicationName = default; + bool isValidateInput = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("partnerId"u8)) + { + partnerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("solutionId"u8)) + { + solutionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("partnerTenantId"u8)) + { + partnerTenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("dataAccessScopes"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dataAccessScopes = array; + continue; + } + if (property.NameEquals("marketPlaceOfferDetails"u8)) + { + marketPlaceOfferDetails = MarketPlaceOfferDetails.DeserializeMarketPlaceOfferDetails(property.Value, options); + continue; + } + if (property.NameEquals("saasApplicationId"u8)) + { + saasApplicationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("accessAzureDataManagerForAgricultureApplicationId"u8)) + { + accessAzureDataManagerForAgricultureApplicationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("accessAzureDataManagerForAgricultureApplicationName"u8)) + { + accessAzureDataManagerForAgricultureApplicationName = property.Value.GetString(); + continue; + } + if (property.NameEquals("isValidateInput"u8)) + { + isValidateInput = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DataManagerForAgricultureSolution( + partnerId, + solutionId, + partnerTenantId, + dataAccessScopes, + marketPlaceOfferDetails, + saasApplicationId, + accessAzureDataManagerForAgricultureApplicationId, + accessAzureDataManagerForAgricultureApplicationName, + isValidateInput, + 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(DataManagerForAgricultureSolution)} does not support writing '{options.Format}' format."); + } + } + + DataManagerForAgricultureSolution 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 DeserializeDataManagerForAgricultureSolution(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DataManagerForAgricultureSolution)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.cs new file mode 100644 index 000000000000..ee2b9d521dcf --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/DataManagerForAgricultureSolution.cs @@ -0,0 +1,131 @@ +// 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.AgriculturePlatform.Models +{ + /// Data Manager for Agriculture solution. + public partial class DataManagerForAgricultureSolution + { + /// + /// 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 . + /// Partner Id. + /// Solution Id. + /// Partner tenant Id. + /// Data access scopes. + /// Marketplace offer details. + /// Saas application Id. + /// Entra application Id used to access azure data manager for agriculture instance. + /// Entra application name used to access azure data manager for agriculture instance. + /// Whether solution inference will validate input. + /// , , , , , , or is null. + internal DataManagerForAgricultureSolution(string partnerId, string solutionId, string partnerTenantId, IEnumerable dataAccessScopes, MarketPlaceOfferDetails marketPlaceOfferDetails, string saasApplicationId, string accessAzureDataManagerForAgricultureApplicationId, string accessAzureDataManagerForAgricultureApplicationName, bool isValidateInput) + { + Argument.AssertNotNull(partnerId, nameof(partnerId)); + Argument.AssertNotNull(solutionId, nameof(solutionId)); + Argument.AssertNotNull(partnerTenantId, nameof(partnerTenantId)); + Argument.AssertNotNull(dataAccessScopes, nameof(dataAccessScopes)); + Argument.AssertNotNull(marketPlaceOfferDetails, nameof(marketPlaceOfferDetails)); + Argument.AssertNotNull(saasApplicationId, nameof(saasApplicationId)); + Argument.AssertNotNull(accessAzureDataManagerForAgricultureApplicationId, nameof(accessAzureDataManagerForAgricultureApplicationId)); + Argument.AssertNotNull(accessAzureDataManagerForAgricultureApplicationName, nameof(accessAzureDataManagerForAgricultureApplicationName)); + + PartnerId = partnerId; + SolutionId = solutionId; + PartnerTenantId = partnerTenantId; + DataAccessScopes = dataAccessScopes.ToList(); + MarketPlaceOfferDetails = marketPlaceOfferDetails; + SaasApplicationId = saasApplicationId; + AccessAzureDataManagerForAgricultureApplicationId = accessAzureDataManagerForAgricultureApplicationId; + AccessAzureDataManagerForAgricultureApplicationName = accessAzureDataManagerForAgricultureApplicationName; + IsValidateInput = isValidateInput; + } + + /// Initializes a new instance of . + /// Partner Id. + /// Solution Id. + /// Partner tenant Id. + /// Data access scopes. + /// Marketplace offer details. + /// Saas application Id. + /// Entra application Id used to access azure data manager for agriculture instance. + /// Entra application name used to access azure data manager for agriculture instance. + /// Whether solution inference will validate input. + /// Keeps track of any properties unknown to the library. + internal DataManagerForAgricultureSolution(string partnerId, string solutionId, string partnerTenantId, IReadOnlyList dataAccessScopes, MarketPlaceOfferDetails marketPlaceOfferDetails, string saasApplicationId, string accessAzureDataManagerForAgricultureApplicationId, string accessAzureDataManagerForAgricultureApplicationName, bool isValidateInput, IDictionary serializedAdditionalRawData) + { + PartnerId = partnerId; + SolutionId = solutionId; + PartnerTenantId = partnerTenantId; + DataAccessScopes = dataAccessScopes; + MarketPlaceOfferDetails = marketPlaceOfferDetails; + SaasApplicationId = saasApplicationId; + AccessAzureDataManagerForAgricultureApplicationId = accessAzureDataManagerForAgricultureApplicationId; + AccessAzureDataManagerForAgricultureApplicationName = accessAzureDataManagerForAgricultureApplicationName; + IsValidateInput = isValidateInput; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DataManagerForAgricultureSolution() + { + } + + /// Partner Id. + public string PartnerId { get; } + /// Solution Id. + public string SolutionId { get; } + /// Partner tenant Id. + public string PartnerTenantId { get; } + /// Data access scopes. + public IReadOnlyList DataAccessScopes { get; } + /// Marketplace offer details. + public MarketPlaceOfferDetails MarketPlaceOfferDetails { get; } + /// Saas application Id. + public string SaasApplicationId { get; } + /// Entra application Id used to access azure data manager for agriculture instance. + public string AccessAzureDataManagerForAgricultureApplicationId { get; } + /// Entra application name used to access azure data manager for agriculture instance. + public string AccessAzureDataManagerForAgricultureApplicationName { get; } + /// Whether solution inference will validate input. + public bool IsValidateInput { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.Serialization.cs new file mode 100644 index 000000000000..029b63623a04 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.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.AgriculturePlatform.Models +{ + public partial class InstalledSolutionMap : 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(InstalledSolutionMap)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("value"u8); + writer.WriteObjectValue(Value, 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 + } + } + } + + InstalledSolutionMap 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(InstalledSolutionMap)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInstalledSolutionMap(document.RootElement, options); + } + + internal static InstalledSolutionMap DeserializeInstalledSolutionMap(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string key = default; + AgricultureSolution value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = AgricultureSolution.DeserializeAgricultureSolution(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InstalledSolutionMap(key, value, 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(InstalledSolutionMap)} does not support writing '{options.Format}' format."); + } + } + + InstalledSolutionMap 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 DeserializeInstalledSolutionMap(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InstalledSolutionMap)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.cs new file mode 100644 index 000000000000..c6974bf9696b --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/InstalledSolutionMap.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.AgriculturePlatform.Models +{ + /// Mapping of installed solutions. + public partial class InstalledSolutionMap + { + /// + /// 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 key representing the installed solution. + /// The installed solution value. + /// or is null. + public InstalledSolutionMap(string key, AgricultureSolution value) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + Key = key; + Value = value; + } + + /// Initializes a new instance of . + /// The key representing the installed solution. + /// The installed solution value. + /// Keeps track of any properties unknown to the library. + internal InstalledSolutionMap(string key, AgricultureSolution value, IDictionary serializedAdditionalRawData) + { + Key = key; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InstalledSolutionMap() + { + } + + /// The key representing the installed solution. + public string Key { get; set; } + /// The installed solution value. + public AgricultureSolution Value { get; set; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.Serialization.cs new file mode 100644 index 000000000000..ad5635b8a30b --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.Serialization.cs @@ -0,0 +1,140 @@ +// 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.Resources.Models; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + internal partial class ManagedOnBehalfOfConfiguration : 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(ManagedOnBehalfOfConfiguration)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("moboBrokerResources"u8); + writer.WriteStartArray(); + foreach (var item in MoboBrokerResources) + { + JsonSerializer.Serialize(writer, item); + } + 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 + } + } + } + + ManagedOnBehalfOfConfiguration 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(ManagedOnBehalfOfConfiguration)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeManagedOnBehalfOfConfiguration(document.RootElement, options); + } + + internal static ManagedOnBehalfOfConfiguration DeserializeManagedOnBehalfOfConfiguration(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList moboBrokerResources = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("moboBrokerResources"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(JsonSerializer.Deserialize(item.GetRawText())); + } + moboBrokerResources = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ManagedOnBehalfOfConfiguration(moboBrokerResources, 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(ManagedOnBehalfOfConfiguration)} does not support writing '{options.Format}' format."); + } + } + + ManagedOnBehalfOfConfiguration 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 DeserializeManagedOnBehalfOfConfiguration(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ManagedOnBehalfOfConfiguration)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.cs new file mode 100644 index 000000000000..bae2f95bef45 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/ManagedOnBehalfOfConfiguration.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.AgriculturePlatform.Models +{ + /// Configuration of the managed on behalf of resource. + internal partial class ManagedOnBehalfOfConfiguration + { + /// + /// 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 . + /// Associated MoboBrokerResources. + internal ManagedOnBehalfOfConfiguration(IEnumerable moboBrokerResources) + { + MoboBrokerResources = moboBrokerResources.ToList(); + } + + /// Initializes a new instance of . + /// Associated MoboBrokerResources. + /// Keeps track of any properties unknown to the library. + internal ManagedOnBehalfOfConfiguration(IReadOnlyList moboBrokerResources, IDictionary serializedAdditionalRawData) + { + MoboBrokerResources = moboBrokerResources; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ManagedOnBehalfOfConfiguration() + { + } + + /// Associated MoboBrokerResources. + public IReadOnlyList MoboBrokerResources { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.Serialization.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.Serialization.cs new file mode 100644 index 000000000000..ac4928c7372a --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.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.AgriculturePlatform.Models +{ + public partial class MarketPlaceOfferDetails : 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(MarketPlaceOfferDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("saasOfferId"u8); + writer.WriteStringValue(SaasOfferId); + writer.WritePropertyName("publisherId"u8); + writer.WriteStringValue(PublisherId); + 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 + } + } + } + + MarketPlaceOfferDetails 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(MarketPlaceOfferDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMarketPlaceOfferDetails(document.RootElement, options); + } + + internal static MarketPlaceOfferDetails DeserializeMarketPlaceOfferDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string saasOfferId = default; + string publisherId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("saasOfferId"u8)) + { + saasOfferId = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherId"u8)) + { + publisherId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MarketPlaceOfferDetails(saasOfferId, publisherId, 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(MarketPlaceOfferDetails)} does not support writing '{options.Format}' format."); + } + } + + MarketPlaceOfferDetails 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 DeserializeMarketPlaceOfferDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MarketPlaceOfferDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.cs new file mode 100644 index 000000000000..73a83366055e --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/Models/MarketPlaceOfferDetails.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.AgriculturePlatform.Models +{ + /// Marketplace offer details of Agri solution. + public partial class MarketPlaceOfferDetails + { + /// + /// 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 . + /// Saas offer Id. + /// Publisher Id. + /// or is null. + internal MarketPlaceOfferDetails(string saasOfferId, string publisherId) + { + Argument.AssertNotNull(saasOfferId, nameof(saasOfferId)); + Argument.AssertNotNull(publisherId, nameof(publisherId)); + + SaasOfferId = saasOfferId; + PublisherId = publisherId; + } + + /// Initializes a new instance of . + /// Saas offer Id. + /// Publisher Id. + /// Keeps track of any properties unknown to the library. + internal MarketPlaceOfferDetails(string saasOfferId, string publisherId, IDictionary serializedAdditionalRawData) + { + SaasOfferId = saasOfferId; + PublisherId = publisherId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MarketPlaceOfferDetails() + { + } + + /// Saas offer Id. + public string SaasOfferId { get; } + /// Publisher Id. + public string PublisherId { get; } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ProviderConstants.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..9fb5a17db4ac --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/RestOperations/AgriServiceRestOperations.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/RestOperations/AgriServiceRestOperations.cs new file mode 100644 index 000000000000..7f7b1ec7e648 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Generated/RestOperations/AgriServiceRestOperations.cs @@ -0,0 +1,817 @@ +// 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.AgriculturePlatform.Models; + +namespace Azure.ResourceManager.AgriculturePlatform +{ + internal partial class AgriServiceRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AgriServiceRestOperations. + /// 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 AgriServiceRestOperations(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-06-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a AgriServiceResource. + /// 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 AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AgricultureServiceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AgricultureServiceData.DeserializeAgricultureServiceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AgricultureServiceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a AgriServiceResource. + /// 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 AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AgricultureServiceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AgricultureServiceData.DeserializeAgricultureServiceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AgricultureServiceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string agriServiceResourceName, AgricultureServiceData 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string agriServiceResourceName, AgricultureServiceData 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a AgriServiceResource. + /// 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 AgriService resource. + /// 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 agriServiceResourceName, AgricultureServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, agriServiceResourceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a AgriServiceResource. + /// 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 AgriService resource. + /// 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 agriServiceResourceName, AgricultureServiceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, agriServiceResourceName, 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 agriServiceResourceName, AgricultureServicePatch 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string agriServiceResourceName, AgricultureServicePatch 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a AgriServiceResource. + /// 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 AgriService resource. + /// 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 agriServiceResourceName, AgricultureServicePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, agriServiceResourceName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a AgriServiceResource. + /// 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 AgriService resource. + /// 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 agriServiceResourceName, AgricultureServicePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, agriServiceResourceName, 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 agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a AgriServiceResource. + /// 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 AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a AgriServiceResource. + /// 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 AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + _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.AgriculturePlatform/agriServices", 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.AgriculturePlatform/agriServices", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List AgriServiceResource resources by 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: + { + AgriServiceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AgriServiceResource resources by 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: + { + AgriServiceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(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.AgriculturePlatform/agriServices", 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.AgriculturePlatform/agriServices", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List AgriServiceResource resources by subscription ID. + /// 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: + { + AgriServiceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AgriServiceResource resources by subscription ID. + /// 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: + { + AgriServiceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListAvailableSolutionsRequestUri(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + 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.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendPath("/listAvailableSolutions", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListAvailableSolutionsRequest(string subscriptionId, string resourceGroupName, string agriServiceResourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.AgriculturePlatform/agriServices/", false); + uri.AppendPath(agriServiceResourceName, true); + uri.AppendPath("/listAvailableSolutions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Returns the list of available agri solutions. + /// 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 AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAvailableSolutionsAsync(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateListAvailableSolutionsRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AvailableAgriSolutionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AvailableAgriSolutionListResult.DeserializeAvailableAgriSolutionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Returns the list of available agri solutions. + /// 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 AgriService resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListAvailableSolutions(string subscriptionId, string resourceGroupName, string agriServiceResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(agriServiceResourceName, nameof(agriServiceResourceName)); + + using var message = CreateListAvailableSolutionsRequest(subscriptionId, resourceGroupName, agriServiceResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AvailableAgriSolutionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AvailableAgriSolutionListResult.DeserializeAvailableAgriSolutionListResult(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; + } + + /// List AgriServiceResource resources by 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: + { + AgriServiceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AgriServiceResource resources by 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: + { + AgriServiceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(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; + } + + /// List AgriServiceResource resources by subscription ID. + /// 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: + { + AgriServiceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List AgriServiceResource resources by subscription ID. + /// 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: + { + AgriServiceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = AgriServiceResourceListResult.DeserializeAgriServiceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Properties/AssemblyInfo.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..04cdc3b4b17d --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/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.AgriculturePlatform.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("AgriculturePlatform")] diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestBase.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestBase.cs new file mode 100644 index 000000000000..dc2cbcb6ecaa --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestBase.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.AgriculturePlatform.Tests +{ + public class AgriculturePlatformManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected AgriculturePlatformManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected AgriculturePlatformManagementTestBase(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/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestEnvironment.cs b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestEnvironment.cs new file mode 100644 index 000000000000..c74db678b879 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/AgriculturePlatformManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.AgriculturePlatform.Tests +{ + public class AgriculturePlatformManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/Azure.ResourceManager.AgriculturePlatform.Tests.csproj b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/Azure.ResourceManager.AgriculturePlatform.Tests.csproj new file mode 100644 index 000000000000..b2f75d13a0cf --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tests/Azure.ResourceManager.AgriculturePlatform.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml new file mode 100644 index 000000000000..0eb63f30b5e9 --- /dev/null +++ b/sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/agricultureplatform/AgriculturePlatform.Management +commit: c86a5491d0beb79d62f60fb24059413209e62432 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/agricultureplatform/ci.mgmt.yml b/sdk/agricultureplatform/ci.mgmt.yml new file mode 100644 index 000000000000..3b4a49c9c108 --- /dev/null +++ b/sdk/agricultureplatform/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/agricultureplatform /ci.mgmt.yml + - sdk/agricultureplatform /Azure.ResourceManager.AgriculturePlatform / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: agricultureplatform + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.AgriculturePlatform + safeName: AzureResourceManagerAgriculturePlatform diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/Azure.ResourceManager.WeightsAndBiases.sln b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/Azure.ResourceManager.WeightsAndBiases.sln new file mode 100644 index 000000000000..1ba19ad0de91 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/Azure.ResourceManager.WeightsAndBiases.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.WeightsAndBiases.Samples", "samples\Azure.ResourceManager.WeightsAndBiases.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.WeightsAndBiases", "src\Azure.ResourceManager.WeightsAndBiases.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.WeightsAndBiases.Tests", "tests\Azure.ResourceManager.WeightsAndBiases.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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/CHANGELOG.md b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/CHANGELOG.md new file mode 100644 index 000000000000..8b33f0fedccc --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/Directory.Build.props b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/README.md b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/README.md new file mode 100644 index 000000000000..1e862721b95f --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure WeightsAndBiases 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 WeightsAndBiases management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.WeightsAndBiases --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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/api/Azure.ResourceManager.WeightsAndBiases.net8.0.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/api/Azure.ResourceManager.WeightsAndBiases.net8.0.cs new file mode 100644 index 000000000000..e58649ff855c --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/api/Azure.ResourceManager.WeightsAndBiases.net8.0.cs @@ -0,0 +1,292 @@ +namespace Azure.ResourceManager.WeightsAndBiases +{ + public partial class InstanceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected InstanceResource() { } + public virtual Azure.ResourceManager.WeightsAndBiases.InstanceResourceData 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 instancename) { 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.WeightsAndBiases.InstanceResourceData 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.WeightsAndBiases.InstanceResourceData 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.Response Update(Azure.ResourceManager.WeightsAndBiases.Models.InstanceResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.WeightsAndBiases.Models.InstanceResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class InstanceResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected InstanceResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string instancename, Azure.ResourceManager.WeightsAndBiases.InstanceResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string instancename, Azure.ResourceManager.WeightsAndBiases.InstanceResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string instancename, 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 instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string instancename, 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 InstanceResourceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InstanceResourceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.InstanceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.InstanceResourceData 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.WeightsAndBiases.InstanceResourceData 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 static partial class WeightsAndBiasesExtensions + { + public static Azure.ResourceManager.WeightsAndBiases.InstanceResource GetInstanceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetInstanceResource(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetInstanceResourceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.InstanceResourceCollection GetInstanceResources(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetInstanceResources(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetInstanceResourcesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.WeightsAndBiases.Mocking +{ + public partial class MockableWeightsAndBiasesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableWeightsAndBiasesArmClient() { } + public virtual Azure.ResourceManager.WeightsAndBiases.InstanceResource GetInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableWeightsAndBiasesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableWeightsAndBiasesResourceGroupResource() { } + public virtual Azure.Response GetInstanceResource(string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetInstanceResourceAsync(string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.WeightsAndBiases.InstanceResourceCollection GetInstanceResources() { throw null; } + } + public partial class MockableWeightsAndBiasesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableWeightsAndBiasesSubscriptionResource() { } + public virtual Azure.Pageable GetInstanceResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetInstanceResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + public static partial class ArmWeightsAndBiasesModelFactory + { + public static Azure.ResourceManager.WeightsAndBiases.Models.InstanceProperties InstanceProperties(Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceDetails marketplace = null, Azure.ResourceManager.WeightsAndBiases.Models.UserDetails user = null, Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState?), Azure.ResourceManager.WeightsAndBiases.Models.PartnerProperties partnerProperties = null, Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnPropertiesV2 singleSignOnProperties = null) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.InstanceResourceData InstanceResourceData(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.WeightsAndBiases.Models.InstanceProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceDetails MarketplaceDetails(string subscriptionId = null, Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus? subscriptionStatus = default(Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus?), Azure.ResourceManager.WeightsAndBiases.Models.OfferDetails offerDetails = null) { throw null; } + } + public partial class InstanceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InstanceProperties(Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceDetails marketplace, Azure.ResourceManager.WeightsAndBiases.Models.UserDetails user) { } + public Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceDetails Marketplace { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.PartnerProperties PartnerProperties { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnPropertiesV2 SingleSignOnProperties { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.UserDetails User { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.InstanceProperties 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.WeightsAndBiases.Models.InstanceProperties 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 InstanceResourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InstanceResourcePatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { 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.WeightsAndBiases.Models.InstanceResourcePatch 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.WeightsAndBiases.Models.InstanceResourcePatch 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 MarketplaceDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MarketplaceDetails(Azure.ResourceManager.WeightsAndBiases.Models.OfferDetails offerDetails) { } + public Azure.ResourceManager.WeightsAndBiases.Models.OfferDetails OfferDetails { get { throw null; } set { } } + public string SubscriptionId { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus? SubscriptionStatus { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceDetails 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.WeightsAndBiases.Models.MarketplaceDetails 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 MarketplaceSubscriptionStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MarketplaceSubscriptionStatus(string value) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus PendingFulfillmentStart { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus Subscribed { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus Suspended { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus Unsubscribed { get { throw null; } } + public bool Equals(Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus 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.WeightsAndBiases.Models.MarketplaceSubscriptionStatus left, Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus left, Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OfferDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OfferDetails(string publisherId, string offerId, string planId) { } + public string OfferId { get { throw null; } set { } } + public string PlanId { get { throw null; } set { } } + public string PlanName { get { throw null; } set { } } + public string PublisherId { get { throw null; } set { } } + public string TermId { get { throw null; } set { } } + public string TermUnit { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.OfferDetails 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.WeightsAndBiases.Models.OfferDetails 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 PartnerProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PartnerProperties(Azure.ResourceManager.WeightsAndBiases.Models.Region region, string subdomain) { } + public Azure.ResourceManager.WeightsAndBiases.Models.Region Region { get { throw null; } set { } } + public string Subdomain { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.PartnerProperties 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.WeightsAndBiases.Models.PartnerProperties 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 Region : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Region(string value) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Centralus { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Eastus { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Japaneast { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Koreacentral { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Westeurope { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Westus { get { throw null; } } + public bool Equals(Azure.ResourceManager.WeightsAndBiases.Models.Region 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.WeightsAndBiases.Models.Region left, Azure.ResourceManager.WeightsAndBiases.Models.Region right) { throw null; } + public static implicit operator Azure.ResourceManager.WeightsAndBiases.Models.Region (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.WeightsAndBiases.Models.Region left, Azure.ResourceManager.WeightsAndBiases.Models.Region right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState left, Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState left, Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SingleSignOnPropertiesV2 : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SingleSignOnPropertiesV2(Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType type) { } + public System.Collections.Generic.IList AadDomains { get { throw null; } } + public string EnterpriseAppId { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState? State { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType Type { get { throw null; } set { } } + public string Uri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnPropertiesV2 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.WeightsAndBiases.Models.SingleSignOnPropertiesV2 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 SingleSignOnState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SingleSignOnState(string value) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState Disable { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState Enable { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState Initial { get { throw null; } } + public bool Equals(Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState 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.WeightsAndBiases.Models.SingleSignOnState left, Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState right) { throw null; } + public static implicit operator Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState left, Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SingleSignOnType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SingleSignOnType(string value) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType OpenId { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType Saml { get { throw null; } } + public bool Equals(Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType 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.WeightsAndBiases.Models.SingleSignOnType left, Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType right) { throw null; } + public static implicit operator Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType left, Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class UserDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public UserDetails() { } + public string EmailAddress { get { throw null; } set { } } + public string FirstName { get { throw null; } set { } } + public string LastName { get { throw null; } set { } } + public string PhoneNumber { get { throw null; } set { } } + public string Upn { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.UserDetails 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.WeightsAndBiases.Models.UserDetails 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/api/Azure.ResourceManager.WeightsAndBiases.netstandard2.0.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/api/Azure.ResourceManager.WeightsAndBiases.netstandard2.0.cs new file mode 100644 index 000000000000..e58649ff855c --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/api/Azure.ResourceManager.WeightsAndBiases.netstandard2.0.cs @@ -0,0 +1,292 @@ +namespace Azure.ResourceManager.WeightsAndBiases +{ + public partial class InstanceResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected InstanceResource() { } + public virtual Azure.ResourceManager.WeightsAndBiases.InstanceResourceData 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 instancename) { 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.WeightsAndBiases.InstanceResourceData 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.WeightsAndBiases.InstanceResourceData 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.Response Update(Azure.ResourceManager.WeightsAndBiases.Models.InstanceResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.WeightsAndBiases.Models.InstanceResourcePatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class InstanceResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected InstanceResourceCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string instancename, Azure.ResourceManager.WeightsAndBiases.InstanceResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string instancename, Azure.ResourceManager.WeightsAndBiases.InstanceResourceData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string instancename, 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 instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string instancename, 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 InstanceResourceData : Azure.ResourceManager.Models.TrackedResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InstanceResourceData(Azure.Core.AzureLocation location) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.InstanceProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.InstanceResourceData 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.WeightsAndBiases.InstanceResourceData 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 static partial class WeightsAndBiasesExtensions + { + public static Azure.ResourceManager.WeightsAndBiases.InstanceResource GetInstanceResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetInstanceResource(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetInstanceResourceAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.InstanceResourceCollection GetInstanceResources(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetInstanceResources(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetInstanceResourcesAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.WeightsAndBiases.Mocking +{ + public partial class MockableWeightsAndBiasesArmClient : Azure.ResourceManager.ArmResource + { + protected MockableWeightsAndBiasesArmClient() { } + public virtual Azure.ResourceManager.WeightsAndBiases.InstanceResource GetInstanceResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableWeightsAndBiasesResourceGroupResource : Azure.ResourceManager.ArmResource + { + protected MockableWeightsAndBiasesResourceGroupResource() { } + public virtual Azure.Response GetInstanceResource(string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetInstanceResourceAsync(string instancename, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.WeightsAndBiases.InstanceResourceCollection GetInstanceResources() { throw null; } + } + public partial class MockableWeightsAndBiasesSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableWeightsAndBiasesSubscriptionResource() { } + public virtual Azure.Pageable GetInstanceResources(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetInstanceResourcesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + public static partial class ArmWeightsAndBiasesModelFactory + { + public static Azure.ResourceManager.WeightsAndBiases.Models.InstanceProperties InstanceProperties(Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceDetails marketplace = null, Azure.ResourceManager.WeightsAndBiases.Models.UserDetails user = null, Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState? provisioningState = default(Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState?), Azure.ResourceManager.WeightsAndBiases.Models.PartnerProperties partnerProperties = null, Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnPropertiesV2 singleSignOnProperties = null) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.InstanceResourceData InstanceResourceData(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.WeightsAndBiases.Models.InstanceProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceDetails MarketplaceDetails(string subscriptionId = null, Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus? subscriptionStatus = default(Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus?), Azure.ResourceManager.WeightsAndBiases.Models.OfferDetails offerDetails = null) { throw null; } + } + public partial class InstanceProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InstanceProperties(Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceDetails marketplace, Azure.ResourceManager.WeightsAndBiases.Models.UserDetails user) { } + public Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceDetails Marketplace { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.PartnerProperties PartnerProperties { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnPropertiesV2 SingleSignOnProperties { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.UserDetails User { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.InstanceProperties 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.WeightsAndBiases.Models.InstanceProperties 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 InstanceResourcePatch : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InstanceResourcePatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { 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.WeightsAndBiases.Models.InstanceResourcePatch 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.WeightsAndBiases.Models.InstanceResourcePatch 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 MarketplaceDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public MarketplaceDetails(Azure.ResourceManager.WeightsAndBiases.Models.OfferDetails offerDetails) { } + public Azure.ResourceManager.WeightsAndBiases.Models.OfferDetails OfferDetails { get { throw null; } set { } } + public string SubscriptionId { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus? SubscriptionStatus { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceDetails 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.WeightsAndBiases.Models.MarketplaceDetails 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 MarketplaceSubscriptionStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MarketplaceSubscriptionStatus(string value) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus PendingFulfillmentStart { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus Subscribed { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus Suspended { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus Unsubscribed { get { throw null; } } + public bool Equals(Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus 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.WeightsAndBiases.Models.MarketplaceSubscriptionStatus left, Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus left, Azure.ResourceManager.WeightsAndBiases.Models.MarketplaceSubscriptionStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class OfferDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public OfferDetails(string publisherId, string offerId, string planId) { } + public string OfferId { get { throw null; } set { } } + public string PlanId { get { throw null; } set { } } + public string PlanName { get { throw null; } set { } } + public string PublisherId { get { throw null; } set { } } + public string TermId { get { throw null; } set { } } + public string TermUnit { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.OfferDetails 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.WeightsAndBiases.Models.OfferDetails 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 PartnerProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public PartnerProperties(Azure.ResourceManager.WeightsAndBiases.Models.Region region, string subdomain) { } + public Azure.ResourceManager.WeightsAndBiases.Models.Region Region { get { throw null; } set { } } + public string Subdomain { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.PartnerProperties 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.WeightsAndBiases.Models.PartnerProperties 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 Region : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Region(string value) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Centralus { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Eastus { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Japaneast { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Koreacentral { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Westeurope { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.Region Westus { get { throw null; } } + public bool Equals(Azure.ResourceManager.WeightsAndBiases.Models.Region 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.WeightsAndBiases.Models.Region left, Azure.ResourceManager.WeightsAndBiases.Models.Region right) { throw null; } + public static implicit operator Azure.ResourceManager.WeightsAndBiases.Models.Region (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.WeightsAndBiases.Models.Region left, Azure.ResourceManager.WeightsAndBiases.Models.Region right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ResourceProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ResourceProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState left, Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState left, Azure.ResourceManager.WeightsAndBiases.Models.ResourceProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SingleSignOnPropertiesV2 : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public SingleSignOnPropertiesV2(Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType type) { } + public System.Collections.Generic.IList AadDomains { get { throw null; } } + public string EnterpriseAppId { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState? State { get { throw null; } set { } } + public Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType Type { get { throw null; } set { } } + public string Uri { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnPropertiesV2 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.WeightsAndBiases.Models.SingleSignOnPropertiesV2 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 SingleSignOnState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SingleSignOnState(string value) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState Disable { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState Enable { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState Initial { get { throw null; } } + public bool Equals(Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState 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.WeightsAndBiases.Models.SingleSignOnState left, Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState right) { throw null; } + public static implicit operator Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState left, Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SingleSignOnType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SingleSignOnType(string value) { throw null; } + public static Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType OpenId { get { throw null; } } + public static Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType Saml { get { throw null; } } + public bool Equals(Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType 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.WeightsAndBiases.Models.SingleSignOnType left, Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType right) { throw null; } + public static implicit operator Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType left, Azure.ResourceManager.WeightsAndBiases.Models.SingleSignOnType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class UserDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public UserDetails() { } + public string EmailAddress { get { throw null; } set { } } + public string FirstName { get { throw null; } set { } } + public string LastName { get { throw null; } set { } } + public string PhoneNumber { get { throw null; } set { } } + public string Upn { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.WeightsAndBiases.Models.UserDetails 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.WeightsAndBiases.Models.UserDetails 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/assets.json b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/assets.json new file mode 100644 index 000000000000..dc44628d4d44 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/weightsandbiases/Azure.ResourceManager.WeightsAndBiases", + "Tag": "" +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Azure.ResourceManager.WeightsAndBiases.Samples.csproj b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Azure.ResourceManager.WeightsAndBiases.Samples.csproj new file mode 100644 index 000000000000..f2a9d463cc79 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Azure.ResourceManager.WeightsAndBiases.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Generated/Samples/Sample_InstanceResource.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Generated/Samples/Sample_InstanceResource.cs new file mode 100644 index 000000000000..a358f60e6731 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Generated/Samples/Sample_InstanceResource.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.WeightsAndBiases.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.WeightsAndBiases.Samples +{ + public partial class Sample_InstanceResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_InstancesGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + string resourceGroupName = "rgopenapi"; + string instancename = "myinstance"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancename); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // invoke the operation + InstanceResource result = await instanceResource.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 + InstanceResourceData 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_InstancesDeleteGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_Delete_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + string resourceGroupName = "rgopenapi"; + string instancename = "myinstance"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancename); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // invoke the operation + await instanceResource.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_InstancesUpdateGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_Update_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 InstanceResource created on azure + // for more information of creating InstanceResource, please refer to the document of InstanceResource + string subscriptionId = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + string resourceGroupName = "rgopenapi"; + string instancename = "myinstance"; + ResourceIdentifier instanceResourceId = InstanceResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, instancename); + InstanceResource instanceResource = client.GetInstanceResource(instanceResourceId); + + // invoke the operation + InstanceResourcePatch patch = new InstanceResourcePatch + { + Tags = { }, + Identity = new ManagedServiceIdentity("None") + { + UserAssignedIdentities = { }, + }, + }; + InstanceResource result = await instanceResource.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InstanceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Generated/Samples/Sample_InstanceResourceCollection.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Generated/Samples/Sample_InstanceResourceCollection.cs new file mode 100644 index 000000000000..2ab78fd02b7b --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Generated/Samples/Sample_InstanceResourceCollection.cs @@ -0,0 +1,262 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.WeightsAndBiases.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.WeightsAndBiases.Samples +{ + public partial class Sample_InstanceResourceCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_InstancesCreateOrUpdateGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_CreateOrUpdate_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation + string instancename = "myinstance"; + InstanceResourceData data = new InstanceResourceData(new AzureLocation("pudewmshbcvbt")) + { + Properties = new InstanceProperties(new MarketplaceDetails(new OfferDetails("kf", "rfgoevxeke", "ufopn") + { + PlanName = "adysakgqlryufffz", + TermUnit = "dgrkojow", + TermId = "kklscqq", + }) + { + SubscriptionId = "00000000-0000-0000-0000-000000000000", + }, new UserDetails + { + FirstName = "kiiehcojcldrlndoid", + LastName = "zhkvsfqvthwkfkvgxcruyud", + EmailAddress = "user@outlook.com", + Upn = "rmjpgqchpbw", + PhoneNumber = "cogmqmuwfcpstkwbzgkgo", + }) + { + PartnerProperties = new PartnerProperties(Region.Eastus, "xkecokwnwtkwnkxfgucmzybzzb"), + SingleSignOnProperties = new SingleSignOnPropertiesV2(SingleSignOnType.Saml) + { + State = SingleSignOnState.Initial, + EnterpriseAppId = "hkxtmpv", + Uri = "iqlemoksqdygqyxpp", + AadDomains = { "mxnw" }, + }, + }, + Identity = new ManagedServiceIdentity("None") + { + UserAssignedIdentities = { }, + }, + Tags = { }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, instancename, data); + InstanceResource 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 + InstanceResourceData 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_InstancesGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation + string instancename = "myinstance"; + InstanceResource result = await collection.GetAsync(instancename); + + // 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 + InstanceResourceData 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_InstancesListByResourceGroupGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_ListByResourceGroup_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation and iterate over the result + await foreach (InstanceResource 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 + InstanceResourceData 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 GetAll_InstancesListByResourceGroupGeneratedByMinimumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_ListByResourceGroup_MinimumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation and iterate over the result + await foreach (InstanceResource 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 + InstanceResourceData 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_InstancesGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation + string instancename = "myinstance"; + bool result = await collection.ExistsAsync(instancename); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_InstancesGetGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_Get_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + string resourceGroupName = "rgopenapi"; + ResourceIdentifier resourceGroupResourceId = ResourceGroupResource.CreateResourceIdentifier(subscriptionId, resourceGroupName); + ResourceGroupResource resourceGroupResource = client.GetResourceGroupResource(resourceGroupResourceId); + + // get the collection of this InstanceResource + InstanceResourceCollection collection = resourceGroupResource.GetInstanceResources(); + + // invoke the operation + string instancename = "myinstance"; + NullableResponse response = await collection.GetIfExistsAsync(instancename); + InstanceResource 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 + InstanceResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs new file mode 100644 index 000000000000..115add412c7f --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/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.WeightsAndBiases.Samples +{ + public partial class Sample_SubscriptionResourceExtensions + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetInstanceResources_InstancesListBySubscriptionGeneratedByMaximumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_ListBySubscription_MaximumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (InstanceResource item in subscriptionResource.GetInstanceResourcesAsync()) + { + // 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 + InstanceResourceData 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 GetInstanceResources_InstancesListBySubscriptionGeneratedByMinimumSetRule() + { + // Generated from example definition: 2024-09-18-preview/Instances_ListBySubscription_MinimumSet_Gen.json + // this example is just showing the usage of "InstanceResource_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 = "0BCB047F-CB71-4DFE-B0BD-88519F411C2F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (InstanceResource item in subscriptionResource.GetInstanceResourcesAsync()) + { + // 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 + InstanceResourceData 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Azure.ResourceManager.WeightsAndBiases.csproj b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Azure.ResourceManager.WeightsAndBiases.csproj new file mode 100644 index 000000000000..7f7fdadd602b --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Azure.ResourceManager.WeightsAndBiases.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider WeightsAndBiases. + 1.0.0-beta.1 + azure;management;arm;resource manager;weightsandbiases + Azure.ResourceManager.WeightsAndBiases + + diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/ArmWeightsAndBiasesModelFactory.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/ArmWeightsAndBiasesModelFactory.cs new file mode 100644 index 000000000000..76e879e72347 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/ArmWeightsAndBiasesModelFactory.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// Model factory for models. + public static partial class ArmWeightsAndBiasesModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The managed service identities assigned to this resource. + /// A new instance for mocking. + public static InstanceResourceData InstanceResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, InstanceProperties properties = null, ManagedServiceIdentity identity = null) + { + tags ??= new Dictionary(); + + return new InstanceResourceData( + id, + name, + resourceType, + systemData, + tags, + location, + properties, + identity, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Marketplace details of the resource. + /// Details of the user. + /// Provisioning state of the resource. + /// partner properties. + /// Single sign-on properties. + /// A new instance for mocking. + public static InstanceProperties InstanceProperties(MarketplaceDetails marketplace = null, UserDetails user = null, ResourceProvisioningState? provisioningState = null, PartnerProperties partnerProperties = null, SingleSignOnPropertiesV2 singleSignOnProperties = null) + { + return new InstanceProperties( + marketplace, + user, + provisioningState, + partnerProperties, + singleSignOnProperties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Azure subscription id for the the marketplace offer is purchased from. + /// Marketplace subscription status. + /// Offer details for the marketplace that is selected by the user. + /// A new instance for mocking. + public static MarketplaceDetails MarketplaceDetails(string subscriptionId = null, MarketplaceSubscriptionStatus? subscriptionStatus = null, OfferDetails offerDetails = null) + { + return new MarketplaceDetails(subscriptionId, subscriptionStatus, offerDetails, serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/MockableWeightsAndBiasesArmClient.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/MockableWeightsAndBiasesArmClient.cs new file mode 100644 index 000000000000..bbdbba3e50bf --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/MockableWeightsAndBiasesArmClient.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.WeightsAndBiases.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableWeightsAndBiasesArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableWeightsAndBiasesArmClient() + { + } + + /// 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 MockableWeightsAndBiasesArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableWeightsAndBiasesArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual InstanceResource GetInstanceResource(ResourceIdentifier id) + { + InstanceResource.ValidateResourceId(id); + return new InstanceResource(Client, id); + } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/MockableWeightsAndBiasesResourceGroupResource.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/MockableWeightsAndBiasesResourceGroupResource.cs new file mode 100644 index 000000000000..2d644afff03b --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/MockableWeightsAndBiasesResourceGroupResource.cs @@ -0,0 +1,105 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.WeightsAndBiases.Mocking +{ + /// A class to add extension methods to ResourceGroupResource. + public partial class MockableWeightsAndBiasesResourceGroupResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableWeightsAndBiasesResourceGroupResource() + { + } + + /// 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 MockableWeightsAndBiasesResourceGroupResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of InstanceResources in the ResourceGroupResource. + /// An object representing collection of InstanceResources and their operations over a InstanceResource. + public virtual InstanceResourceCollection GetInstanceResources() + { + return GetCachedClient(client => new InstanceResourceCollection(client, Id)); + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Instance resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetInstanceResourceAsync(string instancename, CancellationToken cancellationToken = default) + { + return await GetInstanceResources().GetAsync(instancename, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Instance resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetInstanceResource(string instancename, CancellationToken cancellationToken = default) + { + return GetInstanceResources().Get(instancename, cancellationToken); + } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/MockableWeightsAndBiasesSubscriptionResource.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/MockableWeightsAndBiasesSubscriptionResource.cs new file mode 100644 index 000000000000..976128ad34a8 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/MockableWeightsAndBiasesSubscriptionResource.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.WeightsAndBiases.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableWeightsAndBiasesSubscriptionResource : ArmResource + { + private ClientDiagnostics _instanceResourceInstancesClientDiagnostics; + private InstancesRestOperations _instanceResourceInstancesRestClient; + + /// Initializes a new instance of the class for mocking. + protected MockableWeightsAndBiasesSubscriptionResource() + { + } + + /// 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 MockableWeightsAndBiasesSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics InstanceResourceInstancesClientDiagnostics => _instanceResourceInstancesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.WeightsAndBiases", InstanceResource.ResourceType.Namespace, Diagnostics); + private InstancesRestOperations InstanceResourceInstancesRestClient => _instanceResourceInstancesRestClient ??= new InstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(InstanceResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List InstanceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.WeightsAndBiases/instances + /// + /// + /// Operation Id + /// InstanceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetInstanceResourcesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InstanceResourceInstancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstanceResourceInstancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InstanceResource(Client, InstanceResourceData.DeserializeInstanceResourceData(e)), InstanceResourceInstancesClientDiagnostics, Pipeline, "MockableWeightsAndBiasesSubscriptionResource.GetInstanceResources", "value", "nextLink", cancellationToken); + } + + /// + /// List InstanceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.WeightsAndBiases/instances + /// + /// + /// Operation Id + /// InstanceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetInstanceResources(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => InstanceResourceInstancesRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => InstanceResourceInstancesRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InstanceResource(Client, InstanceResourceData.DeserializeInstanceResourceData(e)), InstanceResourceInstancesClientDiagnostics, Pipeline, "MockableWeightsAndBiasesSubscriptionResource.GetInstanceResources", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/WeightsAndBiasesExtensions.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/WeightsAndBiasesExtensions.cs new file mode 100644 index 000000000000..bdd21f68b20b --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Extensions/WeightsAndBiasesExtensions.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.WeightsAndBiases.Mocking; + +namespace Azure.ResourceManager.WeightsAndBiases +{ + /// A class to add extension methods to Azure.ResourceManager.WeightsAndBiases. + public static partial class WeightsAndBiasesExtensions + { + private static MockableWeightsAndBiasesArmClient GetMockableWeightsAndBiasesArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableWeightsAndBiasesArmClient(client0)); + } + + private static MockableWeightsAndBiasesResourceGroupResource GetMockableWeightsAndBiasesResourceGroupResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableWeightsAndBiasesResourceGroupResource(client, resource.Id)); + } + + private static MockableWeightsAndBiasesSubscriptionResource GetMockableWeightsAndBiasesSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableWeightsAndBiasesSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static InstanceResource GetInstanceResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableWeightsAndBiasesArmClient(client).GetInstanceResource(id); + } + + /// + /// Gets a collection of InstanceResources 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 InstanceResources and their operations over a InstanceResource. + public static InstanceResourceCollection GetInstanceResources(this ResourceGroupResource resourceGroupResource) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableWeightsAndBiasesResourceGroupResource(resourceGroupResource).GetInstanceResources(); + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the Instance resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetInstanceResourceAsync(this ResourceGroupResource resourceGroupResource, string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return await GetMockableWeightsAndBiasesResourceGroupResource(resourceGroupResource).GetInstanceResourceAsync(instancename, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the Instance resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetInstanceResource(this ResourceGroupResource resourceGroupResource, string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceGroupResource, nameof(resourceGroupResource)); + + return GetMockableWeightsAndBiasesResourceGroupResource(resourceGroupResource).GetInstanceResource(instancename, cancellationToken); + } + + /// + /// List InstanceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.WeightsAndBiases/instances + /// + /// + /// Operation Id + /// InstanceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-18-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 GetInstanceResourcesAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableWeightsAndBiasesSubscriptionResource(subscriptionResource).GetInstanceResourcesAsync(cancellationToken); + } + + /// + /// List InstanceResource resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.WeightsAndBiases/instances + /// + /// + /// Operation Id + /// InstanceResource_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-09-18-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 GetInstanceResources(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableWeightsAndBiasesSubscriptionResource(subscriptionResource).GetInstanceResources(cancellationToken); + } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResource.Serialization.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResource.Serialization.cs new file mode 100644 index 000000000000..09e68a7b75c2 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResource.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.WeightsAndBiases +{ + public partial class InstanceResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + InstanceResourceData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + InstanceResourceData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResource.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResource.cs new file mode 100644 index 000000000000..648a38681a5a --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResource.cs @@ -0,0 +1,699 @@ +// 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.WeightsAndBiases.Models; + +namespace Azure.ResourceManager.WeightsAndBiases +{ + /// + /// A Class representing an InstanceResource along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetInstanceResource method. + /// Otherwise you can get one from its parent resource using the GetInstanceResource method. + /// + public partial class InstanceResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The instancename. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string instancename) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _instanceResourceInstancesClientDiagnostics; + private readonly InstancesRestOperations _instanceResourceInstancesRestClient; + private readonly InstanceResourceData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.WeightsAndBiases/instances"; + + /// Initializes a new instance of the class for mocking. + protected InstanceResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal InstanceResource(ArmClient client, InstanceResourceData 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 InstanceResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _instanceResourceInstancesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.WeightsAndBiases", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string instanceResourceInstancesApiVersion); + _instanceResourceInstancesRestClient = new InstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, instanceResourceInstancesApiVersion); +#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 InstanceResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.Get"); + scope.Start(); + try + { + var response = await _instanceResourceInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.Get"); + scope.Start(); + try + { + var response = _instanceResourceInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Delete + /// + /// + /// Default Api Version + /// 2024-09-18-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 = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.Delete"); + scope.Start(); + try + { + var response = await _instanceResourceInstancesRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new WeightsAndBiasesArmOperation(_instanceResourceInstancesClientDiagnostics, Pipeline, _instanceResourceInstancesRestClient.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; + } + } + + /// + /// Delete a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Delete + /// + /// + /// Default Api Version + /// 2024-09-18-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 = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.Delete"); + scope.Start(); + try + { + var response = _instanceResourceInstancesRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new WeightsAndBiasesArmOperation(_instanceResourceInstancesClientDiagnostics, Pipeline, _instanceResourceInstancesRestClient.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; + } + } + + /// + /// Update a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Update + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(InstanceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.Update"); + scope.Start(); + try + { + var response = await _instanceResourceInstancesRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Update + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(InstanceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.Update"); + scope.Start(); + try + { + var response = _instanceResourceInstancesRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-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 = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.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 _instanceResourceInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new InstanceResourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-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 = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.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 = _instanceResourceInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new InstanceResourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + 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.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-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 = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.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 _instanceResourceInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new InstanceResourcePatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + 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.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-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 = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.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 = _instanceResourceInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new InstanceResourcePatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-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 = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.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 _instanceResourceInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new InstanceResourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-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 = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResource.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 = _instanceResourceInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new InstanceResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new InstanceResourcePatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResourceCollection.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResourceCollection.cs new file mode 100644 index 000000000000..589ffce15188 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResourceCollection.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.WeightsAndBiases +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetInstanceResources method from an instance of . + /// + public partial class InstanceResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _instanceResourceInstancesClientDiagnostics; + private readonly InstancesRestOperations _instanceResourceInstancesRestClient; + + /// Initializes a new instance of the class for mocking. + protected InstanceResourceCollection() + { + } + + /// 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 InstanceResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _instanceResourceInstancesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.WeightsAndBiases", InstanceResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(InstanceResource.ResourceType, out string instanceResourceInstancesApiVersion); + _instanceResourceInstancesRestClient = new InstancesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, instanceResourceInstancesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-09-18-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. + /// Name of the Instance resource. + /// 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 instancename, InstanceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _instanceResourceInstancesRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, instancename, data, cancellationToken).ConfigureAwait(false); + var operation = new WeightsAndBiasesArmOperation(new InstanceResourceOperationSource(Client), _instanceResourceInstancesClientDiagnostics, Pipeline, _instanceResourceInstancesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, instancename, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-09-18-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. + /// Name of the Instance resource. + /// 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 instancename, InstanceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResourceCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _instanceResourceInstancesRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, instancename, data, cancellationToken); + var operation = new WeightsAndBiasesArmOperation(new InstanceResourceOperationSource(Client), _instanceResourceInstancesClientDiagnostics, Pipeline, _instanceResourceInstancesRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, instancename, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Instance resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResourceCollection.Get"); + scope.Start(); + try + { + var response = await _instanceResourceInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, instancename, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a InstanceResource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Instance resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResourceCollection.Get"); + scope.Start(); + try + { + var response = _instanceResourceInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, instancename, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List InstanceResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances + /// + /// + /// Operation Id + /// InstanceResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-09-18-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) => _instanceResourceInstancesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _instanceResourceInstancesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InstanceResource(Client, InstanceResourceData.DeserializeInstanceResourceData(e)), _instanceResourceInstancesClientDiagnostics, Pipeline, "InstanceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List InstanceResource resources by resource group + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances + /// + /// + /// Operation Id + /// InstanceResource_ListByResourceGroup + /// + /// + /// Default Api Version + /// 2024-09-18-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) => _instanceResourceInstancesRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _instanceResourceInstancesRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InstanceResource(Client, InstanceResourceData.DeserializeInstanceResourceData(e)), _instanceResourceInstancesClientDiagnostics, Pipeline, "InstanceResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Instance resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _instanceResourceInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, instancename, 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.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Instance resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResourceCollection.Exists"); + scope.Start(); + try + { + var response = _instanceResourceInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, instancename, 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.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Instance resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _instanceResourceInstancesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, instancename, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(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.WeightsAndBiases/instances/{instancename} + /// + /// + /// Operation Id + /// InstanceResource_Get + /// + /// + /// Default Api Version + /// 2024-09-18-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the Instance resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + + using var scope = _instanceResourceInstancesClientDiagnostics.CreateScope("InstanceResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _instanceResourceInstancesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, instancename, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InstanceResource(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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResourceData.Serialization.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResourceData.Serialization.cs new file mode 100644 index 000000000000..f096ac01bc2b --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResourceData.Serialization.cs @@ -0,0 +1,196 @@ +// 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.WeightsAndBiases.Models; + +namespace Azure.ResourceManager.WeightsAndBiases +{ + public partial class InstanceResourceData : 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(InstanceResourceData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + } + + InstanceResourceData 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(InstanceResourceData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceResourceData(document.RootElement, options); + } + + internal static InstanceResourceData DeserializeInstanceResourceData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InstanceProperties properties = default; + ManagedServiceIdentity identity = 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 = InstanceProperties.DeserializeInstanceProperties(property.Value, options); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("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 InstanceResourceData( + id, + name, + type, + systemData, + tags ?? new ChangeTrackingDictionary(), + location, + properties, + identity, + 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(InstanceResourceData)} does not support writing '{options.Format}' format."); + } + } + + InstanceResourceData 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 DeserializeInstanceResourceData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InstanceResourceData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResourceData.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResourceData.cs new file mode 100644 index 000000000000..4e8021707915 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/InstanceResourceData.cs @@ -0,0 +1,87 @@ +// 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.WeightsAndBiases.Models; + +namespace Azure.ResourceManager.WeightsAndBiases +{ + /// + /// A class representing the InstanceResource data model. + /// Concrete tracked resource types can be created by aliasing this type using a specific property type. + /// + public partial class InstanceResourceData : 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 InstanceResourceData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The resource-specific properties for this resource. + /// The managed service identities assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal InstanceResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, InstanceProperties properties, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData, tags, location) + { + Properties = properties; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InstanceResourceData() + { + } + + /// The resource-specific properties for this resource. + public InstanceProperties Properties { get; set; } + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/Argument.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/Argument.cs new file mode 100644 index 000000000000..ce835a8c9269 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/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.WeightsAndBiases +{ + 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 000000000000..8147dc8d1659 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/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.WeightsAndBiases +{ + 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/ChangeTrackingList.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 000000000000..29a87aebba3c --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/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.WeightsAndBiases +{ + 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 000000000000..ca1c0c0f6c7a --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/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.WeightsAndBiases +{ + 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/Optional.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/Optional.cs new file mode 100644 index 000000000000..2c2ad2707968 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/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.WeightsAndBiases +{ + 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 000000000000..56eb460d99a9 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/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.WeightsAndBiases +{ + 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/LongRunningOperation/InstanceResourceOperationSource.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/LongRunningOperation/InstanceResourceOperationSource.cs new file mode 100644 index 000000000000..087f4ecddabc --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/LongRunningOperation/InstanceResourceOperationSource.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.WeightsAndBiases +{ + internal class InstanceResourceOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal InstanceResourceOperationSource(ArmClient client) + { + _client = client; + } + + InstanceResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return new InstanceResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + var data = ModelReaderWriter.Read(response.Content); + return await Task.FromResult(new InstanceResource(_client, data)).ConfigureAwait(false); + } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/LongRunningOperation/WeightsAndBiasesArmOperation.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/LongRunningOperation/WeightsAndBiasesArmOperation.cs new file mode 100644 index 000000000000..f5e3693d5bbe --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/LongRunningOperation/WeightsAndBiasesArmOperation.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.WeightsAndBiases +{ +#pragma warning disable SA1649 // File name should match first type name + internal class WeightsAndBiasesArmOperation : 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 WeightsAndBiasesArmOperation for mocking. + protected WeightsAndBiasesArmOperation() + { + } + + internal WeightsAndBiasesArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal WeightsAndBiasesArmOperation(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, "WeightsAndBiasesArmOperation", 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/LongRunningOperation/WeightsAndBiasesArmOperationOfT.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/LongRunningOperation/WeightsAndBiasesArmOperationOfT.cs new file mode 100644 index 000000000000..e50d102f5766 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/LongRunningOperation/WeightsAndBiasesArmOperationOfT.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.WeightsAndBiases +{ +#pragma warning disable SA1649 // File name should match first type name + internal class WeightsAndBiasesArmOperation : 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 WeightsAndBiasesArmOperation for mocking. + protected WeightsAndBiasesArmOperation() + { + } + + internal WeightsAndBiasesArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal WeightsAndBiasesArmOperation(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, "WeightsAndBiasesArmOperation", 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceProperties.Serialization.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceProperties.Serialization.cs new file mode 100644 index 000000000000..b94ea44ad53c --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceProperties.Serialization.cs @@ -0,0 +1,185 @@ +// 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.WeightsAndBiases.Models +{ + public partial class InstanceProperties : 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(InstanceProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("marketplace"u8); + writer.WriteObjectValue(Marketplace, options); + writer.WritePropertyName("user"u8); + writer.WriteObjectValue(User, options); + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (Optional.IsDefined(PartnerProperties)) + { + writer.WritePropertyName("partnerProperties"u8); + writer.WriteObjectValue(PartnerProperties, options); + } + if (Optional.IsDefined(SingleSignOnProperties)) + { + writer.WritePropertyName("singleSignOnProperties"u8); + writer.WriteObjectValue(SingleSignOnProperties, 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 + } + } + } + + InstanceProperties 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(InstanceProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceProperties(document.RootElement, options); + } + + internal static InstanceProperties DeserializeInstanceProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MarketplaceDetails marketplace = default; + UserDetails user = default; + ResourceProvisioningState? provisioningState = default; + PartnerProperties partnerProperties = default; + SingleSignOnPropertiesV2 singleSignOnProperties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("marketplace"u8)) + { + marketplace = MarketplaceDetails.DeserializeMarketplaceDetails(property.Value, options); + continue; + } + if (property.NameEquals("user"u8)) + { + user = UserDetails.DeserializeUserDetails(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ResourceProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("partnerProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + partnerProperties = PartnerProperties.DeserializePartnerProperties(property.Value, options); + continue; + } + if (property.NameEquals("singleSignOnProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + singleSignOnProperties = SingleSignOnPropertiesV2.DeserializeSingleSignOnPropertiesV2(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InstanceProperties( + marketplace, + user, + provisioningState, + partnerProperties, + singleSignOnProperties, + 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(InstanceProperties)} does not support writing '{options.Format}' format."); + } + } + + InstanceProperties 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 DeserializeInstanceProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InstanceProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceProperties.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceProperties.cs new file mode 100644 index 000000000000..6bc215ebc6ef --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceProperties.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// Properties specific to Instance. + public partial class InstanceProperties + { + /// + /// 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 . + /// Marketplace details of the resource. + /// Details of the user. + /// or is null. + public InstanceProperties(MarketplaceDetails marketplace, UserDetails user) + { + Argument.AssertNotNull(marketplace, nameof(marketplace)); + Argument.AssertNotNull(user, nameof(user)); + + Marketplace = marketplace; + User = user; + } + + /// Initializes a new instance of . + /// Marketplace details of the resource. + /// Details of the user. + /// Provisioning state of the resource. + /// partner properties. + /// Single sign-on properties. + /// Keeps track of any properties unknown to the library. + internal InstanceProperties(MarketplaceDetails marketplace, UserDetails user, ResourceProvisioningState? provisioningState, PartnerProperties partnerProperties, SingleSignOnPropertiesV2 singleSignOnProperties, IDictionary serializedAdditionalRawData) + { + Marketplace = marketplace; + User = user; + ProvisioningState = provisioningState; + PartnerProperties = partnerProperties; + SingleSignOnProperties = singleSignOnProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InstanceProperties() + { + } + + /// Marketplace details of the resource. + public MarketplaceDetails Marketplace { get; set; } + /// Details of the user. + public UserDetails User { get; set; } + /// Provisioning state of the resource. + public ResourceProvisioningState? ProvisioningState { get; } + /// partner properties. + public PartnerProperties PartnerProperties { get; set; } + /// Single sign-on properties. + public SingleSignOnPropertiesV2 SingleSignOnProperties { get; set; } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourceListResult.Serialization.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourceListResult.Serialization.cs new file mode 100644 index 000000000000..0122d867af80 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourceListResult.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.WeightsAndBiases.Models +{ + internal partial class InstanceResourceListResult : 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(InstanceResourceListResult)} 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 + } + } + } + + InstanceResourceListResult 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(InstanceResourceListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceResourceListResult(document.RootElement, options); + } + + internal static InstanceResourceListResult DeserializeInstanceResourceListResult(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(InstanceResourceData.DeserializeInstanceResourceData(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 InstanceResourceListResult(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(InstanceResourceListResult)} does not support writing '{options.Format}' format."); + } + } + + InstanceResourceListResult 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 DeserializeInstanceResourceListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InstanceResourceListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourceListResult.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourceListResult.cs new file mode 100644 index 000000000000..9fe08e5e2821 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourceListResult.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.WeightsAndBiases.Models +{ + /// The response of a InstanceResource list operation. + internal partial class InstanceResourceListResult + { + /// + /// 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 InstanceResource items on this page. + /// is null. + internal InstanceResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The InstanceResource items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal InstanceResourceListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InstanceResourceListResult() + { + } + + /// The InstanceResource items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourcePatch.Serialization.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourcePatch.Serialization.cs new file mode 100644 index 000000000000..33cdd5abd54e --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourcePatch.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; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + public partial class InstanceResourcePatch : 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(InstanceResourcePatch)} 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(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + 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 + } + } + } + + InstanceResourcePatch 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(InstanceResourcePatch)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInstanceResourcePatch(document.RootElement, options); + } + + internal static InstanceResourcePatch DeserializeInstanceResourcePatch(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary tags = default; + ManagedServiceIdentity identity = 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("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InstanceResourcePatch(tags ?? new ChangeTrackingDictionary(), identity, 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(InstanceResourcePatch)} does not support writing '{options.Format}' format."); + } + } + + InstanceResourcePatch 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 DeserializeInstanceResourcePatch(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InstanceResourcePatch)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourcePatch.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourcePatch.cs new file mode 100644 index 000000000000..6b69b4d4875b --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/InstanceResourcePatch.cs @@ -0,0 +1,71 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// The type used for update operations of the Instance Resource. + public partial class InstanceResourcePatch + { + /// + /// 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 InstanceResourcePatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of . + /// Resource tags. + /// The managed service identities assigned to this resource. + /// Keeps track of any properties unknown to the library. + internal InstanceResourcePatch(IDictionary tags, ManagedServiceIdentity identity, IDictionary serializedAdditionalRawData) + { + Tags = tags; + Identity = identity; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Resource tags. + public IDictionary Tags { get; } + /// The managed service identities assigned to this resource. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/MarketplaceDetails.Serialization.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/MarketplaceDetails.Serialization.cs new file mode 100644 index 000000000000..5bbf99a04a40 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/MarketplaceDetails.Serialization.cs @@ -0,0 +1,152 @@ +// 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.WeightsAndBiases.Models +{ + public partial class MarketplaceDetails : 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(MarketplaceDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(SubscriptionId)) + { + writer.WritePropertyName("subscriptionId"u8); + writer.WriteStringValue(SubscriptionId); + } + if (options.Format != "W" && Optional.IsDefined(SubscriptionStatus)) + { + writer.WritePropertyName("subscriptionStatus"u8); + writer.WriteStringValue(SubscriptionStatus.Value.ToString()); + } + writer.WritePropertyName("offerDetails"u8); + writer.WriteObjectValue(OfferDetails, 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 + } + } + } + + MarketplaceDetails 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(MarketplaceDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeMarketplaceDetails(document.RootElement, options); + } + + internal static MarketplaceDetails DeserializeMarketplaceDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string subscriptionId = default; + MarketplaceSubscriptionStatus? subscriptionStatus = default; + OfferDetails offerDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("subscriptionId"u8)) + { + subscriptionId = property.Value.GetString(); + continue; + } + if (property.NameEquals("subscriptionStatus"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + subscriptionStatus = new MarketplaceSubscriptionStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("offerDetails"u8)) + { + offerDetails = OfferDetails.DeserializeOfferDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new MarketplaceDetails(subscriptionId, subscriptionStatus, offerDetails, 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(MarketplaceDetails)} does not support writing '{options.Format}' format."); + } + } + + MarketplaceDetails 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 DeserializeMarketplaceDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(MarketplaceDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/MarketplaceDetails.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/MarketplaceDetails.cs new file mode 100644 index 000000000000..40aa155fa865 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/MarketplaceDetails.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// Marketplace details for an organization. + public partial class MarketplaceDetails + { + /// + /// 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 . + /// Offer details for the marketplace that is selected by the user. + /// is null. + public MarketplaceDetails(OfferDetails offerDetails) + { + Argument.AssertNotNull(offerDetails, nameof(offerDetails)); + + OfferDetails = offerDetails; + } + + /// Initializes a new instance of . + /// Azure subscription id for the the marketplace offer is purchased from. + /// Marketplace subscription status. + /// Offer details for the marketplace that is selected by the user. + /// Keeps track of any properties unknown to the library. + internal MarketplaceDetails(string subscriptionId, MarketplaceSubscriptionStatus? subscriptionStatus, OfferDetails offerDetails, IDictionary serializedAdditionalRawData) + { + SubscriptionId = subscriptionId; + SubscriptionStatus = subscriptionStatus; + OfferDetails = offerDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal MarketplaceDetails() + { + } + + /// Azure subscription id for the the marketplace offer is purchased from. + public string SubscriptionId { get; set; } + /// Marketplace subscription status. + public MarketplaceSubscriptionStatus? SubscriptionStatus { get; } + /// Offer details for the marketplace that is selected by the user. + public OfferDetails OfferDetails { get; set; } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/MarketplaceSubscriptionStatus.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/MarketplaceSubscriptionStatus.cs new file mode 100644 index 000000000000..19feb62221eb --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/MarketplaceSubscriptionStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// Marketplace subscription status of a resource. + public readonly partial struct MarketplaceSubscriptionStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MarketplaceSubscriptionStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingFulfillmentStartValue = "PendingFulfillmentStart"; + private const string SubscribedValue = "Subscribed"; + private const string SuspendedValue = "Suspended"; + private const string UnsubscribedValue = "Unsubscribed"; + + /// Purchased but not yet activated. + public static MarketplaceSubscriptionStatus PendingFulfillmentStart { get; } = new MarketplaceSubscriptionStatus(PendingFulfillmentStartValue); + /// Marketplace subscription is activated. + public static MarketplaceSubscriptionStatus Subscribed { get; } = new MarketplaceSubscriptionStatus(SubscribedValue); + /// This state indicates that a customer's payment for the Marketplace service was not received. + public static MarketplaceSubscriptionStatus Suspended { get; } = new MarketplaceSubscriptionStatus(SuspendedValue); + /// Customer has cancelled the subscription. + public static MarketplaceSubscriptionStatus Unsubscribed { get; } = new MarketplaceSubscriptionStatus(UnsubscribedValue); + /// Determines if two values are the same. + public static bool operator ==(MarketplaceSubscriptionStatus left, MarketplaceSubscriptionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MarketplaceSubscriptionStatus left, MarketplaceSubscriptionStatus right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MarketplaceSubscriptionStatus(string value) => new MarketplaceSubscriptionStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MarketplaceSubscriptionStatus other && Equals(other); + /// + public bool Equals(MarketplaceSubscriptionStatus 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/OfferDetails.Serialization.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/OfferDetails.Serialization.cs new file mode 100644 index 000000000000..30e0ec2be832 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/OfferDetails.Serialization.cs @@ -0,0 +1,182 @@ +// 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.WeightsAndBiases.Models +{ + public partial class OfferDetails : 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(OfferDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("publisherId"u8); + writer.WriteStringValue(PublisherId); + writer.WritePropertyName("offerId"u8); + writer.WriteStringValue(OfferId); + writer.WritePropertyName("planId"u8); + writer.WriteStringValue(PlanId); + if (Optional.IsDefined(PlanName)) + { + writer.WritePropertyName("planName"u8); + writer.WriteStringValue(PlanName); + } + if (Optional.IsDefined(TermUnit)) + { + writer.WritePropertyName("termUnit"u8); + writer.WriteStringValue(TermUnit); + } + if (Optional.IsDefined(TermId)) + { + writer.WritePropertyName("termId"u8); + writer.WriteStringValue(TermId); + } + 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 + } + } + } + + OfferDetails 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(OfferDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeOfferDetails(document.RootElement, options); + } + + internal static OfferDetails DeserializeOfferDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string publisherId = default; + string offerId = default; + string planId = default; + string planName = default; + string termUnit = default; + string termId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("publisherId"u8)) + { + publisherId = property.Value.GetString(); + continue; + } + if (property.NameEquals("offerId"u8)) + { + offerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("planId"u8)) + { + planId = property.Value.GetString(); + continue; + } + if (property.NameEquals("planName"u8)) + { + planName = property.Value.GetString(); + continue; + } + if (property.NameEquals("termUnit"u8)) + { + termUnit = property.Value.GetString(); + continue; + } + if (property.NameEquals("termId"u8)) + { + termId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new OfferDetails( + publisherId, + offerId, + planId, + planName, + termUnit, + termId, + 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(OfferDetails)} does not support writing '{options.Format}' format."); + } + } + + OfferDetails 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 DeserializeOfferDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(OfferDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/OfferDetails.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/OfferDetails.cs new file mode 100644 index 000000000000..cd752d3d660a --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/OfferDetails.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// Offer details for the marketplace that is selected by the user. + public partial class OfferDetails + { + /// + /// 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 . + /// Publisher Id for the marketplace offer. + /// Offer Id for the marketplace offer. + /// Plan Id for the marketplace offer. + /// , or is null. + public OfferDetails(string publisherId, string offerId, string planId) + { + Argument.AssertNotNull(publisherId, nameof(publisherId)); + Argument.AssertNotNull(offerId, nameof(offerId)); + Argument.AssertNotNull(planId, nameof(planId)); + + PublisherId = publisherId; + OfferId = offerId; + PlanId = planId; + } + + /// Initializes a new instance of . + /// Publisher Id for the marketplace offer. + /// Offer Id for the marketplace offer. + /// Plan Id for the marketplace offer. + /// Plan Name for the marketplace offer. + /// Plan Display Name for the marketplace offer. + /// Plan Display Name for the marketplace offer. + /// Keeps track of any properties unknown to the library. + internal OfferDetails(string publisherId, string offerId, string planId, string planName, string termUnit, string termId, IDictionary serializedAdditionalRawData) + { + PublisherId = publisherId; + OfferId = offerId; + PlanId = planId; + PlanName = planName; + TermUnit = termUnit; + TermId = termId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal OfferDetails() + { + } + + /// Publisher Id for the marketplace offer. + public string PublisherId { get; set; } + /// Offer Id for the marketplace offer. + public string OfferId { get; set; } + /// Plan Id for the marketplace offer. + public string PlanId { get; set; } + /// Plan Name for the marketplace offer. + public string PlanName { get; set; } + /// Plan Display Name for the marketplace offer. + public string TermUnit { get; set; } + /// Plan Display Name for the marketplace offer. + public string TermId { get; set; } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/PartnerProperties.Serialization.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/PartnerProperties.Serialization.cs new file mode 100644 index 000000000000..e7f12339e745 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/PartnerProperties.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.WeightsAndBiases.Models +{ + public partial class PartnerProperties : 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(PartnerProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region.ToString()); + writer.WritePropertyName("subdomain"u8); + writer.WriteStringValue(Subdomain); + 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 + } + } + } + + PartnerProperties 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(PartnerProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePartnerProperties(document.RootElement, options); + } + + internal static PartnerProperties DeserializePartnerProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Region region = default; + string subdomain = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("region"u8)) + { + region = new Region(property.Value.GetString()); + continue; + } + if (property.NameEquals("subdomain"u8)) + { + subdomain = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new PartnerProperties(region, subdomain, 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(PartnerProperties)} does not support writing '{options.Format}' format."); + } + } + + PartnerProperties 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 DeserializePartnerProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(PartnerProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/PartnerProperties.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/PartnerProperties.cs new file mode 100644 index 000000000000..8dfb19c98cd9 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/PartnerProperties.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// Partner's specific Properties. + public partial class PartnerProperties + { + /// + /// 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 region of the instance. + /// The subdomain of the instance. + /// is null. + public PartnerProperties(Region region, string subdomain) + { + Argument.AssertNotNull(subdomain, nameof(subdomain)); + + Region = region; + Subdomain = subdomain; + } + + /// Initializes a new instance of . + /// The region of the instance. + /// The subdomain of the instance. + /// Keeps track of any properties unknown to the library. + internal PartnerProperties(Region region, string subdomain, IDictionary serializedAdditionalRawData) + { + Region = region; + Subdomain = subdomain; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal PartnerProperties() + { + } + + /// The region of the instance. + public Region Region { get; set; } + /// The subdomain of the instance. + public string Subdomain { get; set; } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/Region.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/Region.cs new file mode 100644 index 000000000000..c4fa83ff063c --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/Region.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// The available regions. + public readonly partial struct Region : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Region(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EastusValue = "eastus"; + private const string CentralusValue = "centralus"; + private const string WestusValue = "westus"; + private const string WesteuropeValue = "westeurope"; + private const string JapaneastValue = "japaneast"; + private const string KoreacentralValue = "koreacentral"; + + /// Region: East US. + public static Region Eastus { get; } = new Region(EastusValue); + /// Region: Central US. + public static Region Centralus { get; } = new Region(CentralusValue); + /// Region: West US. + public static Region Westus { get; } = new Region(WestusValue); + /// Region: West Europe. + public static Region Westeurope { get; } = new Region(WesteuropeValue); + /// Region: Japan East. + public static Region Japaneast { get; } = new Region(JapaneastValue); + /// Region: Korea Central. + public static Region Koreacentral { get; } = new Region(KoreacentralValue); + /// Determines if two values are the same. + public static bool operator ==(Region left, Region right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Region left, Region right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Region(string value) => new Region(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Region other && Equals(other); + /// + public bool Equals(Region 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/ResourceProvisioningState.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/ResourceProvisioningState.cs new file mode 100644 index 000000000000..8150ec6e4260 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/ResourceProvisioningState.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// The provisioning state of a resource type. + public readonly partial struct ResourceProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ResourceProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Resource has been created. + public static ResourceProvisioningState Succeeded { get; } = new ResourceProvisioningState(SucceededValue); + /// Resource creation failed. + public static ResourceProvisioningState Failed { get; } = new ResourceProvisioningState(FailedValue); + /// Resource creation was canceled. + public static ResourceProvisioningState Canceled { get; } = new ResourceProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ResourceProvisioningState left, ResourceProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ResourceProvisioningState left, ResourceProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ResourceProvisioningState(string value) => new ResourceProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ResourceProvisioningState other && Equals(other); + /// + public bool Equals(ResourceProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnPropertiesV2.Serialization.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnPropertiesV2.Serialization.cs new file mode 100644 index 000000000000..7704866a4b13 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnPropertiesV2.Serialization.cs @@ -0,0 +1,194 @@ +// 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.WeightsAndBiases.Models +{ + public partial class SingleSignOnPropertiesV2 : 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(SingleSignOnPropertiesV2)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type.ToString()); + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(EnterpriseAppId)) + { + writer.WritePropertyName("enterpriseAppId"u8); + writer.WriteStringValue(EnterpriseAppId); + } + if (Optional.IsDefined(Uri)) + { + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Uri); + } + if (Optional.IsCollectionDefined(AadDomains)) + { + writer.WritePropertyName("aadDomains"u8); + writer.WriteStartArray(); + foreach (var item in AadDomains) + { + writer.WriteStringValue(item); + } + 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 + } + } + } + + SingleSignOnPropertiesV2 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(SingleSignOnPropertiesV2)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSingleSignOnPropertiesV2(document.RootElement, options); + } + + internal static SingleSignOnPropertiesV2 DeserializeSingleSignOnPropertiesV2(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SingleSignOnType type = default; + SingleSignOnState? state = default; + string enterpriseAppId = default; + string url = default; + IList aadDomains = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + type = new SingleSignOnType(property.Value.GetString()); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new SingleSignOnState(property.Value.GetString()); + continue; + } + if (property.NameEquals("enterpriseAppId"u8)) + { + enterpriseAppId = property.Value.GetString(); + continue; + } + if (property.NameEquals("url"u8)) + { + url = property.Value.GetString(); + continue; + } + if (property.NameEquals("aadDomains"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + aadDomains = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SingleSignOnPropertiesV2( + type, + state, + enterpriseAppId, + url, + aadDomains ?? 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(SingleSignOnPropertiesV2)} does not support writing '{options.Format}' format."); + } + } + + SingleSignOnPropertiesV2 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 DeserializeSingleSignOnPropertiesV2(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SingleSignOnPropertiesV2)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnPropertiesV2.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnPropertiesV2.cs new file mode 100644 index 000000000000..18d30a97cb54 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnPropertiesV2.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// Properties specific to Single Sign On Resource. + public partial class SingleSignOnPropertiesV2 + { + /// + /// 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 . + /// Type of Single Sign-On mechanism being used. + public SingleSignOnPropertiesV2(SingleSignOnType type) + { + Type = type; + AadDomains = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Type of Single Sign-On mechanism being used. + /// State of the Single Sign On for the resource. + /// AAD enterprise application Id used to setup SSO. + /// URL for SSO to be used by the partner to redirect the user to their system. + /// List of AAD domains fetched from Microsoft Graph for user. + /// Keeps track of any properties unknown to the library. + internal SingleSignOnPropertiesV2(SingleSignOnType type, SingleSignOnState? state, string enterpriseAppId, string uri, IList aadDomains, IDictionary serializedAdditionalRawData) + { + Type = type; + State = state; + EnterpriseAppId = enterpriseAppId; + Uri = uri; + AadDomains = aadDomains; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SingleSignOnPropertiesV2() + { + } + + /// Type of Single Sign-On mechanism being used. + public SingleSignOnType Type { get; set; } + /// State of the Single Sign On for the resource. + public SingleSignOnState? State { get; set; } + /// AAD enterprise application Id used to setup SSO. + public string EnterpriseAppId { get; set; } + /// URL for SSO to be used by the partner to redirect the user to their system. + public string Uri { get; set; } + /// List of AAD domains fetched from Microsoft Graph for user. + public IList AadDomains { get; } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnState.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnState.cs new file mode 100644 index 000000000000..1ab109db6c19 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnState.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.WeightsAndBiases.Models +{ + /// Various states of the SSO resource. + public readonly partial struct SingleSignOnState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SingleSignOnState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InitialValue = "Initial"; + private const string EnableValue = "Enable"; + private const string DisableValue = "Disable"; + + /// Initial state of the SSO resource. + public static SingleSignOnState Initial { get; } = new SingleSignOnState(InitialValue); + /// State of the SSO resource when it is enabled. + public static SingleSignOnState Enable { get; } = new SingleSignOnState(EnableValue); + /// State of the SSO resource when it is disabled. + public static SingleSignOnState Disable { get; } = new SingleSignOnState(DisableValue); + /// Determines if two values are the same. + public static bool operator ==(SingleSignOnState left, SingleSignOnState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SingleSignOnState left, SingleSignOnState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SingleSignOnState(string value) => new SingleSignOnState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SingleSignOnState other && Equals(other); + /// + public bool Equals(SingleSignOnState 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnType.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnType.cs new file mode 100644 index 000000000000..9974be02b24a --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/SingleSignOnType.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.WeightsAndBiases.Models +{ + /// Defines the type of Single Sign-On (SSO) mechanism being used. + public readonly partial struct SingleSignOnType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SingleSignOnType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SamlValue = "Saml"; + private const string OpenIdValue = "OpenId"; + + /// Security Assertion Markup Language (SAML) based Single Sign-On. + public static SingleSignOnType Saml { get; } = new SingleSignOnType(SamlValue); + /// OpenID Connect based Single Sign-On. + public static SingleSignOnType OpenId { get; } = new SingleSignOnType(OpenIdValue); + /// Determines if two values are the same. + public static bool operator ==(SingleSignOnType left, SingleSignOnType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SingleSignOnType left, SingleSignOnType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator SingleSignOnType(string value) => new SingleSignOnType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SingleSignOnType other && Equals(other); + /// + public bool Equals(SingleSignOnType 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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/UserDetails.Serialization.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/UserDetails.Serialization.cs new file mode 100644 index 000000000000..21af6d39da76 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/UserDetails.Serialization.cs @@ -0,0 +1,179 @@ +// 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.WeightsAndBiases.Models +{ + public partial class UserDetails : 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(UserDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(FirstName)) + { + writer.WritePropertyName("firstName"u8); + writer.WriteStringValue(FirstName); + } + if (Optional.IsDefined(LastName)) + { + writer.WritePropertyName("lastName"u8); + writer.WriteStringValue(LastName); + } + if (Optional.IsDefined(EmailAddress)) + { + writer.WritePropertyName("emailAddress"u8); + writer.WriteStringValue(EmailAddress); + } + if (Optional.IsDefined(Upn)) + { + writer.WritePropertyName("upn"u8); + writer.WriteStringValue(Upn); + } + if (Optional.IsDefined(PhoneNumber)) + { + writer.WritePropertyName("phoneNumber"u8); + writer.WriteStringValue(PhoneNumber); + } + 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 + } + } + } + + UserDetails 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(UserDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUserDetails(document.RootElement, options); + } + + internal static UserDetails DeserializeUserDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string firstName = default; + string lastName = default; + string emailAddress = default; + string upn = default; + string phoneNumber = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("firstName"u8)) + { + firstName = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastName"u8)) + { + lastName = property.Value.GetString(); + continue; + } + if (property.NameEquals("emailAddress"u8)) + { + emailAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("upn"u8)) + { + upn = property.Value.GetString(); + continue; + } + if (property.NameEquals("phoneNumber"u8)) + { + phoneNumber = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UserDetails( + firstName, + lastName, + emailAddress, + upn, + phoneNumber, + 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(UserDetails)} does not support writing '{options.Format}' format."); + } + } + + UserDetails 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 DeserializeUserDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UserDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/UserDetails.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/UserDetails.cs new file mode 100644 index 000000000000..a8b1f3761004 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/Models/UserDetails.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.WeightsAndBiases.Models +{ + /// User details for an organization. + public partial class UserDetails + { + /// + /// 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 UserDetails() + { + } + + /// Initializes a new instance of . + /// First name of the user. + /// Last name of the user. + /// Email address of the user. + /// User's principal name. + /// User's phone number. + /// Keeps track of any properties unknown to the library. + internal UserDetails(string firstName, string lastName, string emailAddress, string upn, string phoneNumber, IDictionary serializedAdditionalRawData) + { + FirstName = firstName; + LastName = lastName; + EmailAddress = emailAddress; + Upn = upn; + PhoneNumber = phoneNumber; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// First name of the user. + public string FirstName { get; set; } + /// Last name of the user. + public string LastName { get; set; } + /// Email address of the user. + public string EmailAddress { get; set; } + /// User's principal name. + public string Upn { get; set; } + /// User's phone number. + public string PhoneNumber { get; set; } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/ProviderConstants.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..5f5ed1109237 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/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.WeightsAndBiases +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/RestOperations/InstancesRestOperations.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/RestOperations/InstancesRestOperations.cs new file mode 100644 index 000000000000..aa00d7645e91 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Generated/RestOperations/InstancesRestOperations.cs @@ -0,0 +1,731 @@ +// 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.WeightsAndBiases.Models; + +namespace Azure.ResourceManager.WeightsAndBiases +{ + internal partial class InstancesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of InstancesRestOperations. + /// 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 InstancesRestOperations(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-09-18-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string instancename) + { + 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.WeightsAndBiases/instances/", false); + uri.AppendPath(instancename, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string instancename) + { + 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.WeightsAndBiases/instances/", false); + uri.AppendPath(instancename, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Instance resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instancename); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InstanceResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = InstanceResourceData.DeserializeInstanceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InstanceResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Instance resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, instancename); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InstanceResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = InstanceResourceData.DeserializeInstanceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InstanceResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string instancename, InstanceResourceData 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.WeightsAndBiases/instances/", false); + uri.AppendPath(instancename, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string instancename, InstanceResourceData 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.WeightsAndBiases/instances/", false); + uri.AppendPath(instancename, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Instance resource. + /// 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 instancename, InstanceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instancename, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Instance resource. + /// 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 instancename, InstanceResourceData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, instancename, 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 instancename, InstanceResourcePatch 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.WeightsAndBiases/instances/", false); + uri.AppendPath(instancename, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string instancename, InstanceResourcePatch 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.WeightsAndBiases/instances/", false); + uri.AppendPath(instancename, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Instance resource. + /// 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 instancename, InstanceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, instancename, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InstanceResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = InstanceResourceData.DeserializeInstanceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Instance resource. + /// 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 instancename, InstanceResourcePatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, instancename, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InstanceResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = InstanceResourceData.DeserializeInstanceResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string instancename) + { + 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.WeightsAndBiases/instances/", false); + uri.AppendPath(instancename, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string instancename) + { + 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.WeightsAndBiases/instances/", false); + uri.AppendPath(instancename, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Instance resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instancename); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a InstanceResource. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// Name of the Instance resource. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string instancename, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(instancename, nameof(instancename)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, instancename); + _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.WeightsAndBiases/instances", 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.WeightsAndBiases/instances", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List InstanceResource resources by 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: + { + InstanceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InstanceResource resources by 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: + { + InstanceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(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.WeightsAndBiases/instances", 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.WeightsAndBiases/instances", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List InstanceResource resources by subscription ID. + /// 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: + { + InstanceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InstanceResource resources by subscription ID. + /// 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: + { + InstanceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(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; + } + + /// List InstanceResource resources by 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: + { + InstanceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InstanceResource resources by 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: + { + InstanceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(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; + } + + /// List InstanceResource resources by subscription ID. + /// 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: + { + InstanceResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List InstanceResource resources by subscription ID. + /// 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: + { + InstanceResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = InstanceResourceListResult.DeserializeInstanceResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Properties/AssemblyInfo.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..909705dcaa05 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/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.WeightsAndBiases.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("WeightsAndBiases")] diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tests/Azure.ResourceManager.WeightsAndBiases.Tests.csproj b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tests/Azure.ResourceManager.WeightsAndBiases.Tests.csproj new file mode 100644 index 000000000000..5e8a9a648eb5 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tests/Azure.ResourceManager.WeightsAndBiases.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tests/WeightsAndBiasesManagementTestBase.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tests/WeightsAndBiasesManagementTestBase.cs new file mode 100644 index 000000000000..e7682269cb65 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tests/WeightsAndBiasesManagementTestBase.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.WeightsAndBiases.Tests +{ + public class WeightsAndBiasesManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected WeightsAndBiasesManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected WeightsAndBiasesManagementTestBase(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/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tests/WeightsAndBiasesManagementTestEnvironment.cs b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tests/WeightsAndBiasesManagementTestEnvironment.cs new file mode 100644 index 000000000000..7da0612159d9 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tests/WeightsAndBiasesManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.WeightsAndBiases.Tests +{ + public class WeightsAndBiasesManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tsp-location.yaml b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tsp-location.yaml new file mode 100644 index 000000000000..36d1c68a7702 --- /dev/null +++ b/sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/liftrweightsandbiases/Liftr.WeightsAndBiases.Management +commit: c86a5491d0beb79d62f60fb24059413209e62432 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/liftrweightsandbiases/ci.mgmt.yml b/sdk/liftrweightsandbiases/ci.mgmt.yml new file mode 100644 index 000000000000..8dd00eea20fa --- /dev/null +++ b/sdk/liftrweightsandbiases/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/liftrweightsandbiases /ci.mgmt.yml + - sdk/liftrweightsandbiases /Azure.ResourceManager.WeightsAndBiases / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: liftrweightsandbiases + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.WeightsAndBiases + safeName: AzureResourceManagerWeightsAndBiases diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index d8bf790b5988..83c49e26bab7 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -12,6 +12,7 @@ trigger: - common/ManagementTestShared - common/ManagementCoreShared - sdk/advisor/Azure.ResourceManager.Advisor + - sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement - sdk/analysisservices/Azure.ResourceManager.Analysis @@ -79,7 +80,6 @@ trigger: - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/edgezones/Azure.ResourceManager.EdgeZones - sdk/elastic/Azure.ResourceManager.Elastic - sdk/elasticsan/Azure.ResourceManager.ElasticSan @@ -108,10 +108,12 @@ trigger: - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub + - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/keyvault/Azure.ResourceManager.KeyVault - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - sdk/kusto/Azure.ResourceManager.Kusto - sdk/labservices/Azure.ResourceManager.LabServices + - sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases - sdk/loadtestservice/Azure.ResourceManager.LoadTesting - sdk/logic/Azure.ResourceManager.Logic - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute @@ -218,6 +220,7 @@ pr: - common/ManagementTestShared - common/ManagementCoreShared - sdk/advisor/Azure.ResourceManager.Advisor + - sdk/agricultureplatform/Azure.ResourceManager.AgriculturePlatform - sdk/agrifood/Azure.ResourceManager.AgFoodPlatform - sdk/alertsmanagement/Azure.ResourceManager.AlertsManagement - sdk/analysisservices/Azure.ResourceManager.Analysis @@ -285,7 +288,6 @@ pr: - sdk/dnsresolver/Azure.ResourceManager.DnsResolver - sdk/dynatrace/Azure.ResourceManager.Dynatrace - sdk/edgeorder/Azure.ResourceManager.EdgeOrder - - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/edgezones/Azure.ResourceManager.EdgeZones - sdk/elastic/Azure.ResourceManager.Elastic - sdk/elasticsan/Azure.ResourceManager.ElasticSan @@ -314,10 +316,12 @@ pr: - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral - sdk/iothub/Azure.ResourceManager.IotHub + - sdk/iotoperations/Azure.ResourceManager.IotOperations - sdk/keyvault/Azure.ResourceManager.KeyVault - sdk/kubernetesconfiguration/Azure.ResourceManager.KubernetesConfiguration - sdk/kusto/Azure.ResourceManager.Kusto - sdk/labservices/Azure.ResourceManager.LabServices + - sdk/liftrweightsandbiases/Azure.ResourceManager.WeightsAndBiases - sdk/loadtestservice/Azure.ResourceManager.LoadTesting - sdk/logic/Azure.ResourceManager.Logic - sdk/machinelearningcompute/Azure.ResourceManager.MachineLearningCompute diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..85d4fb9f75a5 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -11,7 +11,11 @@ trigger: - sdk/storage/ - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - 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/