diff --git a/.vscode/cspell.json b/.vscode/cspell.json index a6eec99a62b03..bfd8f5fb36dbb 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -733,6 +733,12 @@ "Puid" ] }, + { + "filename": "**/sdk/resourcehealth/**/*.cs", + "words": [ + "occured" + ] + }, { "filename": "**/sdk/servicefabricmanagedclusters/**/*.cs", "words": [ diff --git a/sdk/purview/Azure.ResourceManager.Purview/CHANGELOG.md b/sdk/purview/Azure.ResourceManager.Purview/CHANGELOG.md index dc8eb614d3697..108d35c659287 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/CHANGELOG.md +++ b/sdk/purview/Azure.ResourceManager.Purview/CHANGELOG.md @@ -1,15 +1,12 @@ # Release History -## 1.1.0-beta.1 (Unreleased) - -### Features Added - -### Breaking Changes - -### Bugs Fixed +## 1.0.1 (2023-02-21) ### Other Changes +- Upgraded dependent `Azure.Core` to `1.28.0`. +- Upgraded dependent `Azure.ResourceManager` to `1.4.0`. + ## 1.0.0 (2022-09-26) This release is the first stable release of the Purview Management library. diff --git a/sdk/purview/Azure.ResourceManager.Purview/src/Azure.ResourceManager.Purview.csproj b/sdk/purview/Azure.ResourceManager.Purview/src/Azure.ResourceManager.Purview.csproj index 57d589287eb7c..69b1d6c141706 100644 --- a/sdk/purview/Azure.ResourceManager.Purview/src/Azure.ResourceManager.Purview.csproj +++ b/sdk/purview/Azure.ResourceManager.Purview/src/Azure.ResourceManager.Purview.csproj @@ -1,6 +1,6 @@ - 1.1.0-beta.1 + 1.0.1 1.0.0 Azure.ResourceManager.Purview diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/Azure.ResourceManager.ResourceHealth.sln b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/Azure.ResourceManager.ResourceHealth.sln new file mode 100644 index 0000000000000..3719b295003be --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/Azure.ResourceManager.ResourceHealth.sln @@ -0,0 +1,65 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.4.33403.182 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ResourceHealth", "src\Azure.ResourceManager.ResourceHealth.csproj", "{9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ResourceHealth.Tests", "tests\Azure.ResourceManager.ResourceHealth.Tests.csproj", "{BB0F4B07-B84D-4332-BC51-37A41483C23A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.ResourceHealth.Samples", "samples\Azure.ResourceManager.ResourceHealth.Samples.csproj", "{9B9FABBB-5223-4B55-81C1-2444FB662E9C}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Debug|x64.ActiveCfg = Debug|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Debug|x64.Build.0 = Debug|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Debug|x86.ActiveCfg = Debug|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Debug|x86.Build.0 = Debug|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Release|Any CPU.Build.0 = Release|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Release|x64.ActiveCfg = Release|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Release|x64.Build.0 = Release|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Release|x86.ActiveCfg = Release|Any CPU + {9E8D08A6-9D1D-430E-8FCB-D532CDDBAF5A}.Release|x86.Build.0 = Release|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Debug|x64.ActiveCfg = Debug|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Debug|x64.Build.0 = Debug|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Debug|x86.ActiveCfg = Debug|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Debug|x86.Build.0 = Debug|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Release|Any CPU.Build.0 = Release|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Release|x64.ActiveCfg = Release|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Release|x64.Build.0 = Release|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Release|x86.ActiveCfg = Release|Any CPU + {BB0F4B07-B84D-4332-BC51-37A41483C23A}.Release|x86.Build.0 = Release|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Debug|x64.ActiveCfg = Debug|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Debug|x64.Build.0 = Debug|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Debug|x86.ActiveCfg = Debug|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Debug|x86.Build.0 = Debug|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Release|Any CPU.Build.0 = Release|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Release|x64.ActiveCfg = Release|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Release|x64.Build.0 = Release|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Release|x86.ActiveCfg = Release|Any CPU + {9B9FABBB-5223-4B55-81C1-2444FB662E9C}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {63E57332-52F3-4BDB-B29F-28FACCA5F337} + EndGlobalSection +EndGlobal diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/CHANGELOG.md b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/CHANGELOG.md new file mode 100644 index 0000000000000..07ab6d218f216 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/CHANGELOG.md @@ -0,0 +1,17 @@ +# Release History + +## 1.0.0-beta.1 (2023-02-21) + +### General New Features + +This package 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. + +This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). + +> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). \ No newline at end of file diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/Directory.Build.props b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/Directory.Build.props new file mode 100644 index 0000000000000..1a9611bd49242 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/README.md b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/README.md new file mode 100644 index 0000000000000..17a8d677568ce --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure Resource Health management client library for .NET + +Microsoft Azure Resource Health helps you diagnose and get support for service problems that affect your Azure resources. It reports on the current and past health of your resources. + +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 Resource Health management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.ResourceHealth --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://docs.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/resourcehealth/Azure.ResourceManager.ResourceHealth/api/Azure.ResourceManager.ResourceHealth.netstandard2.0.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/api/Azure.ResourceManager.ResourceHealth.netstandard2.0.cs new file mode 100644 index 0000000000000..0b0cddc6add88 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/api/Azure.ResourceManager.ResourceHealth.netstandard2.0.cs @@ -0,0 +1,661 @@ +namespace Azure.ResourceManager.ResourceHealth +{ + public partial class AvailabilityStatusData : Azure.ResourceManager.Models.ResourceData + { + internal AvailabilityStatusData() { } + public Azure.Core.AzureLocation? Location { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.AvailabilityStatusProperties Properties { get { throw null; } } + } + public partial class AvailabilityStatusResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected AvailabilityStatusResource() { } + public virtual Azure.ResourceManager.ResourceHealth.AvailabilityStatusData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string resourceUri) { throw null; } + public virtual Azure.Response Get(string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string filter = null, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class EmergingIssuesGetResultCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected EmergingIssuesGetResultCollection() { } + public virtual Azure.Response Exists(Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter issueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter issueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter issueName, 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(Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter issueName, 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 EmergingIssuesGetResultData : Azure.ResourceManager.Models.ResourceData + { + internal EmergingIssuesGetResultData() { } + public System.DateTimeOffset? RefreshTimestamp { get { throw null; } } + public System.Collections.Generic.IReadOnlyList StatusActiveEvents { get { throw null; } } + public System.Collections.Generic.IReadOnlyList StatusBanners { get { throw null; } } + } + public partial class EmergingIssuesGetResultResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected EmergingIssuesGetResultResource() { } + public virtual Azure.ResourceManager.ResourceHealth.EmergingIssuesGetResultData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter issueName) { 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 partial class EventData : Azure.ResourceManager.Models.ResourceData + { + internal EventData() { } + public string AdditionalInformationMessage { get { throw null; } } + public string ArticleContent { get { throw null; } } + public string Description { get { throw null; } } + public int? Duration { get { throw null; } } + public bool? EnableChatWithUs { get { throw null; } } + public bool? EnableMicrosoftSupport { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.EventLevelValue? EventLevel { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.EventSourceValue? EventSource { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.EventTypeValue? EventType { get { throw null; } } + public string ExternalIncidentId { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Faqs { get { throw null; } } + public string Header { get { throw null; } } + public string HirStage { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Impact { get { throw null; } } + public System.DateTimeOffset? ImpactMitigationOn { get { throw null; } } + public System.DateTimeOffset? ImpactStartOn { get { throw null; } } + public string ImpactType { get { throw null; } } + public bool? IsHIR { get { throw null; } } + public System.DateTimeOffset? LastUpdateOn { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.LevelValue? Level { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Links { get { throw null; } } + public bool? PlatformInitiated { get { throw null; } } + public int? Priority { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.EventPropertiesRecommendedActions RecommendedActions { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.EventStatusValue? Status { get { throw null; } } + public string Summary { get { throw null; } } + public string Title { get { throw null; } } + } + public partial class EventImpactedResourceData : Azure.ResourceManager.Models.ResourceData + { + internal EventImpactedResourceData() { } + public System.Collections.Generic.IReadOnlyList Info { get { throw null; } } + public string TargetRegion { get { throw null; } } + public string TargetResourceId { get { throw null; } } + public string TargetResourceType { get { throw null; } } + } + public partial class MetadataEntityCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected MetadataEntityCollection() { } + public virtual Azure.Response Exists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string name, 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 name, 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 MetadataEntityData : Azure.ResourceManager.Models.ResourceData + { + internal MetadataEntityData() { } + public System.Collections.Generic.IReadOnlyList ApplicableScenarios { get { throw null; } } + public System.Collections.Generic.IReadOnlyList DependsOn { get { throw null; } } + public string DisplayName { get { throw null; } } + public System.Collections.Generic.IReadOnlyList SupportedValues { get { throw null; } } + } + public partial class MetadataEntityResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected MetadataEntityResource() { } + public virtual Azure.ResourceManager.ResourceHealth.MetadataEntityData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string name) { 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 static partial class ResourceHealthExtensions + { + public static Azure.ResourceManager.ResourceHealth.AvailabilityStatusResource GetAvailabilityStatus(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } + public static Azure.ResourceManager.ResourceHealth.AvailabilityStatusResource GetAvailabilityStatusResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetEmergingIssuesGetResult(this Azure.ResourceManager.Resources.TenantResource tenantResource, Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter issueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetEmergingIssuesGetResultAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter issueName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ResourceHealth.EmergingIssuesGetResultResource GetEmergingIssuesGetResultResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ResourceHealth.EmergingIssuesGetResultCollection GetEmergingIssuesGetResults(this Azure.ResourceManager.Resources.TenantResource tenantResource) { throw null; } + public static Azure.ResourceManager.ResourceHealth.MetadataEntityCollection GetMetadataEntities(this Azure.ResourceManager.Resources.TenantResource tenantResource) { throw null; } + public static Azure.Response GetMetadataEntity(this Azure.ResourceManager.Resources.TenantResource tenantResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetMetadataEntityAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ResourceHealth.MetadataEntityResource GetMetadataEntityResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetSubscriptionEvent(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetSubscriptionEventAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ResourceHealth.SubscriptionEventResource GetSubscriptionEventResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ResourceHealth.SubscriptionEventCollection GetSubscriptionEvents(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.ResourceManager.ResourceHealth.SubscriptionResourceHealthEventImpactedResource GetSubscriptionResourceHealthEventImpactedResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetTenantEvent(this Azure.ResourceManager.Resources.TenantResource tenantResource, string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetTenantEventAsync(this Azure.ResourceManager.Resources.TenantResource tenantResource, string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.ResourceHealth.TenantEventResource GetTenantEventResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.ResourceHealth.TenantEventCollection GetTenantEvents(this Azure.ResourceManager.Resources.TenantResource tenantResource) { throw null; } + public static Azure.ResourceManager.ResourceHealth.TenantResourceHealthEventImpactedResource GetTenantResourceHealthEventImpactedResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class SubscriptionEventCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SubscriptionEventCollection() { } + public virtual Azure.Response Exists(string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string eventTrackingId, string filter = null, string queryStartTime = null, 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 SubscriptionEventResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SubscriptionEventResource() { } + public virtual Azure.ResourceManager.ResourceHealth.EventData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string eventTrackingId) { throw null; } + public virtual Azure.Response FetchDetailsBySubscriptionIdAndTrackingId(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> FetchDetailsBySubscriptionIdAndTrackingIdAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSecurityAdvisoryImpactedResourcesBySubscriptionIdAndEventId(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecurityAdvisoryImpactedResourcesBySubscriptionIdAndEventIdAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetSubscriptionResourceHealthEventImpactedResource(string impactedResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetSubscriptionResourceHealthEventImpactedResourceAsync(string impactedResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.SubscriptionResourceHealthEventImpactedResourceCollection GetSubscriptionResourceHealthEventImpactedResources() { throw null; } + } + public partial class SubscriptionResourceHealthEventImpactedResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected SubscriptionResourceHealthEventImpactedResource() { } + public virtual Azure.ResourceManager.ResourceHealth.EventImpactedResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string eventTrackingId, string impactedResourceName) { 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 partial class SubscriptionResourceHealthEventImpactedResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected SubscriptionResourceHealthEventImpactedResourceCollection() { } + public virtual Azure.Response Exists(string impactedResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string impactedResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string impactedResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string impactedResourceName, 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 TenantEventCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected TenantEventCollection() { } + public virtual Azure.Response Exists(string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string eventTrackingId, string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string eventTrackingId, string filter = null, string queryStartTime = null, 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 TenantEventResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected TenantEventResource() { } + public virtual Azure.ResourceManager.ResourceHealth.EventData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string eventTrackingId) { throw null; } + public virtual Azure.Response FetchDetailsByTenantIdAndTrackingId(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> FetchDetailsByTenantIdAndTrackingIdAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string filter = null, string queryStartTime = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetSecurityAdvisoryImpactedResourcesByTenantIdAndEventId(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetSecurityAdvisoryImpactedResourcesByTenantIdAndEventIdAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetTenantResourceHealthEventImpactedResource(string impactedResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetTenantResourceHealthEventImpactedResourceAsync(string impactedResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ResourceHealth.TenantResourceHealthEventImpactedResourceCollection GetTenantResourceHealthEventImpactedResources() { throw null; } + } + public partial class TenantResourceHealthEventImpactedResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected TenantResourceHealthEventImpactedResource() { } + public virtual Azure.ResourceManager.ResourceHealth.EventImpactedResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string eventTrackingId, string impactedResourceName) { 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 partial class TenantResourceHealthEventImpactedResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected TenantResourceHealthEventImpactedResourceCollection() { } + public virtual Azure.Response Exists(string impactedResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string impactedResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string impactedResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string filter = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string impactedResourceName, 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; } + } +} +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public static partial class ArmResourceHealthModelFactory + { + public static Azure.ResourceManager.ResourceHealth.AvailabilityStatusData AvailabilityStatusData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.ResourceManager.ResourceHealth.Models.AvailabilityStatusProperties properties = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.AvailabilityStatusProperties AvailabilityStatusProperties(Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue? availabilityState = default(Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue?), string title = null, string summary = null, string detailedStatus = null, string reasonType = null, string context = null, string category = null, System.DateTimeOffset? rootCauseAttributionOn = default(System.DateTimeOffset?), string healthEventType = null, string healthEventCause = null, string healthEventCategory = null, string healthEventId = null, System.DateTimeOffset? resolutionETA = default(System.DateTimeOffset?), System.DateTimeOffset? occuredOn = default(System.DateTimeOffset?), Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType? reasonChronicity = default(Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType?), System.DateTimeOffset? reportedOn = default(System.DateTimeOffset?), Azure.ResourceManager.ResourceHealth.Models.AvailabilityStatusPropertiesRecentlyResolved recentlyResolved = null, System.Collections.Generic.IEnumerable recommendedActions = null, System.Collections.Generic.IEnumerable serviceImpactingEvents = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.AvailabilityStatusPropertiesRecentlyResolved AvailabilityStatusPropertiesRecentlyResolved(System.DateTimeOffset? unavailableOccuredOn = default(System.DateTimeOffset?), System.DateTimeOffset? resolvedOn = default(System.DateTimeOffset?), string unavailableSummary = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.EmergingIssueImpact EmergingIssueImpact(string id = null, string name = null, System.Collections.Generic.IEnumerable regions = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.EmergingIssuesGetResultData EmergingIssuesGetResultData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.DateTimeOffset? refreshTimestamp = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable statusBanners = null, System.Collections.Generic.IEnumerable statusActiveEvents = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.EventData EventData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.ResourceHealth.Models.EventTypeValue? eventType = default(Azure.ResourceManager.ResourceHealth.Models.EventTypeValue?), Azure.ResourceManager.ResourceHealth.Models.EventSourceValue? eventSource = default(Azure.ResourceManager.ResourceHealth.Models.EventSourceValue?), Azure.ResourceManager.ResourceHealth.Models.EventStatusValue? status = default(Azure.ResourceManager.ResourceHealth.Models.EventStatusValue?), string title = null, string summary = null, string header = null, Azure.ResourceManager.ResourceHealth.Models.LevelValue? level = default(Azure.ResourceManager.ResourceHealth.Models.LevelValue?), Azure.ResourceManager.ResourceHealth.Models.EventLevelValue? eventLevel = default(Azure.ResourceManager.ResourceHealth.Models.EventLevelValue?), string externalIncidentId = null, string articleContent = null, System.Collections.Generic.IEnumerable links = null, System.DateTimeOffset? impactStartOn = default(System.DateTimeOffset?), System.DateTimeOffset? impactMitigationOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable impact = null, Azure.ResourceManager.ResourceHealth.Models.EventPropertiesRecommendedActions recommendedActions = null, System.Collections.Generic.IEnumerable faqs = null, bool? isHIR = default(bool?), bool? enableMicrosoftSupport = default(bool?), string description = null, bool? platformInitiated = default(bool?), bool? enableChatWithUs = default(bool?), int? priority = default(int?), System.DateTimeOffset? lastUpdateOn = default(System.DateTimeOffset?), string hirStage = null, string additionalInformationMessage = null, int? duration = default(int?), string impactType = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.EventImpactedResourceData EventImpactedResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string targetResourceType = null, string targetResourceId = null, string targetRegion = null, System.Collections.Generic.IEnumerable info = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.EventPropertiesRecommendedActions EventPropertiesRecommendedActions(string message = null, System.Collections.Generic.IEnumerable actions = null, string localeCode = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.EventPropertiesRecommendedActionsItem EventPropertiesRecommendedActionsItem(int? groupId = default(int?), string actionText = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.Faq Faq(string question = null, string answer = null, string localeCode = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.Impact Impact(string impactedService = null, System.Collections.Generic.IEnumerable impactedRegions = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.ImpactedRegion ImpactedRegion(string id = null, string name = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.ImpactedServiceRegion ImpactedServiceRegion(string impactedRegion = null, Azure.ResourceManager.ResourceHealth.Models.EventStatusValue? status = default(Azure.ResourceManager.ResourceHealth.Models.EventStatusValue?), System.Collections.Generic.IEnumerable impactedSubscriptions = null, System.Collections.Generic.IEnumerable impactedTenants = null, System.DateTimeOffset? lastUpdateOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable updates = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.KeyValueItem KeyValueItem(string key = null, string value = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.Link Link(Azure.ResourceManager.ResourceHealth.Models.LinkTypeValue? linkType = default(Azure.ResourceManager.ResourceHealth.Models.LinkTypeValue?), Azure.ResourceManager.ResourceHealth.Models.LinkDisplayText displayText = null, string extensionName = null, string bladeName = null, System.BinaryData parameters = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.LinkDisplayText LinkDisplayText(string value = null, string localizedValue = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.MetadataEntityData MetadataEntityData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, string displayName = null, System.Collections.Generic.IEnumerable dependsOn = null, System.Collections.Generic.IEnumerable applicableScenarios = null, System.Collections.Generic.IEnumerable supportedValues = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.MetadataSupportedValueDetail MetadataSupportedValueDetail(string id = null, string displayName = null, System.Collections.Generic.IEnumerable resourceTypes = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.RecommendedAction RecommendedAction(string action = null, System.Uri actionUri = null, string actionUrlText = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.ServiceImpactingEvent ServiceImpactingEvent(System.DateTimeOffset? eventStartOn = default(System.DateTimeOffset?), System.DateTimeOffset? eventStatusLastModifiedOn = default(System.DateTimeOffset?), string correlationId = null, string statusValue = null, Azure.ResourceManager.ResourceHealth.Models.ServiceImpactingEventIncidentProperties incidentProperties = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.ServiceImpactingEventIncidentProperties ServiceImpactingEventIncidentProperties(string title = null, string service = null, string region = null, string incidentType = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.StatusActiveEvent StatusActiveEvent(string title = null, string description = null, string trackingId = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), string cloud = null, Azure.ResourceManager.ResourceHealth.Models.SeverityValue? severity = default(Azure.ResourceManager.ResourceHealth.Models.SeverityValue?), Azure.ResourceManager.ResourceHealth.Models.StageValue? stage = default(Azure.ResourceManager.ResourceHealth.Models.StageValue?), bool? published = default(bool?), System.DateTimeOffset? lastModifiedOn = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable impacts = null) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.StatusBanner StatusBanner(string title = null, string message = null, string cloud = null, System.DateTimeOffset? lastModifiedOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.Update Update(string summary = null, System.DateTimeOffset? updateOn = default(System.DateTimeOffset?)) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AvailabilityStateValue : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AvailabilityStateValue(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue Available { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue Degraded { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue Unavailable { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue Unknown { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue 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.ResourceHealth.Models.AvailabilityStateValue left, Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue left, Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AvailabilityStatusProperties + { + internal AvailabilityStatusProperties() { } + public Azure.ResourceManager.ResourceHealth.Models.AvailabilityStateValue? AvailabilityState { get { throw null; } } + public string Category { get { throw null; } } + public string Context { get { throw null; } } + public string DetailedStatus { get { throw null; } } + public string HealthEventCategory { get { throw null; } } + public string HealthEventCause { get { throw null; } } + public string HealthEventId { get { throw null; } } + public string HealthEventType { get { throw null; } } + public System.DateTimeOffset? OccuredOn { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType? ReasonChronicity { get { throw null; } } + public string ReasonType { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.AvailabilityStatusPropertiesRecentlyResolved RecentlyResolved { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RecommendedActions { get { throw null; } } + public System.DateTimeOffset? ReportedOn { get { throw null; } } + public System.DateTimeOffset? ResolutionETA { get { throw null; } } + public System.DateTimeOffset? RootCauseAttributionOn { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ServiceImpactingEvents { get { throw null; } } + public string Summary { get { throw null; } } + public string Title { get { throw null; } } + } + public partial class AvailabilityStatusPropertiesRecentlyResolved + { + internal AvailabilityStatusPropertiesRecentlyResolved() { } + public System.DateTimeOffset? ResolvedOn { get { throw null; } } + public System.DateTimeOffset? UnavailableOccuredOn { get { throw null; } } + public string UnavailableSummary { get { throw null; } } + } + public partial class EmergingIssueImpact + { + internal EmergingIssueImpact() { } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Regions { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EventLevelValue : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EventLevelValue(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.EventLevelValue Critical { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.EventLevelValue Error { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.EventLevelValue Informational { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.EventLevelValue Warning { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.EventLevelValue 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.ResourceHealth.Models.EventLevelValue left, Azure.ResourceManager.ResourceHealth.Models.EventLevelValue right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.EventLevelValue (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.EventLevelValue left, Azure.ResourceManager.ResourceHealth.Models.EventLevelValue right) { throw null; } + public override string ToString() { throw null; } + } + public partial class EventPropertiesRecommendedActions + { + internal EventPropertiesRecommendedActions() { } + public System.Collections.Generic.IReadOnlyList Actions { get { throw null; } } + public string LocaleCode { get { throw null; } } + public string Message { get { throw null; } } + } + public partial class EventPropertiesRecommendedActionsItem + { + internal EventPropertiesRecommendedActionsItem() { } + public string ActionText { get { throw null; } } + public int? GroupId { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EventSourceValue : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EventSourceValue(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.EventSourceValue ResourceHealth { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.EventSourceValue ServiceHealth { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.EventSourceValue 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.ResourceHealth.Models.EventSourceValue left, Azure.ResourceManager.ResourceHealth.Models.EventSourceValue right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.EventSourceValue (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.EventSourceValue left, Azure.ResourceManager.ResourceHealth.Models.EventSourceValue right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EventStatusValue : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EventStatusValue(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.EventStatusValue Active { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.EventStatusValue Resolved { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.EventStatusValue 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.ResourceHealth.Models.EventStatusValue left, Azure.ResourceManager.ResourceHealth.Models.EventStatusValue right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.EventStatusValue (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.EventStatusValue left, Azure.ResourceManager.ResourceHealth.Models.EventStatusValue right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct EventTypeValue : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public EventTypeValue(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.EventTypeValue EmergingIssues { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.EventTypeValue HealthAdvisory { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.EventTypeValue PlannedMaintenance { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.EventTypeValue RCA { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.EventTypeValue SecurityAdvisory { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.EventTypeValue ServiceIssue { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.EventTypeValue 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.ResourceHealth.Models.EventTypeValue left, Azure.ResourceManager.ResourceHealth.Models.EventTypeValue right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.EventTypeValue (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.EventTypeValue left, Azure.ResourceManager.ResourceHealth.Models.EventTypeValue right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Faq + { + internal Faq() { } + public string Answer { get { throw null; } } + public string LocaleCode { get { throw null; } } + public string Question { get { throw null; } } + } + public partial class Impact + { + internal Impact() { } + public System.Collections.Generic.IReadOnlyList ImpactedRegions { get { throw null; } } + public string ImpactedService { get { throw null; } } + } + public partial class ImpactedRegion + { + internal ImpactedRegion() { } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + } + public partial class ImpactedServiceRegion + { + internal ImpactedServiceRegion() { } + public string ImpactedRegion { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ImpactedSubscriptions { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ImpactedTenants { get { throw null; } } + public System.DateTimeOffset? LastUpdateOn { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.EventStatusValue? Status { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Updates { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct IssueNameParameter : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public IssueNameParameter(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter Default { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter 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.ResourceHealth.Models.IssueNameParameter left, Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter left, Azure.ResourceManager.ResourceHealth.Models.IssueNameParameter right) { throw null; } + public override string ToString() { throw null; } + } + public partial class KeyValueItem + { + internal KeyValueItem() { } + public string Key { get { throw null; } } + public string Value { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct LevelValue : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public LevelValue(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.LevelValue Critical { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.LevelValue Warning { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.LevelValue 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.ResourceHealth.Models.LevelValue left, Azure.ResourceManager.ResourceHealth.Models.LevelValue right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.LevelValue (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.LevelValue left, Azure.ResourceManager.ResourceHealth.Models.LevelValue right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Link + { + internal Link() { } + public string BladeName { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.LinkDisplayText DisplayText { get { throw null; } } + public string ExtensionName { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.LinkTypeValue? LinkType { get { throw null; } } + public System.BinaryData Parameters { get { throw null; } } + } + public partial class LinkDisplayText + { + internal LinkDisplayText() { } + public string LocalizedValue { get { throw null; } } + public string Value { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct LinkTypeValue : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public LinkTypeValue(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.LinkTypeValue Button { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.LinkTypeValue Hyperlink { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.LinkTypeValue 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.ResourceHealth.Models.LinkTypeValue left, Azure.ResourceManager.ResourceHealth.Models.LinkTypeValue right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.LinkTypeValue (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.LinkTypeValue left, Azure.ResourceManager.ResourceHealth.Models.LinkTypeValue right) { throw null; } + public override string ToString() { throw null; } + } + public partial class MetadataSupportedValueDetail + { + internal MetadataSupportedValueDetail() { } + public string DisplayName { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ResourceTypes { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ReasonChronicityType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ReasonChronicityType(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType Persistent { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType Transient { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType 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.ResourceHealth.Models.ReasonChronicityType left, Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType left, Azure.ResourceManager.ResourceHealth.Models.ReasonChronicityType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RecommendedAction + { + internal RecommendedAction() { } + public string Action { get { throw null; } } + public System.Uri ActionUri { get { throw null; } } + public string ActionUrlText { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Scenario : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Scenario(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.Scenario Alerts { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.Scenario 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.ResourceHealth.Models.Scenario left, Azure.ResourceManager.ResourceHealth.Models.Scenario right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.Scenario (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.Scenario left, Azure.ResourceManager.ResourceHealth.Models.Scenario right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ServiceImpactingEvent + { + internal ServiceImpactingEvent() { } + public string CorrelationId { get { throw null; } } + public System.DateTimeOffset? EventStartOn { get { throw null; } } + public System.DateTimeOffset? EventStatusLastModifiedOn { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.ServiceImpactingEventIncidentProperties IncidentProperties { get { throw null; } } + public string StatusValue { get { throw null; } } + } + public partial class ServiceImpactingEventIncidentProperties + { + internal ServiceImpactingEventIncidentProperties() { } + public string IncidentType { get { throw null; } } + public string Region { get { throw null; } } + public string Service { get { throw null; } } + public string Title { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct SeverityValue : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public SeverityValue(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.SeverityValue Error { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.SeverityValue Information { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.SeverityValue Warning { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.SeverityValue 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.ResourceHealth.Models.SeverityValue left, Azure.ResourceManager.ResourceHealth.Models.SeverityValue right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.SeverityValue (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.SeverityValue left, Azure.ResourceManager.ResourceHealth.Models.SeverityValue right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct StageValue : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StageValue(string value) { throw null; } + public static Azure.ResourceManager.ResourceHealth.Models.StageValue Active { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.StageValue Archived { get { throw null; } } + public static Azure.ResourceManager.ResourceHealth.Models.StageValue Resolve { get { throw null; } } + public bool Equals(Azure.ResourceManager.ResourceHealth.Models.StageValue 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.ResourceHealth.Models.StageValue left, Azure.ResourceManager.ResourceHealth.Models.StageValue right) { throw null; } + public static implicit operator Azure.ResourceManager.ResourceHealth.Models.StageValue (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.ResourceHealth.Models.StageValue left, Azure.ResourceManager.ResourceHealth.Models.StageValue right) { throw null; } + public override string ToString() { throw null; } + } + public partial class StatusActiveEvent + { + internal StatusActiveEvent() { } + public string Cloud { get { throw null; } } + public string Description { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Impacts { get { throw null; } } + public System.DateTimeOffset? LastModifiedOn { get { throw null; } } + public bool? Published { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.SeverityValue? Severity { get { throw null; } } + public Azure.ResourceManager.ResourceHealth.Models.StageValue? Stage { get { throw null; } } + public System.DateTimeOffset? StartOn { get { throw null; } } + public string Title { get { throw null; } } + public string TrackingId { get { throw null; } } + } + public partial class StatusBanner + { + internal StatusBanner() { } + public string Cloud { get { throw null; } } + public System.DateTimeOffset? LastModifiedOn { get { throw null; } } + public string Message { get { throw null; } } + public string Title { get { throw null; } } + } + public partial class Update + { + internal Update() { } + public string Summary { get { throw null; } } + public System.DateTimeOffset? UpdateOn { get { throw null; } } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Azure.ResourceManager.ResourceHealth.Samples.csproj b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Azure.ResourceManager.ResourceHealth.Samples.csproj new file mode 100644 index 0000000000000..cb1db8173c3d7 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Azure.ResourceManager.ResourceHealth.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_AvailabilityStatusResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_AvailabilityStatusResource.cs new file mode 100644 index 0000000000000..29ad3bdc771cc --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_AvailabilityStatusResource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_AvailabilityStatusResource + { + // GetCurrentHealthByResource + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetCurrentHealthByResource() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/AvailabilityStatus_GetByResource.json + // this example is just showing the usage of "AvailabilityStatuses_GetByResource" 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 AvailabilityStatusResource created on azure + // for more information of creating AvailabilityStatusResource, please refer to the document of AvailabilityStatusResource + string resourceUri = "resourceUri"; + ResourceIdentifier availabilityStatusResourceId = AvailabilityStatusResource.CreateResourceIdentifier(resourceUri); + AvailabilityStatusResource availabilityStatus = client.GetAvailabilityStatusResource(availabilityStatusResourceId); + + // invoke the operation + string expand = "recommendedactions"; + AvailabilityStatusResource result = await availabilityStatus.GetAsync(expand: expand); + + // 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 + AvailabilityStatusData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_EmergingIssuesGetResultCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_EmergingIssuesGetResultCollection.cs new file mode 100644 index 0000000000000..985bbfa62f614 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_EmergingIssuesGetResultCollection.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_EmergingIssuesGetResultCollection + { + // GetEmergingIssues + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetEmergingIssues() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/EmergingIssues_List.json + // this example is just showing the usage of "EmergingIssues_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this EmergingIssuesGetResultResource + EmergingIssuesGetResultCollection collection = tenantResource.GetEmergingIssuesGetResults(); + + // invoke the operation and iterate over the result + await foreach (EmergingIssuesGetResultResource 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 + EmergingIssuesGetResultData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetEmergingIssues + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetEmergingIssues() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/EmergingIssues_Get.json + // this example is just showing the usage of "EmergingIssues_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this EmergingIssuesGetResultResource + EmergingIssuesGetResultCollection collection = tenantResource.GetEmergingIssuesGetResults(); + + // invoke the operation + IssueNameParameter issueName = IssueNameParameter.Default; + EmergingIssuesGetResultResource result = await collection.GetAsync(issueName); + + // 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 + EmergingIssuesGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetEmergingIssues + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetEmergingIssues() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/EmergingIssues_Get.json + // this example is just showing the usage of "EmergingIssues_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 TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this EmergingIssuesGetResultResource + EmergingIssuesGetResultCollection collection = tenantResource.GetEmergingIssuesGetResults(); + + // invoke the operation + IssueNameParameter issueName = IssueNameParameter.Default; + bool result = await collection.ExistsAsync(issueName); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_EmergingIssuesGetResultResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_EmergingIssuesGetResultResource.cs new file mode 100644 index 0000000000000..5c3e92f14ac35 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_EmergingIssuesGetResultResource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_EmergingIssuesGetResultResource + { + // GetEmergingIssues + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetEmergingIssues() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/EmergingIssues_Get.json + // this example is just showing the usage of "EmergingIssues_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 EmergingIssuesGetResultResource created on azure + // for more information of creating EmergingIssuesGetResultResource, please refer to the document of EmergingIssuesGetResultResource + IssueNameParameter issueName = IssueNameParameter.Default; + ResourceIdentifier emergingIssuesGetResultResourceId = EmergingIssuesGetResultResource.CreateResourceIdentifier(issueName); + EmergingIssuesGetResultResource emergingIssuesGetResult = client.GetEmergingIssuesGetResultResource(emergingIssuesGetResultResourceId); + + // invoke the operation + EmergingIssuesGetResultResource result = await emergingIssuesGetResult.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 + EmergingIssuesGetResultData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_MetadataEntityCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_MetadataEntityCollection.cs new file mode 100644 index 0000000000000..0bd5a3094611d --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_MetadataEntityCollection.cs @@ -0,0 +1,110 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_MetadataEntityCollection + { + // GetMetadata + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GetMetadata() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Metadata_List.json + // this example is just showing the usage of "Metadata_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this MetadataEntityResource + MetadataEntityCollection collection = tenantResource.GetMetadataEntities(); + + // invoke the operation and iterate over the result + await foreach (MetadataEntityResource 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 + MetadataEntityData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // GetMetadata + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetMetadata() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Metadata_GetEntity.json + // this example is just showing the usage of "Metadata_GetEntity" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this MetadataEntityResource + MetadataEntityCollection collection = tenantResource.GetMetadataEntities(); + + // invoke the operation + string name = "status"; + MetadataEntityResource result = await collection.GetAsync(name); + + // 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 + MetadataEntityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // GetMetadata + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetMetadata() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Metadata_GetEntity.json + // this example is just showing the usage of "Metadata_GetEntity" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this MetadataEntityResource + MetadataEntityCollection collection = tenantResource.GetMetadataEntities(); + + // invoke the operation + string name = "status"; + bool result = await collection.ExistsAsync(name); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_MetadataEntityResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_MetadataEntityResource.cs new file mode 100644 index 0000000000000..fb9ab311f8d39 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_MetadataEntityResource.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_MetadataEntityResource + { + // GetMetadata + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetMetadata() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Metadata_GetEntity.json + // this example is just showing the usage of "Metadata_GetEntity" 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 MetadataEntityResource created on azure + // for more information of creating MetadataEntityResource, please refer to the document of MetadataEntityResource + string name = "status"; + ResourceIdentifier metadataEntityResourceId = MetadataEntityResource.CreateResourceIdentifier(name); + MetadataEntityResource metadataEntity = client.GetMetadataEntityResource(metadataEntityResourceId); + + // invoke the operation + MetadataEntityResource result = await metadataEntity.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 + MetadataEntityData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionEventCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionEventCollection.cs new file mode 100644 index 0000000000000..c6ed5bc07343b --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionEventCollection.cs @@ -0,0 +1,123 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_SubscriptionEventCollection + { + // ListEventsBySubscriptionId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListEventsBySubscriptionId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Events_ListBySubscriptionId.json + // this example is just showing the usage of "Events_ListBySubscriptionId" 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 = "subscriptionId"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionEventResource + SubscriptionEventCollection collection = subscriptionResource.GetSubscriptionEvents(); + + // invoke the operation and iterate over the result + string filter = "service eq 'Virtual Machines' or region eq 'West US'"; + string queryStartTime = "7/24/2020"; + await foreach (SubscriptionEventResource item in collection.GetAllAsync(filter: filter, queryStartTime: queryStartTime)) + { + // 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 + EventData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // SecurityAdvisoriesEventBySubscriptionIdAndTrackingId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_GetBySubscriptionIdAndTrackingId.json + // this example is just showing the usage of "Event_GetBySubscriptionIdAndTrackingId" 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 = "subscriptionId"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionEventResource + SubscriptionEventCollection collection = subscriptionResource.GetSubscriptionEvents(); + + // invoke the operation + string eventTrackingId = "eventTrackingId"; + string filter = "properties/status eq 'Active'"; + string queryStartTime = "7/10/2022"; + SubscriptionEventResource result = await collection.GetAsync(eventTrackingId, filter: filter, queryStartTime: queryStartTime); + + // 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 + EventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // SecurityAdvisoriesEventBySubscriptionIdAndTrackingId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_GetBySubscriptionIdAndTrackingId.json + // this example is just showing the usage of "Event_GetBySubscriptionIdAndTrackingId" 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 = "subscriptionId"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this SubscriptionEventResource + SubscriptionEventCollection collection = subscriptionResource.GetSubscriptionEvents(); + + // invoke the operation + string eventTrackingId = "eventTrackingId"; + string filter = "properties/status eq 'Active'"; + string queryStartTime = "7/10/2022"; + bool result = await collection.ExistsAsync(eventTrackingId, filter: filter, queryStartTime: queryStartTime); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionEventResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionEventResource.cs new file mode 100644 index 0000000000000..a00ccde056a21 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionEventResource.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_SubscriptionEventResource + { + // ListSecurityAdvisoryImpactedResourcesBySubscriptionId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSecurityAdvisoryImpactedResourcesBySubscriptionIdAndEventId_ListSecurityAdvisoryImpactedResourcesBySubscriptionId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/SecurityAdvisoryImpactedResources_ListBySubscriptionId_ListByEventId.json + // this example is just showing the usage of "SecurityAdvisoryImpactedResources_ListBySubscriptionIdAndEventId" 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 SubscriptionEventResource created on azure + // for more information of creating SubscriptionEventResource, please refer to the document of SubscriptionEventResource + string subscriptionId = "subscriptionId"; + string eventTrackingId = "BC_1-FXZ"; + ResourceIdentifier subscriptionEventResourceId = SubscriptionEventResource.CreateResourceIdentifier(subscriptionId, eventTrackingId); + SubscriptionEventResource subscriptionEvent = client.GetSubscriptionEventResource(subscriptionEventResourceId); + + // invoke the operation and iterate over the result + await foreach (EventImpactedResourceData item in subscriptionEvent.GetSecurityAdvisoryImpactedResourcesBySubscriptionIdAndEventIdAsync()) + { + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {item.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // SecurityAdvisoriesEventBySubscriptionIdAndTrackingId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_SecurityAdvisoriesEventBySubscriptionIdAndTrackingId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_GetBySubscriptionIdAndTrackingId.json + // this example is just showing the usage of "Event_GetBySubscriptionIdAndTrackingId" 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 SubscriptionEventResource created on azure + // for more information of creating SubscriptionEventResource, please refer to the document of SubscriptionEventResource + string subscriptionId = "subscriptionId"; + string eventTrackingId = "eventTrackingId"; + ResourceIdentifier subscriptionEventResourceId = SubscriptionEventResource.CreateResourceIdentifier(subscriptionId, eventTrackingId); + SubscriptionEventResource subscriptionEvent = client.GetSubscriptionEventResource(subscriptionEventResourceId); + + // invoke the operation + string filter = "properties/status eq 'Active'"; + string queryStartTime = "7/10/2022"; + SubscriptionEventResource result = await subscriptionEvent.GetAsync(filter: filter, queryStartTime: queryStartTime); + + // 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 + EventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // EventDetailsBySubscriptionIdAndTrackingId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task FetchDetailsBySubscriptionIdAndTrackingId_EventDetailsBySubscriptionIdAndTrackingId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_fetchDetailsBySubscriptionIdAndTrackingId.json + // this example is just showing the usage of "Event_fetchDetailsBySubscriptionIdAndTrackingId" 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 SubscriptionEventResource created on azure + // for more information of creating SubscriptionEventResource, please refer to the document of SubscriptionEventResource + string subscriptionId = "subscriptionId"; + string eventTrackingId = "eventTrackingId"; + ResourceIdentifier subscriptionEventResourceId = SubscriptionEventResource.CreateResourceIdentifier(subscriptionId, eventTrackingId); + SubscriptionEventResource subscriptionEvent = client.GetSubscriptionEventResource(subscriptionEventResourceId); + + // invoke the operation + SubscriptionEventResource result = await subscriptionEvent.FetchDetailsBySubscriptionIdAndTrackingIdAsync(); + + // 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 + EventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionResourceHealthEventImpactedResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionResourceHealthEventImpactedResource.cs new file mode 100644 index 0000000000000..aeb46247a5059 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionResourceHealthEventImpactedResource.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; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_SubscriptionResourceHealthEventImpactedResource + { + // ImpactedResourcesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ImpactedResourcesGet() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_Get.json + // this example is just showing the usage of "ImpactedResources_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 SubscriptionResourceHealthEventImpactedResource created on azure + // for more information of creating SubscriptionResourceHealthEventImpactedResource, please refer to the document of SubscriptionResourceHealthEventImpactedResource + string subscriptionId = "subscriptionId"; + string eventTrackingId = "BC_1-FXZ"; + string impactedResourceName = "abc-123-ghj-456"; + ResourceIdentifier subscriptionResourceHealthEventImpactedResourceId = SubscriptionResourceHealthEventImpactedResource.CreateResourceIdentifier(subscriptionId, eventTrackingId, impactedResourceName); + SubscriptionResourceHealthEventImpactedResource subscriptionResourceHealthEventImpactedResource = client.GetSubscriptionResourceHealthEventImpactedResource(subscriptionResourceHealthEventImpactedResourceId); + + // invoke the operation + SubscriptionResourceHealthEventImpactedResource result = await subscriptionResourceHealthEventImpactedResource.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 + EventImpactedResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionResourceHealthEventImpactedResourceCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionResourceHealthEventImpactedResourceCollection.cs new file mode 100644 index 0000000000000..f01f241efee09 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_SubscriptionResourceHealthEventImpactedResourceCollection.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_SubscriptionResourceHealthEventImpactedResourceCollection + { + // ListImpactedResourcesBySubscriptionId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListImpactedResourcesBySubscriptionId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_ListBySubscriptionId_ListByEventId.json + // this example is just showing the usage of "ImpactedResources_ListBySubscriptionIdAndEventId" 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 SubscriptionEventResource created on azure + // for more information of creating SubscriptionEventResource, please refer to the document of SubscriptionEventResource + string subscriptionId = "subscriptionId"; + string eventTrackingId = "BC_1-FXZ"; + ResourceIdentifier subscriptionEventResourceId = SubscriptionEventResource.CreateResourceIdentifier(subscriptionId, eventTrackingId); + SubscriptionEventResource subscriptionEvent = client.GetSubscriptionEventResource(subscriptionEventResourceId); + + // get the collection of this SubscriptionResourceHealthEventImpactedResource + SubscriptionResourceHealthEventImpactedResourceCollection collection = subscriptionEvent.GetSubscriptionResourceHealthEventImpactedResources(); + + // invoke the operation and iterate over the result + string filter = "targetRegion eq 'westus'"; + await foreach (SubscriptionResourceHealthEventImpactedResource item in collection.GetAllAsync(filter: filter)) + { + // 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 + EventImpactedResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ImpactedResourcesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ImpactedResourcesGet() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_Get.json + // this example is just showing the usage of "ImpactedResources_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 SubscriptionEventResource created on azure + // for more information of creating SubscriptionEventResource, please refer to the document of SubscriptionEventResource + string subscriptionId = "subscriptionId"; + string eventTrackingId = "BC_1-FXZ"; + ResourceIdentifier subscriptionEventResourceId = SubscriptionEventResource.CreateResourceIdentifier(subscriptionId, eventTrackingId); + SubscriptionEventResource subscriptionEvent = client.GetSubscriptionEventResource(subscriptionEventResourceId); + + // get the collection of this SubscriptionResourceHealthEventImpactedResource + SubscriptionResourceHealthEventImpactedResourceCollection collection = subscriptionEvent.GetSubscriptionResourceHealthEventImpactedResources(); + + // invoke the operation + string impactedResourceName = "abc-123-ghj-456"; + SubscriptionResourceHealthEventImpactedResource result = await collection.GetAsync(impactedResourceName); + + // 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 + EventImpactedResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ImpactedResourcesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ImpactedResourcesGet() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_Get.json + // this example is just showing the usage of "ImpactedResources_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 SubscriptionEventResource created on azure + // for more information of creating SubscriptionEventResource, please refer to the document of SubscriptionEventResource + string subscriptionId = "subscriptionId"; + string eventTrackingId = "BC_1-FXZ"; + ResourceIdentifier subscriptionEventResourceId = SubscriptionEventResource.CreateResourceIdentifier(subscriptionId, eventTrackingId); + SubscriptionEventResource subscriptionEvent = client.GetSubscriptionEventResource(subscriptionEventResourceId); + + // get the collection of this SubscriptionResourceHealthEventImpactedResource + SubscriptionResourceHealthEventImpactedResourceCollection collection = subscriptionEvent.GetSubscriptionResourceHealthEventImpactedResources(); + + // invoke the operation + string impactedResourceName = "abc-123-ghj-456"; + bool result = await collection.ExistsAsync(impactedResourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantEventCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantEventCollection.cs new file mode 100644 index 0000000000000..2e6ea7248af8f --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantEventCollection.cs @@ -0,0 +1,116 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_TenantEventCollection + { + // ListEventsByTenantId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListEventsByTenantId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Events_ListByTenantId.json + // this example is just showing the usage of "Events_ListByTenantId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this TenantEventResource + TenantEventCollection collection = tenantResource.GetTenantEvents(); + + // invoke the operation and iterate over the result + string filter = "service eq 'Virtual Machines' or region eq 'West US'"; + string queryStartTime = "7/24/2020"; + await foreach (TenantEventResource item in collection.GetAllAsync(filter: filter, queryStartTime: queryStartTime)) + { + // 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 + EventData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // EventByTenantIdAndTrackingId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_EventByTenantIdAndTrackingId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_GetByTenantIdAndTrackingId.json + // this example is just showing the usage of "Event_GetByTenantIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this TenantEventResource + TenantEventCollection collection = tenantResource.GetTenantEvents(); + + // invoke the operation + string eventTrackingId = "eventTrackingId"; + string filter = "properties/status eq 'Active'"; + string queryStartTime = "7/10/2022"; + TenantEventResource result = await collection.GetAsync(eventTrackingId, filter: filter, queryStartTime: queryStartTime); + + // 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 + EventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // EventByTenantIdAndTrackingId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_EventByTenantIdAndTrackingId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_GetByTenantIdAndTrackingId.json + // this example is just showing the usage of "Event_GetByTenantIdAndTrackingId" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this TenantResource created on azure + // for more information of creating TenantResource, please refer to the document of TenantResource + var tenantResource = client.GetTenants().GetAllAsync().GetAsyncEnumerator().Current; + + // get the collection of this TenantEventResource + TenantEventCollection collection = tenantResource.GetTenantEvents(); + + // invoke the operation + string eventTrackingId = "eventTrackingId"; + string filter = "properties/status eq 'Active'"; + string queryStartTime = "7/10/2022"; + bool result = await collection.ExistsAsync(eventTrackingId, filter: filter, queryStartTime: queryStartTime); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantEventResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantEventResource.cs new file mode 100644 index 0000000000000..f827f040d0a11 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantEventResource.cs @@ -0,0 +1,108 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_TenantEventResource + { + // ListSecurityAdvisoryImpactedResourcesByTenantId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetSecurityAdvisoryImpactedResourcesByTenantIdAndEventId_ListSecurityAdvisoryImpactedResourcesByTenantId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/SecurityAdvisoryImpactedResources_ListByTenantId_ListByEventId.json + // this example is just showing the usage of "SecurityAdvisoryImpactedResources_ListByTenantIdAndEventId" 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 TenantEventResource created on azure + // for more information of creating TenantEventResource, please refer to the document of TenantEventResource + string eventTrackingId = "BC_1-FXZ"; + ResourceIdentifier tenantEventResourceId = TenantEventResource.CreateResourceIdentifier(eventTrackingId); + TenantEventResource tenantEvent = client.GetTenantEventResource(tenantEventResourceId); + + // invoke the operation and iterate over the result + await foreach (EventImpactedResourceData item in tenantEvent.GetSecurityAdvisoryImpactedResourcesByTenantIdAndEventIdAsync()) + { + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {item.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // EventByTenantIdAndTrackingId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_EventByTenantIdAndTrackingId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_GetByTenantIdAndTrackingId.json + // this example is just showing the usage of "Event_GetByTenantIdAndTrackingId" 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 TenantEventResource created on azure + // for more information of creating TenantEventResource, please refer to the document of TenantEventResource + string eventTrackingId = "eventTrackingId"; + ResourceIdentifier tenantEventResourceId = TenantEventResource.CreateResourceIdentifier(eventTrackingId); + TenantEventResource tenantEvent = client.GetTenantEventResource(tenantEventResourceId); + + // invoke the operation + string filter = "properties/status eq 'Active'"; + string queryStartTime = "7/10/2022"; + TenantEventResource result = await tenantEvent.GetAsync(filter: filter, queryStartTime: queryStartTime); + + // 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 + EventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // EventDetailsByTenantIdAndTrackingId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task FetchDetailsByTenantIdAndTrackingId_EventDetailsByTenantIdAndTrackingId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/Event_fetchDetailsByTenantIdAndTrackingId.json + // this example is just showing the usage of "Event_fetchDetailsByTenantIdAndTrackingId" 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 TenantEventResource created on azure + // for more information of creating TenantEventResource, please refer to the document of TenantEventResource + string eventTrackingId = "eventTrackingId"; + ResourceIdentifier tenantEventResourceId = TenantEventResource.CreateResourceIdentifier(eventTrackingId); + TenantEventResource tenantEvent = client.GetTenantEventResource(tenantEventResourceId); + + // invoke the operation + TenantEventResource result = await tenantEvent.FetchDetailsByTenantIdAndTrackingIdAsync(); + + // 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 + EventData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResource.cs new file mode 100644 index 0000000000000..97aeb838dca57 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResource.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_TenantResourceHealthEventImpactedResource + { + // ImpactedResourcesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ImpactedResourcesGet() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_GetByTenantId.json + // this example is just showing the usage of "ImpactedResources_GetByTenantId" 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 TenantResourceHealthEventImpactedResource created on azure + // for more information of creating TenantResourceHealthEventImpactedResource, please refer to the document of TenantResourceHealthEventImpactedResource + string eventTrackingId = "BC_1-FXZ"; + string impactedResourceName = "abc-123-ghj-456"; + ResourceIdentifier tenantResourceHealthEventImpactedResourceId = TenantResourceHealthEventImpactedResource.CreateResourceIdentifier(eventTrackingId, impactedResourceName); + TenantResourceHealthEventImpactedResource tenantResourceHealthEventImpactedResource = client.GetTenantResourceHealthEventImpactedResource(tenantResourceHealthEventImpactedResourceId); + + // invoke the operation + TenantResourceHealthEventImpactedResource result = await tenantResourceHealthEventImpactedResource.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 + EventImpactedResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs new file mode 100644 index 0000000000000..5706aa523f8fe --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/Generated/Samples/Sample_TenantResourceHealthEventImpactedResourceCollection.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Samples +{ + public partial class Sample_TenantResourceHealthEventImpactedResourceCollection + { + // ListEventsByTenantId + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListEventsByTenantId() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_ListByTenantId_ListByEventId.json + // this example is just showing the usage of "ImpactedResources_ListByTenantIdAndEventId" 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 TenantEventResource created on azure + // for more information of creating TenantEventResource, please refer to the document of TenantEventResource + string eventTrackingId = "BC_1-FXZ"; + ResourceIdentifier tenantEventResourceId = TenantEventResource.CreateResourceIdentifier(eventTrackingId); + TenantEventResource tenantEvent = client.GetTenantEventResource(tenantEventResourceId); + + // get the collection of this TenantResourceHealthEventImpactedResource + TenantResourceHealthEventImpactedResourceCollection collection = tenantEvent.GetTenantResourceHealthEventImpactedResources(); + + // invoke the operation and iterate over the result + string filter = "targetRegion eq 'westus'"; + await foreach (TenantResourceHealthEventImpactedResource item in collection.GetAllAsync(filter: filter)) + { + // 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 + EventImpactedResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ImpactedResourcesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ImpactedResourcesGet() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_GetByTenantId.json + // this example is just showing the usage of "ImpactedResources_GetByTenantId" 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 TenantEventResource created on azure + // for more information of creating TenantEventResource, please refer to the document of TenantEventResource + string eventTrackingId = "BC_1-FXZ"; + ResourceIdentifier tenantEventResourceId = TenantEventResource.CreateResourceIdentifier(eventTrackingId); + TenantEventResource tenantEvent = client.GetTenantEventResource(tenantEventResourceId); + + // get the collection of this TenantResourceHealthEventImpactedResource + TenantResourceHealthEventImpactedResourceCollection collection = tenantEvent.GetTenantResourceHealthEventImpactedResources(); + + // invoke the operation + string impactedResourceName = "abc-123-ghj-456"; + TenantResourceHealthEventImpactedResource result = await collection.GetAsync(impactedResourceName); + + // 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 + EventImpactedResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ImpactedResourcesGet + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ImpactedResourcesGet() + { + // Generated from example definition: specification/resourcehealth/resource-manager/Microsoft.ResourceHealth/preview/2022-10-01-preview/examples/ImpactedResources_GetByTenantId.json + // this example is just showing the usage of "ImpactedResources_GetByTenantId" 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 TenantEventResource created on azure + // for more information of creating TenantEventResource, please refer to the document of TenantEventResource + string eventTrackingId = "BC_1-FXZ"; + ResourceIdentifier tenantEventResourceId = TenantEventResource.CreateResourceIdentifier(eventTrackingId); + TenantEventResource tenantEvent = client.GetTenantEventResource(tenantEventResourceId); + + // get the collection of this TenantResourceHealthEventImpactedResource + TenantResourceHealthEventImpactedResourceCollection collection = tenantEvent.GetTenantResourceHealthEventImpactedResources(); + + // invoke the operation + string impactedResourceName = "abc-123-ghj-456"; + bool result = await collection.ExistsAsync(impactedResourceName); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/autorest.tests.md b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/autorest.tests.md new file mode 100644 index 0000000000000..55332ed40ff8e --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/samples/autorest.tests.md @@ -0,0 +1,13 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateTests` to generate code. + +# Azure.ResourceManager.ResourceHealth.Tests + +> see https://aka.ms/autorest +``` yaml +require: ../src/autorest.md +include-x-ms-examples-original-file: true +testgen: + sample: true +``` \ No newline at end of file diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Azure.ResourceManager.ResourceHealth.csproj b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Azure.ResourceManager.ResourceHealth.csproj new file mode 100644 index 0000000000000..d76cc12ab41a1 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Azure.ResourceManager.ResourceHealth.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.ResourceHealth + Azure Resource Manager client SDK for Azure resource provider ResourceHealth. + azure;management;arm;resource manager;resourcehealth + + diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ArmResourceHealthModelFactory.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ArmResourceHealthModelFactory.cs new file mode 100644 index 0000000000000..e45d4334aa529 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ArmResourceHealthModelFactory.cs @@ -0,0 +1,361 @@ +// 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.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Model factory for models. + public static partial class ArmResourceHealthModelFactory + { + /// Initializes a new instance of AvailabilityStatusData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Azure Resource Manager geo location of the resource. + /// Properties of availability state. + /// A new instance for mocking. + public static AvailabilityStatusData AvailabilityStatusData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, AvailabilityStatusProperties properties = null) + { + return new AvailabilityStatusData(id, name, resourceType, systemData, location, properties); + } + + /// Initializes a new instance of AvailabilityStatusProperties. + /// Availability status of the resource. When it is null, this availabilityStatus object represents an availability impacting event. + /// Title description of the availability status. + /// Summary description of the availability status. + /// Details of the availability status. + /// When the resource's availabilityState is Unavailable, it describes where the health impacting event was originated. Examples are planned, unplanned, user initiated or an outage etc. + /// When an event is created, it can either be triggered by a customer or the platform of the resource and this field will illustrate that. This field is connected to the category field in this object. + /// When a context field is set to Platform, this field will reflect if the event was planned or unplanned. If the context field does not have a value of Platform, then this field will be ignored. + /// When the resource's availabilityState is Unavailable, it provides the Timestamp for when the health impacting event was received. + /// In case of an availability impacting event, it describes when the health impacting event was originated. Examples are Lifecycle, Downtime, Fault Analysis etc. + /// In case of an availability impacting event, it describes where the health impacting event was originated. Examples are PlatformInitiated, UserInitiated etc. + /// In case of an availability impacting event, it describes the category of a PlatformInitiated health impacting event. Examples are Planned, Unplanned etc. + /// It is a unique Id that identifies the event. + /// When the resource's availabilityState is Unavailable and the reasonType is not User Initiated, it provides the date and time for when the issue is expected to be resolved. + /// Timestamp for when last change in health status occurred. + /// Chronicity of the availability transition. + /// Timestamp for when the health was last checked. + /// An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned. + /// Lists actions the user can take based on the current availabilityState of the resource. + /// Lists the service impacting events that may be affecting the health of the resource. + /// A new instance for mocking. + public static AvailabilityStatusProperties AvailabilityStatusProperties(AvailabilityStateValue? availabilityState = null, string title = null, string summary = null, string detailedStatus = null, string reasonType = null, string context = null, string category = null, DateTimeOffset? rootCauseAttributionOn = null, string healthEventType = null, string healthEventCause = null, string healthEventCategory = null, string healthEventId = null, DateTimeOffset? resolutionETA = null, DateTimeOffset? occuredOn = null, ReasonChronicityType? reasonChronicity = null, DateTimeOffset? reportedOn = null, AvailabilityStatusPropertiesRecentlyResolved recentlyResolved = null, IEnumerable recommendedActions = null, IEnumerable serviceImpactingEvents = null) + { + recommendedActions ??= new List(); + serviceImpactingEvents ??= new List(); + + return new AvailabilityStatusProperties(availabilityState, title, summary, detailedStatus, reasonType, context, category, rootCauseAttributionOn, healthEventType, healthEventCause, healthEventCategory, healthEventId, resolutionETA, occuredOn, reasonChronicity, reportedOn, recentlyResolved, recommendedActions?.ToList(), serviceImpactingEvents?.ToList()); + } + + /// Initializes a new instance of AvailabilityStatusPropertiesRecentlyResolved. + /// Timestamp for when the availabilityState changed to Unavailable. + /// Timestamp when the availabilityState changes to Available. + /// Brief description of cause of the resource becoming unavailable. + /// A new instance for mocking. + public static AvailabilityStatusPropertiesRecentlyResolved AvailabilityStatusPropertiesRecentlyResolved(DateTimeOffset? unavailableOccuredOn = null, DateTimeOffset? resolvedOn = null, string unavailableSummary = null) + { + return new AvailabilityStatusPropertiesRecentlyResolved(unavailableOccuredOn, resolvedOn, unavailableSummary); + } + + /// Initializes a new instance of RecommendedAction. + /// Recommended action. + /// Link to the action. + /// Substring of action, it describes which text should host the action url. + /// A new instance for mocking. + public static RecommendedAction RecommendedAction(string action = null, Uri actionUri = null, string actionUrlText = null) + { + return new RecommendedAction(action, actionUri, actionUrlText); + } + + /// Initializes a new instance of ServiceImpactingEvent. + /// Timestamp for when the event started. + /// Timestamp for when event was submitted/detected. + /// Correlation id for the event. + /// Status of the service impacting event. + /// Properties of the service impacting event. + /// A new instance for mocking. + public static ServiceImpactingEvent ServiceImpactingEvent(DateTimeOffset? eventStartOn = null, DateTimeOffset? eventStatusLastModifiedOn = null, string correlationId = null, string statusValue = null, ServiceImpactingEventIncidentProperties incidentProperties = null) + { + return new ServiceImpactingEvent(eventStartOn, eventStatusLastModifiedOn, correlationId, statusValue != null ? new ServiceImpactingEventStatus(statusValue) : null, incidentProperties); + } + + /// Initializes a new instance of ServiceImpactingEventIncidentProperties. + /// Title of the incident. + /// Service impacted by the event. + /// Region impacted by the event. + /// Type of Event. + /// A new instance for mocking. + public static ServiceImpactingEventIncidentProperties ServiceImpactingEventIncidentProperties(string title = null, string service = null, string region = null, string incidentType = null) + { + return new ServiceImpactingEventIncidentProperties(title, service, region, incidentType); + } + + /// Initializes a new instance of MetadataEntityData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The display name. + /// The list of keys on which this entity depends on. + /// The list of scenarios applicable to this metadata entity. + /// The list of supported values. + /// A new instance for mocking. + public static MetadataEntityData MetadataEntityData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string displayName = null, IEnumerable dependsOn = null, IEnumerable applicableScenarios = null, IEnumerable supportedValues = null) + { + dependsOn ??= new List(); + applicableScenarios ??= new List(); + supportedValues ??= new List(); + + return new MetadataEntityData(id, name, resourceType, systemData, displayName, dependsOn?.ToList(), applicableScenarios?.ToList(), supportedValues?.ToList()); + } + + /// Initializes a new instance of MetadataSupportedValueDetail. + /// The id. + /// The display name. + /// The list of associated resource types. + /// A new instance for mocking. + public static MetadataSupportedValueDetail MetadataSupportedValueDetail(string id = null, string displayName = null, IEnumerable resourceTypes = null) + { + resourceTypes ??= new List(); + + return new MetadataSupportedValueDetail(id, displayName, resourceTypes?.ToList()); + } + + /// Initializes a new instance of EventImpactedResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource type within Microsoft cloud. + /// Identity for resource within Microsoft cloud. + /// Impacted resource region name. + /// Additional information. + /// A new instance for mocking. + public static EventImpactedResourceData EventImpactedResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, string targetResourceType = null, string targetResourceId = null, string targetRegion = null, IEnumerable info = null) + { + info ??= new List(); + + return new EventImpactedResourceData(id, name, resourceType, systemData, targetResourceType, targetResourceId, targetRegion, info?.ToList()); + } + + /// Initializes a new instance of KeyValueItem. + /// Key of tuple. + /// Value of tuple. + /// A new instance for mocking. + public static KeyValueItem KeyValueItem(string key = null, string value = null) + { + return new KeyValueItem(key, value); + } + + /// Initializes a new instance of EventData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Type of event. + /// Source of event. + /// Current status of event. + /// Title text of event. + /// Summary text of event. + /// Header text of event. + /// Level of insight. + /// Level of event. + /// The id of the Incident. + /// Article of event. + /// Useful links of event. + /// It provides the Timestamp for when the health impacting event started. + /// It provides the Timestamp for when the health impacting event resolved. + /// List services impacted by the service health event. + /// Recommended actions of event. + /// Frequently asked questions for the service health event. + /// It provides information if the event is High incident rate event or not. + /// Tells if we want to enable or disable Microsoft Support for this event. + /// Contains the communication message for the event, that could include summary, root cause and other details. + /// Is true if the event is platform initiated. + /// Tells if we want to enable or disable Microsoft Support for this event. + /// Priority level of the event. Has value from 0 to 23. 0 is the highest priority. Service issue events have higher priority followed by planned maintenance and health advisory. Critical events have higher priority followed by error, warning and informational. Furthermore, active events have higher priority than resolved. + /// It provides the Timestamp for when the health impacting event was last updated. + /// Stage for HIR Document. + /// Additional information. + /// duration in seconds. + /// The type of the impact. + /// A new instance for mocking. + public static EventData EventData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, EventTypeValue? eventType = null, EventSourceValue? eventSource = null, EventStatusValue? status = null, string title = null, string summary = null, string header = null, LevelValue? level = null, EventLevelValue? eventLevel = null, string externalIncidentId = null, string articleContent = null, IEnumerable links = null, DateTimeOffset? impactStartOn = null, DateTimeOffset? impactMitigationOn = null, IEnumerable impact = null, EventPropertiesRecommendedActions recommendedActions = null, IEnumerable faqs = null, bool? isHIR = null, bool? enableMicrosoftSupport = null, string description = null, bool? platformInitiated = null, bool? enableChatWithUs = null, int? priority = null, DateTimeOffset? lastUpdateOn = null, string hirStage = null, string additionalInformationMessage = null, int? duration = null, string impactType = null) + { + links ??= new List(); + impact ??= new List(); + faqs ??= new List(); + + return new EventData(id, name, resourceType, systemData, eventType, eventSource, status, title, summary, header, level, eventLevel, externalIncidentId, articleContent != null ? new EventPropertiesArticle(articleContent) : null, links?.ToList(), impactStartOn, impactMitigationOn, impact?.ToList(), recommendedActions, faqs?.ToList(), isHIR, enableMicrosoftSupport, description, platformInitiated, enableChatWithUs, priority, lastUpdateOn, hirStage, additionalInformationMessage != null ? new EventPropertiesAdditionalInformation(additionalInformationMessage) : null, duration, impactType); + } + + /// Initializes a new instance of Link. + /// Type of link. + /// Display text of link. + /// It provides the name of portal extension to produce link for given service health event. + /// It provides the name of portal extension blade to produce link for given service health event. + /// It provides a map of parameter name and value for portal extension blade to produce lik for given service health event. + /// A new instance for mocking. + public static Link Link(LinkTypeValue? linkType = null, LinkDisplayText displayText = null, string extensionName = null, string bladeName = null, BinaryData parameters = null) + { + return new Link(linkType, displayText, extensionName, bladeName, parameters); + } + + /// Initializes a new instance of LinkDisplayText. + /// Display text of link. + /// Localized display text of link. + /// A new instance for mocking. + public static LinkDisplayText LinkDisplayText(string value = null, string localizedValue = null) + { + return new LinkDisplayText(value, localizedValue); + } + + /// Initializes a new instance of Impact. + /// Impacted service name. + /// List regions impacted by the service health event. + /// A new instance for mocking. + public static Impact Impact(string impactedService = null, IEnumerable impactedRegions = null) + { + impactedRegions ??= new List(); + + return new Impact(impactedService, impactedRegions?.ToList()); + } + + /// Initializes a new instance of ImpactedServiceRegion. + /// Impacted region name. + /// Current status of event in the region. + /// List subscription impacted by the service health event. + /// List tenant impacted by the service health event. + /// It provides the Timestamp for when the last update for the service health event. + /// List of updates for given service health event. + /// A new instance for mocking. + public static ImpactedServiceRegion ImpactedServiceRegion(string impactedRegion = null, EventStatusValue? status = null, IEnumerable impactedSubscriptions = null, IEnumerable impactedTenants = null, DateTimeOffset? lastUpdateOn = null, IEnumerable updates = null) + { + impactedSubscriptions ??= new List(); + impactedTenants ??= new List(); + updates ??= new List(); + + return new ImpactedServiceRegion(impactedRegion, status, impactedSubscriptions?.ToList(), impactedTenants?.ToList(), lastUpdateOn, updates?.ToList()); + } + + /// Initializes a new instance of Update. + /// Summary text for the given update for the service health event. + /// It provides the Timestamp for the given update for the service health event. + /// A new instance for mocking. + public static Update Update(string summary = null, DateTimeOffset? updateOn = null) + { + return new Update(summary, updateOn); + } + + /// Initializes a new instance of EventPropertiesRecommendedActions. + /// Recommended action title for the service health event. + /// Recommended actions for the service health event. + /// Recommended action locale for the service health event. + /// A new instance for mocking. + public static EventPropertiesRecommendedActions EventPropertiesRecommendedActions(string message = null, IEnumerable actions = null, string localeCode = null) + { + actions ??= new List(); + + return new EventPropertiesRecommendedActions(message, actions?.ToList(), localeCode); + } + + /// Initializes a new instance of EventPropertiesRecommendedActionsItem. + /// Recommended action group Id for the service health event. + /// Recommended action text. + /// A new instance for mocking. + public static EventPropertiesRecommendedActionsItem EventPropertiesRecommendedActionsItem(int? groupId = null, string actionText = null) + { + return new EventPropertiesRecommendedActionsItem(groupId, actionText); + } + + /// Initializes a new instance of Faq. + /// FAQ question for the service health event. + /// FAQ answer for the service health event. + /// FAQ locale for the service health event. + /// A new instance for mocking. + public static Faq Faq(string question = null, string answer = null, string localeCode = null) + { + return new Faq(question, answer, localeCode); + } + + /// Initializes a new instance of EmergingIssuesGetResultData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Timestamp for when last time refreshed for ongoing emerging issue. + /// The list of emerging issues of banner type. + /// The list of emerging issues of active event type. + /// A new instance for mocking. + public static EmergingIssuesGetResultData EmergingIssuesGetResultData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, DateTimeOffset? refreshTimestamp = null, IEnumerable statusBanners = null, IEnumerable statusActiveEvents = null) + { + statusBanners ??= new List(); + statusActiveEvents ??= new List(); + + return new EmergingIssuesGetResultData(id, name, resourceType, systemData, refreshTimestamp, statusBanners?.ToList(), statusActiveEvents?.ToList()); + } + + /// Initializes a new instance of StatusBanner. + /// The banner title. + /// The details of banner. + /// The cloud type of this banner. + /// The last time modified on this banner. + /// A new instance for mocking. + public static StatusBanner StatusBanner(string title = null, string message = null, string cloud = null, DateTimeOffset? lastModifiedOn = null) + { + return new StatusBanner(title, message, cloud, lastModifiedOn); + } + + /// Initializes a new instance of StatusActiveEvent. + /// The active event title. + /// The details of active event. + /// The tracking id of this active event. + /// The impact start time on this active event. + /// The cloud type of this active event. + /// The severity level of this active event. + /// The stage of this active event. + /// The boolean value of this active event if published or not. + /// The last time modified on this banner. + /// The list of emerging issues impacts. + /// A new instance for mocking. + public static StatusActiveEvent StatusActiveEvent(string title = null, string description = null, string trackingId = null, DateTimeOffset? startOn = null, string cloud = null, SeverityValue? severity = null, StageValue? stage = null, bool? published = null, DateTimeOffset? lastModifiedOn = null, IEnumerable impacts = null) + { + impacts ??= new List(); + + return new StatusActiveEvent(title, description, trackingId, startOn, cloud, severity, stage, published, lastModifiedOn, impacts?.ToList()); + } + + /// Initializes a new instance of EmergingIssueImpact. + /// The impacted service id. + /// The impacted service name. + /// The list of impacted regions for corresponding emerging issues. + /// A new instance for mocking. + public static EmergingIssueImpact EmergingIssueImpact(string id = null, string name = null, IEnumerable regions = null) + { + regions ??= new List(); + + return new EmergingIssueImpact(id, name, regions?.ToList()); + } + + /// Initializes a new instance of ImpactedRegion. + /// The impacted region id. + /// The impacted region name. + /// A new instance for mocking. + public static ImpactedRegion ImpactedRegion(string id = null, string name = null) + { + return new ImpactedRegion(id, name); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/AvailabilityStatusData.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/AvailabilityStatusData.cs new file mode 100644 index 0000000000000..fe0de1f6d6186 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/AvailabilityStatusData.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// A class representing the AvailabilityStatus data model. + public partial class AvailabilityStatusData : ResourceData + { + /// Initializes a new instance of AvailabilityStatusData. + internal AvailabilityStatusData() + { + } + + /// Initializes a new instance of AvailabilityStatusData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Azure Resource Manager geo location of the resource. + /// Properties of availability state. + internal AvailabilityStatusData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, AvailabilityStatusProperties properties) : base(id, name, resourceType, systemData) + { + Location = location; + Properties = properties; + } + + /// Azure Resource Manager geo location of the resource. + public AzureLocation? Location { get; } + /// Properties of availability state. + public AvailabilityStatusProperties Properties { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/AvailabilityStatusResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/AvailabilityStatusResource.cs new file mode 100644 index 0000000000000..1161e755cbb75 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/AvailabilityStatusResource.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A Class representing an AvailabilityStatus 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 GetAvailabilityStatusResource method. + /// Otherwise you can get one from its parent resource using the GetAvailabilityStatus method. + /// + public partial class AvailabilityStatusResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string resourceUri) + { + var resourceId = $"{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _availabilityStatusClientDiagnostics; + private readonly AvailabilityStatusesRestOperations _availabilityStatusRestClient; + private readonly AvailabilityStatusData _data; + + /// Initializes a new instance of the class for mocking. + protected AvailabilityStatusResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal AvailabilityStatusResource(ArmClient client, AvailabilityStatusData 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 AvailabilityStatusResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _availabilityStatusClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string availabilityStatusApiVersion); + _availabilityStatusRestClient = new AvailabilityStatusesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, availabilityStatusApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ResourceHealth/availabilityStatuses"; + + /// 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 AvailabilityStatusData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets current availability status for a single resource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current + /// + /// + /// Operation Id + /// AvailabilityStatuses_GetByResource + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + public virtual async Task> GetAsync(string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _availabilityStatusClientDiagnostics.CreateScope("AvailabilityStatusResource.Get"); + scope.Start(); + try + { + var response = await _availabilityStatusRestClient.GetByResourceAsync(Id.Parent, filter, expand, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AvailabilityStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets current availability status for a single resource + /// + /// + /// Request Path + /// /{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current + /// + /// + /// Operation Id + /// AvailabilityStatuses_GetByResource + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + public virtual Response Get(string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + using var scope = _availabilityStatusClientDiagnostics.CreateScope("AvailabilityStatusResource.Get"); + scope.Start(); + try + { + var response = _availabilityStatusRestClient.GetByResource(Id.Parent, filter, expand, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new AvailabilityStatusResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EmergingIssuesGetResultCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EmergingIssuesGetResultCollection.cs new file mode 100644 index 0000000000000..81da147cb20a4 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EmergingIssuesGetResultCollection.cs @@ -0,0 +1,244 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// 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 GetEmergingIssuesGetResults method from an instance of . + /// + public partial class EmergingIssuesGetResultCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _emergingIssuesGetResultEmergingIssuesClientDiagnostics; + private readonly EmergingIssuesRestOperations _emergingIssuesGetResultEmergingIssuesRestClient; + + /// Initializes a new instance of the class for mocking. + protected EmergingIssuesGetResultCollection() + { + } + + /// 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 EmergingIssuesGetResultCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _emergingIssuesGetResultEmergingIssuesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", EmergingIssuesGetResultResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(EmergingIssuesGetResultResource.ResourceType, out string emergingIssuesGetResultEmergingIssuesApiVersion); + _emergingIssuesGetResultEmergingIssuesRestClient = new EmergingIssuesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, emergingIssuesGetResultEmergingIssuesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != TenantResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, TenantResource.ResourceType), nameof(id)); + } + + /// + /// Gets Azure services' emerging issues. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The name of the emerging issue. + /// The cancellation token to use. + public virtual async Task> GetAsync(IssueNameParameter issueName, CancellationToken cancellationToken = default) + { + using var scope = _emergingIssuesGetResultEmergingIssuesClientDiagnostics.CreateScope("EmergingIssuesGetResultCollection.Get"); + scope.Start(); + try + { + var response = await _emergingIssuesGetResultEmergingIssuesRestClient.GetAsync(issueName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EmergingIssuesGetResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets Azure services' emerging issues. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The name of the emerging issue. + /// The cancellation token to use. + public virtual Response Get(IssueNameParameter issueName, CancellationToken cancellationToken = default) + { + using var scope = _emergingIssuesGetResultEmergingIssuesClientDiagnostics.CreateScope("EmergingIssuesGetResultCollection.Get"); + scope.Start(); + try + { + var response = _emergingIssuesGetResultEmergingIssuesRestClient.Get(issueName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EmergingIssuesGetResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists Azure services' emerging issues. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues + /// + /// + /// Operation Id + /// EmergingIssues_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _emergingIssuesGetResultEmergingIssuesRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _emergingIssuesGetResultEmergingIssuesRestClient.CreateListNextPageRequest(nextLink); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new EmergingIssuesGetResultResource(Client, EmergingIssuesGetResultData.DeserializeEmergingIssuesGetResultData(e)), _emergingIssuesGetResultEmergingIssuesClientDiagnostics, Pipeline, "EmergingIssuesGetResultCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists Azure services' emerging issues. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues + /// + /// + /// Operation Id + /// EmergingIssues_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _emergingIssuesGetResultEmergingIssuesRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _emergingIssuesGetResultEmergingIssuesRestClient.CreateListNextPageRequest(nextLink); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new EmergingIssuesGetResultResource(Client, EmergingIssuesGetResultData.DeserializeEmergingIssuesGetResultData(e)), _emergingIssuesGetResultEmergingIssuesClientDiagnostics, Pipeline, "EmergingIssuesGetResultCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The name of the emerging issue. + /// The cancellation token to use. + public virtual async Task> ExistsAsync(IssueNameParameter issueName, CancellationToken cancellationToken = default) + { + using var scope = _emergingIssuesGetResultEmergingIssuesClientDiagnostics.CreateScope("EmergingIssuesGetResultCollection.Exists"); + scope.Start(); + try + { + var response = await _emergingIssuesGetResultEmergingIssuesRestClient.GetAsync(issueName, 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 + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The name of the emerging issue. + /// The cancellation token to use. + public virtual Response Exists(IssueNameParameter issueName, CancellationToken cancellationToken = default) + { + using var scope = _emergingIssuesGetResultEmergingIssuesClientDiagnostics.CreateScope("EmergingIssuesGetResultCollection.Exists"); + scope.Start(); + try + { + var response = _emergingIssuesGetResultEmergingIssuesRestClient.Get(issueName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EmergingIssuesGetResultData.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EmergingIssuesGetResultData.cs new file mode 100644 index 0000000000000..485749a5974e4 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EmergingIssuesGetResultData.cs @@ -0,0 +1,48 @@ +// 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.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// A class representing the EmergingIssuesGetResult data model. + public partial class EmergingIssuesGetResultData : ResourceData + { + /// Initializes a new instance of EmergingIssuesGetResultData. + internal EmergingIssuesGetResultData() + { + StatusBanners = new ChangeTrackingList(); + StatusActiveEvents = new ChangeTrackingList(); + } + + /// Initializes a new instance of EmergingIssuesGetResultData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Timestamp for when last time refreshed for ongoing emerging issue. + /// The list of emerging issues of banner type. + /// The list of emerging issues of active event type. + internal EmergingIssuesGetResultData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, DateTimeOffset? refreshTimestamp, IReadOnlyList statusBanners, IReadOnlyList statusActiveEvents) : base(id, name, resourceType, systemData) + { + RefreshTimestamp = refreshTimestamp; + StatusBanners = statusBanners; + StatusActiveEvents = statusActiveEvents; + } + + /// Timestamp for when last time refreshed for ongoing emerging issue. + public DateTimeOffset? RefreshTimestamp { get; } + /// The list of emerging issues of banner type. + public IReadOnlyList StatusBanners { get; } + /// The list of emerging issues of active event type. + public IReadOnlyList StatusActiveEvents { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EmergingIssuesGetResultResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EmergingIssuesGetResultResource.cs new file mode 100644 index 0000000000000..fb51124d47a87 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EmergingIssuesGetResultResource.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A Class representing an EmergingIssuesGetResult 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 GetEmergingIssuesGetResultResource method. + /// Otherwise you can get one from its parent resource using the GetEmergingIssuesGetResult method. + /// + public partial class EmergingIssuesGetResultResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(IssueNameParameter issueName) + { + var resourceId = $"/providers/Microsoft.ResourceHealth/emergingIssues/{issueName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _emergingIssuesGetResultEmergingIssuesClientDiagnostics; + private readonly EmergingIssuesRestOperations _emergingIssuesGetResultEmergingIssuesRestClient; + private readonly EmergingIssuesGetResultData _data; + + /// Initializes a new instance of the class for mocking. + protected EmergingIssuesGetResultResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal EmergingIssuesGetResultResource(ArmClient client, EmergingIssuesGetResultData 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 EmergingIssuesGetResultResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _emergingIssuesGetResultEmergingIssuesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string emergingIssuesGetResultEmergingIssuesApiVersion); + _emergingIssuesGetResultEmergingIssuesRestClient = new EmergingIssuesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, emergingIssuesGetResultEmergingIssuesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ResourceHealth/emergingIssues"; + + /// 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 EmergingIssuesGetResultData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets Azure services' emerging issues. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _emergingIssuesGetResultEmergingIssuesClientDiagnostics.CreateScope("EmergingIssuesGetResultResource.Get"); + scope.Start(); + try + { + var response = await _emergingIssuesGetResultEmergingIssuesRestClient.GetAsync(Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EmergingIssuesGetResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets Azure services' emerging issues. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _emergingIssuesGetResultEmergingIssuesClientDiagnostics.CreateScope("EmergingIssuesGetResultResource.Get"); + scope.Start(); + try + { + var response = _emergingIssuesGetResultEmergingIssuesRestClient.Get(Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new EmergingIssuesGetResultResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EventData.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EventData.cs new file mode 100644 index 0000000000000..1439d3f73abc2 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EventData.cs @@ -0,0 +1,157 @@ +// 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.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// A class representing the Event data model. + public partial class EventData : ResourceData + { + /// Initializes a new instance of EventData. + internal EventData() + { + Links = new ChangeTrackingList(); + Impact = new ChangeTrackingList(); + Faqs = new ChangeTrackingList(); + } + + /// Initializes a new instance of EventData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Type of event. + /// Source of event. + /// Current status of event. + /// Title text of event. + /// Summary text of event. + /// Header text of event. + /// Level of insight. + /// Level of event. + /// The id of the Incident. + /// Article of event. + /// Useful links of event. + /// It provides the Timestamp for when the health impacting event started. + /// It provides the Timestamp for when the health impacting event resolved. + /// List services impacted by the service health event. + /// Recommended actions of event. + /// Frequently asked questions for the service health event. + /// It provides information if the event is High incident rate event or not. + /// Tells if we want to enable or disable Microsoft Support for this event. + /// Contains the communication message for the event, that could include summary, root cause and other details. + /// Is true if the event is platform initiated. + /// Tells if we want to enable or disable Microsoft Support for this event. + /// Priority level of the event. Has value from 0 to 23. 0 is the highest priority. Service issue events have higher priority followed by planned maintenance and health advisory. Critical events have higher priority followed by error, warning and informational. Furthermore, active events have higher priority than resolved. + /// It provides the Timestamp for when the health impacting event was last updated. + /// Stage for HIR Document. + /// Additional information. + /// duration in seconds. + /// The type of the impact. + internal EventData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, EventTypeValue? eventType, EventSourceValue? eventSource, EventStatusValue? status, string title, string summary, string header, LevelValue? level, EventLevelValue? eventLevel, string externalIncidentId, EventPropertiesArticle article, IReadOnlyList links, DateTimeOffset? impactStartOn, DateTimeOffset? impactMitigationOn, IReadOnlyList impact, EventPropertiesRecommendedActions recommendedActions, IReadOnlyList faqs, bool? isHIR, bool? enableMicrosoftSupport, string description, bool? platformInitiated, bool? enableChatWithUs, int? priority, DateTimeOffset? lastUpdateOn, string hirStage, EventPropertiesAdditionalInformation additionalInformation, int? duration, string impactType) : base(id, name, resourceType, systemData) + { + EventType = eventType; + EventSource = eventSource; + Status = status; + Title = title; + Summary = summary; + Header = header; + Level = level; + EventLevel = eventLevel; + ExternalIncidentId = externalIncidentId; + Article = article; + Links = links; + ImpactStartOn = impactStartOn; + ImpactMitigationOn = impactMitigationOn; + Impact = impact; + RecommendedActions = recommendedActions; + Faqs = faqs; + IsHIR = isHIR; + EnableMicrosoftSupport = enableMicrosoftSupport; + Description = description; + PlatformInitiated = platformInitiated; + EnableChatWithUs = enableChatWithUs; + Priority = priority; + LastUpdateOn = lastUpdateOn; + HirStage = hirStage; + AdditionalInformation = additionalInformation; + Duration = duration; + ImpactType = impactType; + } + + /// Type of event. + public EventTypeValue? EventType { get; } + /// Source of event. + public EventSourceValue? EventSource { get; } + /// Current status of event. + public EventStatusValue? Status { get; } + /// Title text of event. + public string Title { get; } + /// Summary text of event. + public string Summary { get; } + /// Header text of event. + public string Header { get; } + /// Level of insight. + public LevelValue? Level { get; } + /// Level of event. + public EventLevelValue? EventLevel { get; } + /// The id of the Incident. + public string ExternalIncidentId { get; } + /// Article of event. + internal EventPropertiesArticle Article { get; } + /// Article content of event. + public string ArticleContent + { + get => Article?.ArticleContent; + } + + /// Useful links of event. + public IReadOnlyList Links { get; } + /// It provides the Timestamp for when the health impacting event started. + public DateTimeOffset? ImpactStartOn { get; } + /// It provides the Timestamp for when the health impacting event resolved. + public DateTimeOffset? ImpactMitigationOn { get; } + /// List services impacted by the service health event. + public IReadOnlyList Impact { get; } + /// Recommended actions of event. + public EventPropertiesRecommendedActions RecommendedActions { get; } + /// Frequently asked questions for the service health event. + public IReadOnlyList Faqs { get; } + /// It provides information if the event is High incident rate event or not. + public bool? IsHIR { get; } + /// Tells if we want to enable or disable Microsoft Support for this event. + public bool? EnableMicrosoftSupport { get; } + /// Contains the communication message for the event, that could include summary, root cause and other details. + public string Description { get; } + /// Is true if the event is platform initiated. + public bool? PlatformInitiated { get; } + /// Tells if we want to enable or disable Microsoft Support for this event. + public bool? EnableChatWithUs { get; } + /// Priority level of the event. Has value from 0 to 23. 0 is the highest priority. Service issue events have higher priority followed by planned maintenance and health advisory. Critical events have higher priority followed by error, warning and informational. Furthermore, active events have higher priority than resolved. + public int? Priority { get; } + /// It provides the Timestamp for when the health impacting event was last updated. + public DateTimeOffset? LastUpdateOn { get; } + /// Stage for HIR Document. + public string HirStage { get; } + /// Additional information. + internal EventPropertiesAdditionalInformation AdditionalInformation { get; } + /// Additional information Message. + public string AdditionalInformationMessage + { + get => AdditionalInformation?.Message; + } + + /// duration in seconds. + public int? Duration { get; } + /// The type of the impact. + public string ImpactType { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EventImpactedResourceData.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EventImpactedResourceData.cs new file mode 100644 index 0000000000000..6d7256ace0554 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/EventImpactedResourceData.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// A class representing the EventImpactedResource data model. + public partial class EventImpactedResourceData : ResourceData + { + /// Initializes a new instance of EventImpactedResourceData. + internal EventImpactedResourceData() + { + Info = new ChangeTrackingList(); + } + + /// Initializes a new instance of EventImpactedResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Resource type within Microsoft cloud. + /// Identity for resource within Microsoft cloud. + /// Impacted resource region name. + /// Additional information. + internal EventImpactedResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string targetResourceType, string targetResourceId, string targetRegion, IReadOnlyList info) : base(id, name, resourceType, systemData) + { + TargetResourceType = targetResourceType; + TargetResourceId = targetResourceId; + TargetRegion = targetRegion; + Info = info; + } + + /// Resource type within Microsoft cloud. + public string TargetResourceType { get; } + /// Identity for resource within Microsoft cloud. + public string TargetResourceId { get; } + /// Impacted resource region name. + public string TargetRegion { get; } + /// Additional information. + public IReadOnlyList Info { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ArmResourceExtensionClient.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ArmResourceExtensionClient.cs new file mode 100644 index 0000000000000..df8f48f2640e2 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ArmResourceExtensionClient.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// A class to add extension methods to ArmResource. + internal partial class ArmResourceExtensionClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected ArmResourceExtensionClient() + { + } + + /// 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 ArmResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets an object representing a AvailabilityStatusResource along with the instance operations that can be performed on it in the ArmResource. + /// Returns a object. + public virtual AvailabilityStatusResource GetAvailabilityStatus() + { + return new AvailabilityStatusResource(Client, new ResourceIdentifier(Id.ToString() + "/providers/Microsoft.ResourceHealth/availabilityStatuses/current")); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ResourceHealthExtensions.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ResourceHealthExtensions.cs new file mode 100644 index 0000000000000..32f59e613c4e6 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/ResourceHealthExtensions.cs @@ -0,0 +1,428 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.ResourceHealth.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// A class to add extension methods to Azure.ResourceManager.ResourceHealth. + public static partial class ResourceHealthExtensions + { + private static TenantResourceExtensionClient GetExtensionClient(TenantResource tenantResource) + { + return tenantResource.GetCachedClient((client) => + { + return new TenantResourceExtensionClient(client, tenantResource.Id); + } + ); + } + + /// Gets a collection of MetadataEntityResources in the TenantResource. + /// The instance the method will execute against. + /// An object representing collection of MetadataEntityResources and their operations over a MetadataEntityResource. + public static MetadataEntityCollection GetMetadataEntities(this TenantResource tenantResource) + { + return GetExtensionClient(tenantResource).GetMetadataEntities(); + } + + /// + /// Gets the list of metadata entities. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// The instance the method will execute against. + /// Name of metadata entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetMetadataEntityAsync(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) + { + return await tenantResource.GetMetadataEntities().GetAsync(name, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the list of metadata entities. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// The instance the method will execute against. + /// Name of metadata entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetMetadataEntity(this TenantResource tenantResource, string name, CancellationToken cancellationToken = default) + { + return tenantResource.GetMetadataEntities().Get(name, cancellationToken); + } + + /// Gets a collection of TenantEventResources in the TenantResource. + /// The instance the method will execute against. + /// An object representing collection of TenantEventResources and their operations over a TenantEventResource. + public static TenantEventCollection GetTenantEvents(this TenantResource tenantResource) + { + return GetExtensionClient(tenantResource).GetTenantEvents(); + } + + /// + /// Service health event in the tenant by event tracking id + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// The instance the method will execute against. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetTenantEventAsync(this TenantResource tenantResource, string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + return await tenantResource.GetTenantEvents().GetAsync(eventTrackingId, filter, queryStartTime, cancellationToken).ConfigureAwait(false); + } + + /// + /// Service health event in the tenant by event tracking id + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// The instance the method will execute against. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetTenantEvent(this TenantResource tenantResource, string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + return tenantResource.GetTenantEvents().Get(eventTrackingId, filter, queryStartTime, cancellationToken); + } + + /// Gets a collection of EmergingIssuesGetResultResources in the TenantResource. + /// The instance the method will execute against. + /// An object representing collection of EmergingIssuesGetResultResources and their operations over a EmergingIssuesGetResultResource. + public static EmergingIssuesGetResultCollection GetEmergingIssuesGetResults(this TenantResource tenantResource) + { + return GetExtensionClient(tenantResource).GetEmergingIssuesGetResults(); + } + + /// + /// Gets Azure services' emerging issues. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the emerging issue. + /// The cancellation token to use. + [ForwardsClientCalls] + public static async Task> GetEmergingIssuesGetResultAsync(this TenantResource tenantResource, IssueNameParameter issueName, CancellationToken cancellationToken = default) + { + return await tenantResource.GetEmergingIssuesGetResults().GetAsync(issueName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets Azure services' emerging issues. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/emergingIssues/{issueName} + /// + /// + /// Operation Id + /// EmergingIssues_Get + /// + /// + /// + /// The instance the method will execute against. + /// The name of the emerging issue. + /// The cancellation token to use. + [ForwardsClientCalls] + public static Response GetEmergingIssuesGetResult(this TenantResource tenantResource, IssueNameParameter issueName, CancellationToken cancellationToken = default) + { + return tenantResource.GetEmergingIssuesGetResults().Get(issueName, cancellationToken); + } + + private static SubscriptionResourceExtensionClient GetExtensionClient(SubscriptionResource subscriptionResource) + { + return subscriptionResource.GetCachedClient((client) => + { + return new SubscriptionResourceExtensionClient(client, subscriptionResource.Id); + } + ); + } + + /// Gets a collection of SubscriptionEventResources in the SubscriptionResource. + /// The instance the method will execute against. + /// An object representing collection of SubscriptionEventResources and their operations over a SubscriptionEventResource. + public static SubscriptionEventCollection GetSubscriptionEvents(this SubscriptionResource subscriptionResource) + { + return GetExtensionClient(subscriptionResource).GetSubscriptionEvents(); + } + + /// + /// Service health event in the subscription by event tracking id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// The instance the method will execute against. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetSubscriptionEventAsync(this SubscriptionResource subscriptionResource, string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + return await subscriptionResource.GetSubscriptionEvents().GetAsync(eventTrackingId, filter, queryStartTime, cancellationToken).ConfigureAwait(false); + } + + /// + /// Service health event in the subscription by event tracking id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// The instance the method will execute against. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetSubscriptionEvent(this SubscriptionResource subscriptionResource, string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + return subscriptionResource.GetSubscriptionEvents().Get(eventTrackingId, filter, queryStartTime, cancellationToken); + } + + private static ArmResourceExtensionClient GetExtensionClient(ArmClient client, ResourceIdentifier scope) + { + return client.GetResourceClient(() => + { + return new ArmResourceExtensionClient(client, scope); + } + ); + } + + private static ArmResourceExtensionClient GetExtensionClient(ArmResource armResource) + { + return armResource.GetCachedClient((client) => + { + return new ArmResourceExtensionClient(client, armResource.Id); + } + ); + } + + /// Gets an object representing a AvailabilityStatusResource along with the instance operations that can be performed on it in the ArmResource. + /// The instance the method will execute against. + /// The scope that the resource will apply against. + /// Returns a object. + public static AvailabilityStatusResource GetAvailabilityStatus(this ArmClient client, ResourceIdentifier scope) + { + return GetExtensionClient(client, scope).GetAvailabilityStatus(); + } + + #region AvailabilityStatusResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static AvailabilityStatusResource GetAvailabilityStatusResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + AvailabilityStatusResource.ValidateResourceId(id); + return new AvailabilityStatusResource(client, id); + } + ); + } + #endregion + + #region MetadataEntityResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MetadataEntityResource GetMetadataEntityResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + MetadataEntityResource.ValidateResourceId(id); + return new MetadataEntityResource(client, id); + } + ); + } + #endregion + + #region SubscriptionResourceHealthEventImpactedResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionResourceHealthEventImpactedResource GetSubscriptionResourceHealthEventImpactedResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SubscriptionResourceHealthEventImpactedResource.ValidateResourceId(id); + return new SubscriptionResourceHealthEventImpactedResource(client, id); + } + ); + } + #endregion + + #region TenantResourceHealthEventImpactedResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static TenantResourceHealthEventImpactedResource GetTenantResourceHealthEventImpactedResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + TenantResourceHealthEventImpactedResource.ValidateResourceId(id); + return new TenantResourceHealthEventImpactedResource(client, id); + } + ); + } + #endregion + + #region SubscriptionEventResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static SubscriptionEventResource GetSubscriptionEventResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + SubscriptionEventResource.ValidateResourceId(id); + return new SubscriptionEventResource(client, id); + } + ); + } + #endregion + + #region TenantEventResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static TenantEventResource GetTenantEventResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + TenantEventResource.ValidateResourceId(id); + return new TenantEventResource(client, id); + } + ); + } + #endregion + + #region EmergingIssuesGetResultResource + /// + /// 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 instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static EmergingIssuesGetResultResource GetEmergingIssuesGetResultResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + EmergingIssuesGetResultResource.ValidateResourceId(id); + return new EmergingIssuesGetResultResource(client, id); + } + ); + } + #endregion + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs new file mode 100644 index 0000000000000..0a515a7ee4f10 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// A class to add extension methods to SubscriptionResource. + internal partial class SubscriptionResourceExtensionClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected SubscriptionResourceExtensionClient() + { + } + + /// 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 SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of SubscriptionEventResources in the SubscriptionResource. + /// An object representing collection of SubscriptionEventResources and their operations over a SubscriptionEventResource. + public virtual SubscriptionEventCollection GetSubscriptionEvents() + { + return GetCachedClient(Client => new SubscriptionEventCollection(Client, Id)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/TenantResourceExtensionClient.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/TenantResourceExtensionClient.cs new file mode 100644 index 0000000000000..e837c7d6e9b30 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Extensions/TenantResourceExtensionClient.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// A class to add extension methods to TenantResource. + internal partial class TenantResourceExtensionClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected TenantResourceExtensionClient() + { + } + + /// 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 TenantResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of MetadataEntityResources in the TenantResource. + /// An object representing collection of MetadataEntityResources and their operations over a MetadataEntityResource. + public virtual MetadataEntityCollection GetMetadataEntities() + { + return GetCachedClient(Client => new MetadataEntityCollection(Client, Id)); + } + + /// Gets a collection of TenantEventResources in the TenantResource. + /// An object representing collection of TenantEventResources and their operations over a TenantEventResource. + public virtual TenantEventCollection GetTenantEvents() + { + return GetCachedClient(Client => new TenantEventCollection(Client, Id)); + } + + /// Gets a collection of EmergingIssuesGetResultResources in the TenantResource. + /// An object representing collection of EmergingIssuesGetResultResources and their operations over a EmergingIssuesGetResultResource. + public virtual EmergingIssuesGetResultCollection GetEmergingIssuesGetResults() + { + return GetCachedClient(Client => new EmergingIssuesGetResultCollection(Client, Id)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/MetadataEntityCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/MetadataEntityCollection.cs new file mode 100644 index 0000000000000..9dbf4e1c06b61 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/MetadataEntityCollection.cs @@ -0,0 +1,259 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetMetadataEntities method from an instance of . + /// + public partial class MetadataEntityCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _metadataEntityMetadataClientDiagnostics; + private readonly MetadataRestOperations _metadataEntityMetadataRestClient; + + /// Initializes a new instance of the class for mocking. + protected MetadataEntityCollection() + { + } + + /// 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 MetadataEntityCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _metadataEntityMetadataClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", MetadataEntityResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MetadataEntityResource.ResourceType, out string metadataEntityMetadataApiVersion); + _metadataEntityMetadataRestClient = new MetadataRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, metadataEntityMetadataApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != TenantResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, TenantResource.ResourceType), nameof(id)); + } + + /// + /// Gets the list of metadata entities. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// Name of metadata entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _metadataEntityMetadataClientDiagnostics.CreateScope("MetadataEntityCollection.Get"); + scope.Start(); + try + { + var response = await _metadataEntityMetadataRestClient.GetEntityAsync(name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MetadataEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of metadata entities. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// Name of metadata entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _metadataEntityMetadataClientDiagnostics.CreateScope("MetadataEntityCollection.Get"); + scope.Start(); + try + { + var response = _metadataEntityMetadataRestClient.GetEntity(name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MetadataEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of metadata entities. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata + /// + /// + /// Operation Id + /// Metadata_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _metadataEntityMetadataRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _metadataEntityMetadataRestClient.CreateListNextPageRequest(nextLink); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new MetadataEntityResource(Client, MetadataEntityData.DeserializeMetadataEntityData(e)), _metadataEntityMetadataClientDiagnostics, Pipeline, "MetadataEntityCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Gets the list of metadata entities. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata + /// + /// + /// Operation Id + /// Metadata_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _metadataEntityMetadataRestClient.CreateListRequest(); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _metadataEntityMetadataRestClient.CreateListNextPageRequest(nextLink); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new MetadataEntityResource(Client, MetadataEntityData.DeserializeMetadataEntityData(e)), _metadataEntityMetadataClientDiagnostics, Pipeline, "MetadataEntityCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// Name of metadata entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _metadataEntityMetadataClientDiagnostics.CreateScope("MetadataEntityCollection.Exists"); + scope.Start(); + try + { + var response = await _metadataEntityMetadataRestClient.GetEntityAsync(name, 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 + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// Name of metadata entity. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var scope = _metadataEntityMetadataClientDiagnostics.CreateScope("MetadataEntityCollection.Exists"); + scope.Start(); + try + { + var response = _metadataEntityMetadataRestClient.GetEntity(name, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/MetadataEntityData.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/MetadataEntityData.cs new file mode 100644 index 0000000000000..2393b0bbc15a3 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/MetadataEntityData.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// A class representing the MetadataEntity data model. + public partial class MetadataEntityData : ResourceData + { + /// Initializes a new instance of MetadataEntityData. + internal MetadataEntityData() + { + DependsOn = new ChangeTrackingList(); + ApplicableScenarios = new ChangeTrackingList(); + SupportedValues = new ChangeTrackingList(); + } + + /// Initializes a new instance of MetadataEntityData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The display name. + /// The list of keys on which this entity depends on. + /// The list of scenarios applicable to this metadata entity. + /// The list of supported values. + internal MetadataEntityData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, string displayName, IReadOnlyList dependsOn, IReadOnlyList applicableScenarios, IReadOnlyList supportedValues) : base(id, name, resourceType, systemData) + { + DisplayName = displayName; + DependsOn = dependsOn; + ApplicableScenarios = applicableScenarios; + SupportedValues = supportedValues; + } + + /// The display name. + public string DisplayName { get; } + /// The list of keys on which this entity depends on. + public IReadOnlyList DependsOn { get; } + /// The list of scenarios applicable to this metadata entity. + public IReadOnlyList ApplicableScenarios { get; } + /// The list of supported values. + public IReadOnlyList SupportedValues { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/MetadataEntityResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/MetadataEntityResource.cs new file mode 100644 index 0000000000000..e11272ead6d7b --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/MetadataEntityResource.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A Class representing a MetadataEntity along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetMetadataEntityResource method. + /// Otherwise you can get one from its parent resource using the GetMetadataEntity method. + /// + public partial class MetadataEntityResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string name) + { + var resourceId = $"/providers/Microsoft.ResourceHealth/metadata/{name}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _metadataEntityMetadataClientDiagnostics; + private readonly MetadataRestOperations _metadataEntityMetadataRestClient; + private readonly MetadataEntityData _data; + + /// Initializes a new instance of the class for mocking. + protected MetadataEntityResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal MetadataEntityResource(ArmClient client, MetadataEntityData 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 MetadataEntityResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _metadataEntityMetadataClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string metadataEntityMetadataApiVersion); + _metadataEntityMetadataRestClient = new MetadataRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, metadataEntityMetadataApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ResourceHealth/metadata"; + + /// 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 MetadataEntityData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the list of metadata entities. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _metadataEntityMetadataClientDiagnostics.CreateScope("MetadataEntityResource.Get"); + scope.Start(); + try + { + var response = await _metadataEntityMetadataRestClient.GetEntityAsync(Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MetadataEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the list of metadata entities. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/metadata/{name} + /// + /// + /// Operation Id + /// Metadata_GetEntity + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _metadataEntityMetadataClientDiagnostics.CreateScope("MetadataEntityResource.Get"); + scope.Start(); + try + { + var response = _metadataEntityMetadataRestClient.GetEntity(Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MetadataEntityResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStateValue.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStateValue.cs new file mode 100644 index 0000000000000..d52a9449906a2 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStateValue.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.ResourceHealth.Models +{ + /// Impacted resource status of the resource. + public readonly partial struct AvailabilityStateValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AvailabilityStateValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AvailableValue = "Available"; + private const string UnavailableValue = "Unavailable"; + private const string DegradedValue = "Degraded"; + private const string UnknownValue = "Unknown"; + + /// Available. + public static AvailabilityStateValue Available { get; } = new AvailabilityStateValue(AvailableValue); + /// Unavailable. + public static AvailabilityStateValue Unavailable { get; } = new AvailabilityStateValue(UnavailableValue); + /// Degraded. + public static AvailabilityStateValue Degraded { get; } = new AvailabilityStateValue(DegradedValue); + /// Unknown. + public static AvailabilityStateValue Unknown { get; } = new AvailabilityStateValue(UnknownValue); + /// Determines if two values are the same. + public static bool operator ==(AvailabilityStateValue left, AvailabilityStateValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AvailabilityStateValue left, AvailabilityStateValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AvailabilityStateValue(string value) => new AvailabilityStateValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AvailabilityStateValue other && Equals(other); + /// + public bool Equals(AvailabilityStateValue other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusData.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusData.Serialization.cs new file mode 100644 index 0000000000000..efcb159072168 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusData.Serialization.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + public partial class AvailabilityStatusData + { + internal static AvailabilityStatusData DeserializeAvailabilityStatusData(JsonElement element) + { + Optional location = default; + Optional properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = AvailabilityStatusProperties.DeserializeAvailabilityStatusProperties(property.Value); + 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) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new AvailabilityStatusData(id, name, type, systemData.Value, Optional.ToNullable(location), properties.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusListResult.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusListResult.Serialization.cs new file mode 100644 index 0000000000000..dab08eaa4d720 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusListResult.Serialization.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + internal partial class AvailabilityStatusListResult + { + internal static AvailabilityStatusListResult DeserializeAvailabilityStatusListResult(JsonElement element) + { + IReadOnlyList value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AvailabilityStatusData.DeserializeAvailabilityStatusData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new AvailabilityStatusListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusListResult.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusListResult.cs new file mode 100644 index 0000000000000..7d9eb8d70b4c6 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusListResult.cs @@ -0,0 +1,43 @@ +// 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.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// The List availabilityStatus operation response. + internal partial class AvailabilityStatusListResult + { + /// Initializes a new instance of AvailabilityStatusListResult. + /// The list of availabilityStatuses. + /// is null. + internal AvailabilityStatusListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of AvailabilityStatusListResult. + /// The list of availabilityStatuses. + /// The URI to fetch the next page of availabilityStatuses. Call ListNext() with this URI to fetch the next page of availabilityStatuses. + internal AvailabilityStatusListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The list of availabilityStatuses. + public IReadOnlyList Value { get; } + /// The URI to fetch the next page of availabilityStatuses. Call ListNext() with this URI to fetch the next page of availabilityStatuses. + public string NextLink { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusProperties.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusProperties.Serialization.cs new file mode 100644 index 0000000000000..265338bd85bc7 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusProperties.Serialization.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class AvailabilityStatusProperties + { + internal static AvailabilityStatusProperties DeserializeAvailabilityStatusProperties(JsonElement element) + { + Optional availabilityState = default; + Optional title = default; + Optional summary = default; + Optional detailedStatus = default; + Optional reasonType = default; + Optional context = default; + Optional category = default; + Optional rootCauseAttributionTime = default; + Optional healthEventType = default; + Optional healthEventCause = default; + Optional healthEventCategory = default; + Optional healthEventId = default; + Optional resolutionETA = default; + Optional occuredTime = default; + Optional reasonChronicity = default; + Optional reportedTime = default; + Optional recentlyResolved = default; + Optional> recommendedActions = default; + Optional> serviceImpactingEvents = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("availabilityState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + availabilityState = new AvailabilityStateValue(property.Value.GetString()); + continue; + } + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("summary"u8)) + { + summary = property.Value.GetString(); + continue; + } + if (property.NameEquals("detailedStatus"u8)) + { + detailedStatus = property.Value.GetString(); + continue; + } + if (property.NameEquals("reasonType"u8)) + { + reasonType = property.Value.GetString(); + continue; + } + if (property.NameEquals("context"u8)) + { + context = property.Value.GetString(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("rootCauseAttributionTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + rootCauseAttributionTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("healthEventType"u8)) + { + healthEventType = property.Value.GetString(); + continue; + } + if (property.NameEquals("healthEventCause"u8)) + { + healthEventCause = property.Value.GetString(); + continue; + } + if (property.NameEquals("healthEventCategory"u8)) + { + healthEventCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("healthEventId"u8)) + { + healthEventId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resolutionETA"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + resolutionETA = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("occuredTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + occuredTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("reasonChronicity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + reasonChronicity = new ReasonChronicityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("reportedTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + reportedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("recentlyResolved"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + recentlyResolved = AvailabilityStatusPropertiesRecentlyResolved.DeserializeAvailabilityStatusPropertiesRecentlyResolved(property.Value); + continue; + } + if (property.NameEquals("recommendedActions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(RecommendedAction.DeserializeRecommendedAction(item)); + } + recommendedActions = array; + continue; + } + if (property.NameEquals("serviceImpactingEvents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ServiceImpactingEvent.DeserializeServiceImpactingEvent(item)); + } + serviceImpactingEvents = array; + continue; + } + } + return new AvailabilityStatusProperties(Optional.ToNullable(availabilityState), title.Value, summary.Value, detailedStatus.Value, reasonType.Value, context.Value, category.Value, Optional.ToNullable(rootCauseAttributionTime), healthEventType.Value, healthEventCause.Value, healthEventCategory.Value, healthEventId.Value, Optional.ToNullable(resolutionETA), Optional.ToNullable(occuredTime), Optional.ToNullable(reasonChronicity), Optional.ToNullable(reportedTime), recentlyResolved.Value, Optional.ToList(recommendedActions), Optional.ToList(serviceImpactingEvents)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusProperties.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusProperties.cs new file mode 100644 index 0000000000000..487955d0be38b --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusProperties.cs @@ -0,0 +1,106 @@ +// 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.ResourceHealth.Models +{ + /// Properties of availability state. + public partial class AvailabilityStatusProperties + { + /// Initializes a new instance of AvailabilityStatusProperties. + internal AvailabilityStatusProperties() + { + RecommendedActions = new ChangeTrackingList(); + ServiceImpactingEvents = new ChangeTrackingList(); + } + + /// Initializes a new instance of AvailabilityStatusProperties. + /// Availability status of the resource. When it is null, this availabilityStatus object represents an availability impacting event. + /// Title description of the availability status. + /// Summary description of the availability status. + /// Details of the availability status. + /// When the resource's availabilityState is Unavailable, it describes where the health impacting event was originated. Examples are planned, unplanned, user initiated or an outage etc. + /// When an event is created, it can either be triggered by a customer or the platform of the resource and this field will illustrate that. This field is connected to the category field in this object. + /// When a context field is set to Platform, this field will reflect if the event was planned or unplanned. If the context field does not have a value of Platform, then this field will be ignored. + /// When the resource's availabilityState is Unavailable, it provides the Timestamp for when the health impacting event was received. + /// In case of an availability impacting event, it describes when the health impacting event was originated. Examples are Lifecycle, Downtime, Fault Analysis etc. + /// In case of an availability impacting event, it describes where the health impacting event was originated. Examples are PlatformInitiated, UserInitiated etc. + /// In case of an availability impacting event, it describes the category of a PlatformInitiated health impacting event. Examples are Planned, Unplanned etc. + /// It is a unique Id that identifies the event. + /// When the resource's availabilityState is Unavailable and the reasonType is not User Initiated, it provides the date and time for when the issue is expected to be resolved. + /// Timestamp for when last change in health status occurred. + /// Chronicity of the availability transition. + /// Timestamp for when the health was last checked. + /// An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned. + /// Lists actions the user can take based on the current availabilityState of the resource. + /// Lists the service impacting events that may be affecting the health of the resource. + internal AvailabilityStatusProperties(AvailabilityStateValue? availabilityState, string title, string summary, string detailedStatus, string reasonType, string context, string category, DateTimeOffset? rootCauseAttributionOn, string healthEventType, string healthEventCause, string healthEventCategory, string healthEventId, DateTimeOffset? resolutionETA, DateTimeOffset? occuredOn, ReasonChronicityType? reasonChronicity, DateTimeOffset? reportedOn, AvailabilityStatusPropertiesRecentlyResolved recentlyResolved, IReadOnlyList recommendedActions, IReadOnlyList serviceImpactingEvents) + { + AvailabilityState = availabilityState; + Title = title; + Summary = summary; + DetailedStatus = detailedStatus; + ReasonType = reasonType; + Context = context; + Category = category; + RootCauseAttributionOn = rootCauseAttributionOn; + HealthEventType = healthEventType; + HealthEventCause = healthEventCause; + HealthEventCategory = healthEventCategory; + HealthEventId = healthEventId; + ResolutionETA = resolutionETA; + OccuredOn = occuredOn; + ReasonChronicity = reasonChronicity; + ReportedOn = reportedOn; + RecentlyResolved = recentlyResolved; + RecommendedActions = recommendedActions; + ServiceImpactingEvents = serviceImpactingEvents; + } + + /// Availability status of the resource. When it is null, this availabilityStatus object represents an availability impacting event. + public AvailabilityStateValue? AvailabilityState { get; } + /// Title description of the availability status. + public string Title { get; } + /// Summary description of the availability status. + public string Summary { get; } + /// Details of the availability status. + public string DetailedStatus { get; } + /// When the resource's availabilityState is Unavailable, it describes where the health impacting event was originated. Examples are planned, unplanned, user initiated or an outage etc. + public string ReasonType { get; } + /// When an event is created, it can either be triggered by a customer or the platform of the resource and this field will illustrate that. This field is connected to the category field in this object. + public string Context { get; } + /// When a context field is set to Platform, this field will reflect if the event was planned or unplanned. If the context field does not have a value of Platform, then this field will be ignored. + public string Category { get; } + /// When the resource's availabilityState is Unavailable, it provides the Timestamp for when the health impacting event was received. + public DateTimeOffset? RootCauseAttributionOn { get; } + /// In case of an availability impacting event, it describes when the health impacting event was originated. Examples are Lifecycle, Downtime, Fault Analysis etc. + public string HealthEventType { get; } + /// In case of an availability impacting event, it describes where the health impacting event was originated. Examples are PlatformInitiated, UserInitiated etc. + public string HealthEventCause { get; } + /// In case of an availability impacting event, it describes the category of a PlatformInitiated health impacting event. Examples are Planned, Unplanned etc. + public string HealthEventCategory { get; } + /// It is a unique Id that identifies the event. + public string HealthEventId { get; } + /// When the resource's availabilityState is Unavailable and the reasonType is not User Initiated, it provides the date and time for when the issue is expected to be resolved. + public DateTimeOffset? ResolutionETA { get; } + /// Timestamp for when last change in health status occurred. + public DateTimeOffset? OccuredOn { get; } + /// Chronicity of the availability transition. + public ReasonChronicityType? ReasonChronicity { get; } + /// Timestamp for when the health was last checked. + public DateTimeOffset? ReportedOn { get; } + /// An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned. + public AvailabilityStatusPropertiesRecentlyResolved RecentlyResolved { get; } + /// Lists actions the user can take based on the current availabilityState of the resource. + public IReadOnlyList RecommendedActions { get; } + /// Lists the service impacting events that may be affecting the health of the resource. + public IReadOnlyList ServiceImpactingEvents { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusPropertiesRecentlyResolved.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusPropertiesRecentlyResolved.Serialization.cs new file mode 100644 index 0000000000000..2fbbcf06f003d --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusPropertiesRecentlyResolved.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class AvailabilityStatusPropertiesRecentlyResolved + { + internal static AvailabilityStatusPropertiesRecentlyResolved DeserializeAvailabilityStatusPropertiesRecentlyResolved(JsonElement element) + { + Optional unavailableOccuredTime = default; + Optional resolvedTime = default; + Optional unavailableSummary = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("unavailableOccuredTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + unavailableOccuredTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("resolvedTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + resolvedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("unavailableSummary"u8)) + { + unavailableSummary = property.Value.GetString(); + continue; + } + } + return new AvailabilityStatusPropertiesRecentlyResolved(Optional.ToNullable(unavailableOccuredTime), Optional.ToNullable(resolvedTime), unavailableSummary.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusPropertiesRecentlyResolved.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusPropertiesRecentlyResolved.cs new file mode 100644 index 0000000000000..2c0b9e4f90d62 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/AvailabilityStatusPropertiesRecentlyResolved.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// An annotation describing a change in the availabilityState to Available from Unavailable with a reasonType of type Unplanned. + public partial class AvailabilityStatusPropertiesRecentlyResolved + { + /// Initializes a new instance of AvailabilityStatusPropertiesRecentlyResolved. + internal AvailabilityStatusPropertiesRecentlyResolved() + { + } + + /// Initializes a new instance of AvailabilityStatusPropertiesRecentlyResolved. + /// Timestamp for when the availabilityState changed to Unavailable. + /// Timestamp when the availabilityState changes to Available. + /// Brief description of cause of the resource becoming unavailable. + internal AvailabilityStatusPropertiesRecentlyResolved(DateTimeOffset? unavailableOccuredOn, DateTimeOffset? resolvedOn, string unavailableSummary) + { + UnavailableOccuredOn = unavailableOccuredOn; + ResolvedOn = resolvedOn; + UnavailableSummary = unavailableSummary; + } + + /// Timestamp for when the availabilityState changed to Unavailable. + public DateTimeOffset? UnavailableOccuredOn { get; } + /// Timestamp when the availabilityState changes to Available. + public DateTimeOffset? ResolvedOn { get; } + /// Brief description of cause of the resource becoming unavailable. + public string UnavailableSummary { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueImpact.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueImpact.Serialization.cs new file mode 100644 index 0000000000000..89ff8803c26ac --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueImpact.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class EmergingIssueImpact + { + internal static EmergingIssueImpact DeserializeEmergingIssueImpact(JsonElement element) + { + Optional id = default; + Optional name = default; + Optional> regions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("regions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ImpactedRegion.DeserializeImpactedRegion(item)); + } + regions = array; + continue; + } + } + return new EmergingIssueImpact(id.Value, name.Value, Optional.ToList(regions)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueImpact.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueImpact.cs new file mode 100644 index 0000000000000..120863bb898c2 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueImpact.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Object of the emerging issue impact on services and regions. + public partial class EmergingIssueImpact + { + /// Initializes a new instance of EmergingIssueImpact. + internal EmergingIssueImpact() + { + Regions = new ChangeTrackingList(); + } + + /// Initializes a new instance of EmergingIssueImpact. + /// The impacted service id. + /// The impacted service name. + /// The list of impacted regions for corresponding emerging issues. + internal EmergingIssueImpact(string id, string name, IReadOnlyList regions) + { + Id = id; + Name = name; + Regions = regions; + } + + /// The impacted service id. + public string Id { get; } + /// The impacted service name. + public string Name { get; } + /// The list of impacted regions for corresponding emerging issues. + public IReadOnlyList Regions { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueListResult.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueListResult.Serialization.cs new file mode 100644 index 0000000000000..4a9687bc7ff1d --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueListResult.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + internal partial class EmergingIssueListResult + { + internal static EmergingIssueListResult DeserializeEmergingIssueListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EmergingIssuesGetResultData.DeserializeEmergingIssuesGetResultData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new EmergingIssueListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueListResult.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueListResult.cs new file mode 100644 index 0000000000000..eaba83db13392 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssueListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// The list of emerging issues. + internal partial class EmergingIssueListResult + { + /// Initializes a new instance of EmergingIssueListResult. + internal EmergingIssueListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of EmergingIssueListResult. + /// The list of emerging issues. + /// The link used to get the next page of emerging issues. + internal EmergingIssueListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The list of emerging issues. + public IReadOnlyList Value { get; } + /// The link used to get the next page of emerging issues. + public string NextLink { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssuesGetResultData.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssuesGetResultData.Serialization.cs new file mode 100644 index 0000000000000..ceea43f1ae745 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EmergingIssuesGetResultData.Serialization.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + public partial class EmergingIssuesGetResultData + { + internal static EmergingIssuesGetResultData DeserializeEmergingIssuesGetResultData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional refreshTimestamp = default; + Optional> statusBanners = default; + Optional> statusActiveEvents = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("refreshTimestamp"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + refreshTimestamp = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("statusBanners"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(StatusBanner.DeserializeStatusBanner(item)); + } + statusBanners = array; + continue; + } + if (property0.NameEquals("statusActiveEvents"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(StatusActiveEvent.DeserializeStatusActiveEvent(item)); + } + statusActiveEvents = array; + continue; + } + } + continue; + } + } + return new EmergingIssuesGetResultData(id, name, type, systemData.Value, Optional.ToNullable(refreshTimestamp), Optional.ToList(statusBanners), Optional.ToList(statusActiveEvents)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventData.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventData.Serialization.cs new file mode 100644 index 0000000000000..af1670b747682 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventData.Serialization.cs @@ -0,0 +1,345 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + public partial class EventData + { + internal static EventData DeserializeEventData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional eventType = default; + Optional eventSource = default; + Optional status = default; + Optional title = default; + Optional summary = default; + Optional header = default; + Optional level = default; + Optional eventLevel = default; + Optional externalIncidentId = default; + Optional article = default; + Optional> links = default; + Optional impactStartTime = default; + Optional impactMitigationTime = default; + Optional> impact = default; + Optional recommendedActions = default; + Optional> faqs = default; + Optional isHIR = default; + Optional enableMicrosoftSupport = default; + Optional description = default; + Optional platformInitiated = default; + Optional enableChatWithUs = default; + Optional priority = default; + Optional lastUpdateTime = default; + Optional hirStage = default; + Optional additionalInformation = default; + Optional duration = default; + Optional impactType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("eventType"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + eventType = new EventTypeValue(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("eventSource"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + eventSource = new EventSourceValue(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("status"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new EventStatusValue(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("title"u8)) + { + title = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("summary"u8)) + { + summary = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("header"u8)) + { + header = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("level"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + level = new LevelValue(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("eventLevel"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + eventLevel = new EventLevelValue(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("externalIncidentId"u8)) + { + externalIncidentId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("article"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + article = EventPropertiesArticle.DeserializeEventPropertiesArticle(property0.Value); + continue; + } + if (property0.NameEquals("links"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Link.DeserializeLink(item)); + } + links = array; + continue; + } + if (property0.NameEquals("impactStartTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + impactStartTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("impactMitigationTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + impactMitigationTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("impact"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Models.Impact.DeserializeImpact(item)); + } + impact = array; + continue; + } + if (property0.NameEquals("recommendedActions"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + recommendedActions = EventPropertiesRecommendedActions.DeserializeEventPropertiesRecommendedActions(property0.Value); + continue; + } + if (property0.NameEquals("faqs"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Faq.DeserializeFaq(item)); + } + faqs = array; + continue; + } + if (property0.NameEquals("isHIR"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + isHIR = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableMicrosoftSupport"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + enableMicrosoftSupport = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("description"u8)) + { + description = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("platformInitiated"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + platformInitiated = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("enableChatWithUs"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + enableChatWithUs = property0.Value.GetBoolean(); + continue; + } + if (property0.NameEquals("priority"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + priority = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("lastUpdateTime"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + lastUpdateTime = property0.Value.GetDateTimeOffset("O"); + continue; + } + if (property0.NameEquals("hirStage"u8)) + { + hirStage = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("additionalInformation"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + additionalInformation = EventPropertiesAdditionalInformation.DeserializeEventPropertiesAdditionalInformation(property0.Value); + continue; + } + if (property0.NameEquals("duration"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + duration = property0.Value.GetInt32(); + continue; + } + if (property0.NameEquals("impactType"u8)) + { + impactType = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new EventData(id, name, type, systemData.Value, Optional.ToNullable(eventType), Optional.ToNullable(eventSource), Optional.ToNullable(status), title.Value, summary.Value, header.Value, Optional.ToNullable(level), Optional.ToNullable(eventLevel), externalIncidentId.Value, article.Value, Optional.ToList(links), Optional.ToNullable(impactStartTime), Optional.ToNullable(impactMitigationTime), Optional.ToList(impact), recommendedActions.Value, Optional.ToList(faqs), Optional.ToNullable(isHIR), Optional.ToNullable(enableMicrosoftSupport), description.Value, Optional.ToNullable(platformInitiated), Optional.ToNullable(enableChatWithUs), Optional.ToNullable(priority), Optional.ToNullable(lastUpdateTime), hirStage.Value, additionalInformation.Value, Optional.ToNullable(duration), impactType.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventImpactedResourceData.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventImpactedResourceData.Serialization.cs new file mode 100644 index 0000000000000..cec919895928b --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventImpactedResourceData.Serialization.cs @@ -0,0 +1,101 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + public partial class EventImpactedResourceData + { + internal static EventImpactedResourceData DeserializeEventImpactedResourceData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional targetResourceType = default; + Optional targetResourceId = default; + Optional targetRegion = default; + Optional> info = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("targetResourceType"u8)) + { + targetResourceType = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("targetResourceId"u8)) + { + targetResourceId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("targetRegion"u8)) + { + targetRegion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("info"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(KeyValueItem.DeserializeKeyValueItem(item)); + } + info = array; + continue; + } + } + continue; + } + } + return new EventImpactedResourceData(id, name, type, systemData.Value, targetResourceType.Value, targetResourceId.Value, targetRegion.Value, Optional.ToList(info)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventImpactedResourceListResult.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventImpactedResourceListResult.Serialization.cs new file mode 100644 index 0000000000000..1e1619ffd41fa --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventImpactedResourceListResult.Serialization.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + internal partial class EventImpactedResourceListResult + { + internal static EventImpactedResourceListResult DeserializeEventImpactedResourceListResult(JsonElement element) + { + IReadOnlyList value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EventImpactedResourceData.DeserializeEventImpactedResourceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new EventImpactedResourceListResult(value, nextLink.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventImpactedResourceListResult.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventImpactedResourceListResult.cs new file mode 100644 index 0000000000000..1e807ec17efd0 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventImpactedResourceListResult.cs @@ -0,0 +1,43 @@ +// 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.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// The List of eventImpactedResources operation response. + internal partial class EventImpactedResourceListResult + { + /// Initializes a new instance of EventImpactedResourceListResult. + /// The list of eventImpactedResources. + /// is null. + internal EventImpactedResourceListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of EventImpactedResourceListResult. + /// The list of eventImpactedResources. + /// The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of impacted resource. + internal EventImpactedResourceListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The list of eventImpactedResources. + public IReadOnlyList Value { get; } + /// The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of impacted resource. + public string NextLink { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventLevelValue.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventLevelValue.cs new file mode 100644 index 0000000000000..b8704fb282d9a --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventLevelValue.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.ResourceHealth.Models +{ + /// Level of event. + public readonly partial struct EventLevelValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EventLevelValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CriticalValue = "Critical"; + private const string ErrorValue = "Error"; + private const string WarningValue = "Warning"; + private const string InformationalValue = "Informational"; + + /// Critical. + public static EventLevelValue Critical { get; } = new EventLevelValue(CriticalValue); + /// Error. + public static EventLevelValue Error { get; } = new EventLevelValue(ErrorValue); + /// Warning. + public static EventLevelValue Warning { get; } = new EventLevelValue(WarningValue); + /// Informational. + public static EventLevelValue Informational { get; } = new EventLevelValue(InformationalValue); + /// Determines if two values are the same. + public static bool operator ==(EventLevelValue left, EventLevelValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EventLevelValue left, EventLevelValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EventLevelValue(string value) => new EventLevelValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EventLevelValue other && Equals(other); + /// + public bool Equals(EventLevelValue other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesAdditionalInformation.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesAdditionalInformation.Serialization.cs new file mode 100644 index 0000000000000..649395914c741 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesAdditionalInformation.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + internal partial class EventPropertiesAdditionalInformation + { + internal static EventPropertiesAdditionalInformation DeserializeEventPropertiesAdditionalInformation(JsonElement element) + { + Optional message = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + } + return new EventPropertiesAdditionalInformation(message.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesAdditionalInformation.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesAdditionalInformation.cs new file mode 100644 index 0000000000000..8ba31fc4023cc --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesAdditionalInformation.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Additional information. + internal partial class EventPropertiesAdditionalInformation + { + /// Initializes a new instance of EventPropertiesAdditionalInformation. + internal EventPropertiesAdditionalInformation() + { + } + + /// Initializes a new instance of EventPropertiesAdditionalInformation. + /// Additional information Message. + internal EventPropertiesAdditionalInformation(string message) + { + Message = message; + } + + /// Additional information Message. + public string Message { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesArticle.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesArticle.Serialization.cs new file mode 100644 index 0000000000000..bd1aec6339762 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesArticle.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + internal partial class EventPropertiesArticle + { + internal static EventPropertiesArticle DeserializeEventPropertiesArticle(JsonElement element) + { + Optional articleContent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("articleContent"u8)) + { + articleContent = property.Value.GetString(); + continue; + } + } + return new EventPropertiesArticle(articleContent.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesArticle.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesArticle.cs new file mode 100644 index 0000000000000..94b0574db3ac5 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesArticle.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Article of event. + internal partial class EventPropertiesArticle + { + /// Initializes a new instance of EventPropertiesArticle. + internal EventPropertiesArticle() + { + } + + /// Initializes a new instance of EventPropertiesArticle. + /// Article content of event. + internal EventPropertiesArticle(string articleContent) + { + ArticleContent = articleContent; + } + + /// Article content of event. + public string ArticleContent { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActions.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActions.Serialization.cs new file mode 100644 index 0000000000000..5b71bfffa925f --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActions.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class EventPropertiesRecommendedActions + { + internal static EventPropertiesRecommendedActions DeserializeEventPropertiesRecommendedActions(JsonElement element) + { + Optional message = default; + Optional> actions = default; + Optional localeCode = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("actions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EventPropertiesRecommendedActionsItem.DeserializeEventPropertiesRecommendedActionsItem(item)); + } + actions = array; + continue; + } + if (property.NameEquals("localeCode"u8)) + { + localeCode = property.Value.GetString(); + continue; + } + } + return new EventPropertiesRecommendedActions(message.Value, Optional.ToList(actions), localeCode.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActions.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActions.cs new file mode 100644 index 0000000000000..496596b016e90 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActions.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Recommended actions of event. + public partial class EventPropertiesRecommendedActions + { + /// Initializes a new instance of EventPropertiesRecommendedActions. + internal EventPropertiesRecommendedActions() + { + Actions = new ChangeTrackingList(); + } + + /// Initializes a new instance of EventPropertiesRecommendedActions. + /// Recommended action title for the service health event. + /// Recommended actions for the service health event. + /// Recommended action locale for the service health event. + internal EventPropertiesRecommendedActions(string message, IReadOnlyList actions, string localeCode) + { + Message = message; + Actions = actions; + LocaleCode = localeCode; + } + + /// Recommended action title for the service health event. + public string Message { get; } + /// Recommended actions for the service health event. + public IReadOnlyList Actions { get; } + /// Recommended action locale for the service health event. + public string LocaleCode { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActionsItem.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActionsItem.Serialization.cs new file mode 100644 index 0000000000000..0ccd789df431d --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActionsItem.Serialization.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class EventPropertiesRecommendedActionsItem + { + internal static EventPropertiesRecommendedActionsItem DeserializeEventPropertiesRecommendedActionsItem(JsonElement element) + { + Optional groupId = default; + Optional actionText = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("groupId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + groupId = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("actionText"u8)) + { + actionText = property.Value.GetString(); + continue; + } + } + return new EventPropertiesRecommendedActionsItem(Optional.ToNullable(groupId), actionText.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActionsItem.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActionsItem.cs new file mode 100644 index 0000000000000..6cae2087d3ba9 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventPropertiesRecommendedActionsItem.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Recommended action for the service health event. + public partial class EventPropertiesRecommendedActionsItem + { + /// Initializes a new instance of EventPropertiesRecommendedActionsItem. + internal EventPropertiesRecommendedActionsItem() + { + } + + /// Initializes a new instance of EventPropertiesRecommendedActionsItem. + /// Recommended action group Id for the service health event. + /// Recommended action text. + internal EventPropertiesRecommendedActionsItem(int? groupId, string actionText) + { + GroupId = groupId; + ActionText = actionText; + } + + /// Recommended action group Id for the service health event. + public int? GroupId { get; } + /// Recommended action text. + public string ActionText { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventSourceValue.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventSourceValue.cs new file mode 100644 index 0000000000000..8ce6d722eed09 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventSourceValue.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.ResourceHealth.Models +{ + /// Source of event. + public readonly partial struct EventSourceValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EventSourceValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ResourceHealthValue = "ResourceHealth"; + private const string ServiceHealthValue = "ServiceHealth"; + + /// ResourceHealth. + public static EventSourceValue ResourceHealth { get; } = new EventSourceValue(ResourceHealthValue); + /// ServiceHealth. + public static EventSourceValue ServiceHealth { get; } = new EventSourceValue(ServiceHealthValue); + /// Determines if two values are the same. + public static bool operator ==(EventSourceValue left, EventSourceValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EventSourceValue left, EventSourceValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EventSourceValue(string value) => new EventSourceValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EventSourceValue other && Equals(other); + /// + public bool Equals(EventSourceValue other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventStatusValue.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventStatusValue.cs new file mode 100644 index 0000000000000..2b9a7f1bafe10 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventStatusValue.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.ResourceHealth.Models +{ + /// Current status of event. + public readonly partial struct EventStatusValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EventStatusValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string ResolvedValue = "Resolved"; + + /// Active. + public static EventStatusValue Active { get; } = new EventStatusValue(ActiveValue); + /// Resolved. + public static EventStatusValue Resolved { get; } = new EventStatusValue(ResolvedValue); + /// Determines if two values are the same. + public static bool operator ==(EventStatusValue left, EventStatusValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EventStatusValue left, EventStatusValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EventStatusValue(string value) => new EventStatusValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EventStatusValue other && Equals(other); + /// + public bool Equals(EventStatusValue other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventTypeValue.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventTypeValue.cs new file mode 100644 index 0000000000000..19b71741907fb --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/EventTypeValue.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.ResourceHealth.Models +{ + /// Type of event. + public readonly partial struct EventTypeValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public EventTypeValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ServiceIssueValue = "ServiceIssue"; + private const string PlannedMaintenanceValue = "PlannedMaintenance"; + private const string HealthAdvisoryValue = "HealthAdvisory"; + private const string RCAValue = "RCA"; + private const string EmergingIssuesValue = "EmergingIssues"; + private const string SecurityAdvisoryValue = "SecurityAdvisory"; + + /// ServiceIssue. + public static EventTypeValue ServiceIssue { get; } = new EventTypeValue(ServiceIssueValue); + /// PlannedMaintenance. + public static EventTypeValue PlannedMaintenance { get; } = new EventTypeValue(PlannedMaintenanceValue); + /// HealthAdvisory. + public static EventTypeValue HealthAdvisory { get; } = new EventTypeValue(HealthAdvisoryValue); + /// RCA. + public static EventTypeValue RCA { get; } = new EventTypeValue(RCAValue); + /// EmergingIssues. + public static EventTypeValue EmergingIssues { get; } = new EventTypeValue(EmergingIssuesValue); + /// SecurityAdvisory. + public static EventTypeValue SecurityAdvisory { get; } = new EventTypeValue(SecurityAdvisoryValue); + /// Determines if two values are the same. + public static bool operator ==(EventTypeValue left, EventTypeValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(EventTypeValue left, EventTypeValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator EventTypeValue(string value) => new EventTypeValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is EventTypeValue other && Equals(other); + /// + public bool Equals(EventTypeValue other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Events.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Events.Serialization.cs new file mode 100644 index 0000000000000..f363841e00a00 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Events.Serialization.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + internal partial class Events + { + internal static Events DeserializeEvents(JsonElement element) + { + IReadOnlyList value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EventData.DeserializeEventData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new Events(value, nextLink.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Events.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Events.cs new file mode 100644 index 0000000000000..6b38beee33911 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Events.cs @@ -0,0 +1,43 @@ +// 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.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// The List events operation response. + internal partial class Events + { + /// Initializes a new instance of Events. + /// The list of event. + /// is null. + internal Events(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of Events. + /// The list of event. + /// The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of events. + internal Events(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The list of event. + public IReadOnlyList Value { get; } + /// The URI to fetch the next page of events. Call ListNext() with this URI to fetch the next page of events. + public string NextLink { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Faq.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Faq.Serialization.cs new file mode 100644 index 0000000000000..d303501e7a8f1 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Faq.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class Faq + { + internal static Faq DeserializeFaq(JsonElement element) + { + Optional question = default; + Optional answer = default; + Optional localeCode = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("question"u8)) + { + question = property.Value.GetString(); + continue; + } + if (property.NameEquals("answer"u8)) + { + answer = property.Value.GetString(); + continue; + } + if (property.NameEquals("localeCode"u8)) + { + localeCode = property.Value.GetString(); + continue; + } + } + return new Faq(question.Value, answer.Value, localeCode.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Faq.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Faq.cs new file mode 100644 index 0000000000000..64c5a1f041290 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Faq.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Frequently asked question for the service health event. + public partial class Faq + { + /// Initializes a new instance of Faq. + internal Faq() + { + } + + /// Initializes a new instance of Faq. + /// FAQ question for the service health event. + /// FAQ answer for the service health event. + /// FAQ locale for the service health event. + internal Faq(string question, string answer, string localeCode) + { + Question = question; + Answer = answer; + LocaleCode = localeCode; + } + + /// FAQ question for the service health event. + public string Question { get; } + /// FAQ answer for the service health event. + public string Answer { get; } + /// FAQ locale for the service health event. + public string LocaleCode { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Impact.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Impact.Serialization.cs new file mode 100644 index 0000000000000..28d94ba2f4713 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Impact.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class Impact + { + internal static Impact DeserializeImpact(JsonElement element) + { + Optional impactedService = default; + Optional> impactedRegions = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("impactedService"u8)) + { + impactedService = property.Value.GetString(); + continue; + } + if (property.NameEquals("impactedRegions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ImpactedServiceRegion.DeserializeImpactedServiceRegion(item)); + } + impactedRegions = array; + continue; + } + } + return new Impact(impactedService.Value, Optional.ToList(impactedRegions)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Impact.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Impact.cs new file mode 100644 index 0000000000000..82e07bd483175 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Impact.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Azure service impacted by the service health event. + public partial class Impact + { + /// Initializes a new instance of Impact. + internal Impact() + { + ImpactedRegions = new ChangeTrackingList(); + } + + /// Initializes a new instance of Impact. + /// Impacted service name. + /// List regions impacted by the service health event. + internal Impact(string impactedService, IReadOnlyList impactedRegions) + { + ImpactedService = impactedService; + ImpactedRegions = impactedRegions; + } + + /// Impacted service name. + public string ImpactedService { get; } + /// List regions impacted by the service health event. + public IReadOnlyList ImpactedRegions { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedRegion.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedRegion.Serialization.cs new file mode 100644 index 0000000000000..29049dc8e8621 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedRegion.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class ImpactedRegion + { + internal static ImpactedRegion DeserializeImpactedRegion(JsonElement element) + { + Optional id = default; + Optional name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + } + return new ImpactedRegion(id.Value, name.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedRegion.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedRegion.cs new file mode 100644 index 0000000000000..a227359f87432 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedRegion.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Object of impacted region. + public partial class ImpactedRegion + { + /// Initializes a new instance of ImpactedRegion. + internal ImpactedRegion() + { + } + + /// Initializes a new instance of ImpactedRegion. + /// The impacted region id. + /// The impacted region name. + internal ImpactedRegion(string id, string name) + { + Id = id; + Name = name; + } + + /// The impacted region id. + public string Id { get; } + /// The impacted region name. + public string Name { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedServiceRegion.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedServiceRegion.Serialization.cs new file mode 100644 index 0000000000000..ccde3be67ab31 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedServiceRegion.Serialization.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; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class ImpactedServiceRegion + { + internal static ImpactedServiceRegion DeserializeImpactedServiceRegion(JsonElement element) + { + Optional impactedRegion = default; + Optional status = default; + Optional> impactedSubscriptions = default; + Optional> impactedTenants = default; + Optional lastUpdateTime = default; + Optional> updates = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("impactedRegion"u8)) + { + impactedRegion = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new EventStatusValue(property.Value.GetString()); + continue; + } + if (property.NameEquals("impactedSubscriptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + impactedSubscriptions = array; + continue; + } + if (property.NameEquals("impactedTenants"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + impactedTenants = array; + continue; + } + if (property.NameEquals("lastUpdateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + lastUpdateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updates"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Update.DeserializeUpdate(item)); + } + updates = array; + continue; + } + } + return new ImpactedServiceRegion(impactedRegion.Value, Optional.ToNullable(status), Optional.ToList(impactedSubscriptions), Optional.ToList(impactedTenants), Optional.ToNullable(lastUpdateTime), Optional.ToList(updates)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedServiceRegion.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedServiceRegion.cs new file mode 100644 index 0000000000000..929a4b4f4e07c --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ImpactedServiceRegion.cs @@ -0,0 +1,55 @@ +// 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.ResourceHealth.Models +{ + /// Azure region impacted by the service health event. + public partial class ImpactedServiceRegion + { + /// Initializes a new instance of ImpactedServiceRegion. + internal ImpactedServiceRegion() + { + ImpactedSubscriptions = new ChangeTrackingList(); + ImpactedTenants = new ChangeTrackingList(); + Updates = new ChangeTrackingList(); + } + + /// Initializes a new instance of ImpactedServiceRegion. + /// Impacted region name. + /// Current status of event in the region. + /// List subscription impacted by the service health event. + /// List tenant impacted by the service health event. + /// It provides the Timestamp for when the last update for the service health event. + /// List of updates for given service health event. + internal ImpactedServiceRegion(string impactedRegion, EventStatusValue? status, IReadOnlyList impactedSubscriptions, IReadOnlyList impactedTenants, DateTimeOffset? lastUpdateOn, IReadOnlyList updates) + { + ImpactedRegion = impactedRegion; + Status = status; + ImpactedSubscriptions = impactedSubscriptions; + ImpactedTenants = impactedTenants; + LastUpdateOn = lastUpdateOn; + Updates = updates; + } + + /// Impacted region name. + public string ImpactedRegion { get; } + /// Current status of event in the region. + public EventStatusValue? Status { get; } + /// List subscription impacted by the service health event. + public IReadOnlyList ImpactedSubscriptions { get; } + /// List tenant impacted by the service health event. + public IReadOnlyList ImpactedTenants { get; } + /// It provides the Timestamp for when the last update for the service health event. + public DateTimeOffset? LastUpdateOn { get; } + /// List of updates for given service health event. + public IReadOnlyList Updates { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/IssueNameParameter.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/IssueNameParameter.cs new file mode 100644 index 0000000000000..122daa0a37e96 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/IssueNameParameter.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// The IssueNameParameter. + public readonly partial struct IssueNameParameter : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IssueNameParameter(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DefaultValue = "default"; + + /// default. + public static IssueNameParameter Default { get; } = new IssueNameParameter(DefaultValue); + /// Determines if two values are the same. + public static bool operator ==(IssueNameParameter left, IssueNameParameter right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IssueNameParameter left, IssueNameParameter right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator IssueNameParameter(string value) => new IssueNameParameter(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IssueNameParameter other && Equals(other); + /// + public bool Equals(IssueNameParameter other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/KeyValueItem.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/KeyValueItem.Serialization.cs new file mode 100644 index 0000000000000..fce3af26d0129 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/KeyValueItem.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class KeyValueItem + { + internal static KeyValueItem DeserializeKeyValueItem(JsonElement element) + { + Optional key = default; + Optional value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("key"u8)) + { + key = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + } + return new KeyValueItem(key.Value, value.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/KeyValueItem.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/KeyValueItem.cs new file mode 100644 index 0000000000000..53f142585dd35 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/KeyValueItem.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Key value tuple. + public partial class KeyValueItem + { + /// Initializes a new instance of KeyValueItem. + internal KeyValueItem() + { + } + + /// Initializes a new instance of KeyValueItem. + /// Key of tuple. + /// Value of tuple. + internal KeyValueItem(string key, string value) + { + Key = key; + Value = value; + } + + /// Key of tuple. + public string Key { get; } + /// Value of tuple. + public string Value { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LevelValue.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LevelValue.cs new file mode 100644 index 0000000000000..d013f76fad2c6 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LevelValue.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.ResourceHealth.Models +{ + /// Level of insight. + public readonly partial struct LevelValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LevelValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CriticalValue = "Critical"; + private const string WarningValue = "Warning"; + + /// Critical. + public static LevelValue Critical { get; } = new LevelValue(CriticalValue); + /// Warning. + public static LevelValue Warning { get; } = new LevelValue(WarningValue); + /// Determines if two values are the same. + public static bool operator ==(LevelValue left, LevelValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LevelValue left, LevelValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LevelValue(string value) => new LevelValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LevelValue other && Equals(other); + /// + public bool Equals(LevelValue other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Link.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Link.Serialization.cs new file mode 100644 index 0000000000000..5641e193d6149 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Link.Serialization.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class Link + { + internal static Link DeserializeLink(JsonElement element) + { + Optional type = default; + Optional displayText = default; + Optional extensionName = default; + Optional bladeName = default; + Optional parameters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = new LinkTypeValue(property.Value.GetString()); + continue; + } + if (property.NameEquals("displayText"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + displayText = LinkDisplayText.DeserializeLinkDisplayText(property.Value); + continue; + } + if (property.NameEquals("extensionName"u8)) + { + extensionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("bladeName"u8)) + { + bladeName = property.Value.GetString(); + continue; + } + if (property.NameEquals("parameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + parameters = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + } + return new Link(Optional.ToNullable(type), displayText.Value, extensionName.Value, bladeName.Value, parameters.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Link.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Link.cs new file mode 100644 index 0000000000000..064113ebf81f1 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Link.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Useful links for service health event. + public partial class Link + { + /// Initializes a new instance of Link. + internal Link() + { + } + + /// Initializes a new instance of Link. + /// Type of link. + /// Display text of link. + /// It provides the name of portal extension to produce link for given service health event. + /// It provides the name of portal extension blade to produce link for given service health event. + /// It provides a map of parameter name and value for portal extension blade to produce lik for given service health event. + internal Link(LinkTypeValue? linkType, LinkDisplayText displayText, string extensionName, string bladeName, BinaryData parameters) + { + LinkType = linkType; + DisplayText = displayText; + ExtensionName = extensionName; + BladeName = bladeName; + Parameters = parameters; + } + + /// Type of link. + public LinkTypeValue? LinkType { get; } + /// Display text of link. + public LinkDisplayText DisplayText { get; } + /// It provides the name of portal extension to produce link for given service health event. + public string ExtensionName { get; } + /// It provides the name of portal extension blade to produce link for given service health event. + public string BladeName { get; } + /// + /// It provides a map of parameter name and value for portal extension blade to produce lik for given service health event. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formated 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" }. + /// + /// + /// + /// + public BinaryData Parameters { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LinkDisplayText.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LinkDisplayText.Serialization.cs new file mode 100644 index 0000000000000..9aed841c4bd64 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LinkDisplayText.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class LinkDisplayText + { + internal static LinkDisplayText DeserializeLinkDisplayText(JsonElement element) + { + Optional value = default; + Optional localizedValue = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("localizedValue"u8)) + { + localizedValue = property.Value.GetString(); + continue; + } + } + return new LinkDisplayText(value.Value, localizedValue.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LinkDisplayText.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LinkDisplayText.cs new file mode 100644 index 0000000000000..78b4d41c821c4 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LinkDisplayText.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Display text of link. + public partial class LinkDisplayText + { + /// Initializes a new instance of LinkDisplayText. + internal LinkDisplayText() + { + } + + /// Initializes a new instance of LinkDisplayText. + /// Display text of link. + /// Localized display text of link. + internal LinkDisplayText(string value, string localizedValue) + { + Value = value; + LocalizedValue = localizedValue; + } + + /// Display text of link. + public string Value { get; } + /// Localized display text of link. + public string LocalizedValue { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LinkTypeValue.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LinkTypeValue.cs new file mode 100644 index 0000000000000..f1ffffead657b --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/LinkTypeValue.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.ResourceHealth.Models +{ + /// Type of link. + public readonly partial struct LinkTypeValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public LinkTypeValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ButtonValue = "Button"; + private const string HyperlinkValue = "Hyperlink"; + + /// Button. + public static LinkTypeValue Button { get; } = new LinkTypeValue(ButtonValue); + /// Hyperlink. + public static LinkTypeValue Hyperlink { get; } = new LinkTypeValue(HyperlinkValue); + /// Determines if two values are the same. + public static bool operator ==(LinkTypeValue left, LinkTypeValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(LinkTypeValue left, LinkTypeValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator LinkTypeValue(string value) => new LinkTypeValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is LinkTypeValue other && Equals(other); + /// + public bool Equals(LinkTypeValue other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataEntityData.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataEntityData.Serialization.cs new file mode 100644 index 0000000000000..6dd47d6705b7b --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataEntityData.Serialization.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + public partial class MetadataEntityData + { + internal static MetadataEntityData DeserializeMetadataEntityData(JsonElement element) + { + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional displayName = default; + Optional> dependsOn = default; + Optional> applicableScenarios = default; + Optional> supportedValues = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("displayName"u8)) + { + displayName = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("dependsOn"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dependsOn = array; + continue; + } + if (property0.NameEquals("applicableScenarios"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(new Scenario(item.GetString())); + } + applicableScenarios = array; + continue; + } + if (property0.NameEquals("supportedValues"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(MetadataSupportedValueDetail.DeserializeMetadataSupportedValueDetail(item)); + } + supportedValues = array; + continue; + } + } + continue; + } + } + return new MetadataEntityData(id, name, type, systemData.Value, displayName.Value, Optional.ToList(dependsOn), Optional.ToList(applicableScenarios), Optional.ToList(supportedValues)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataEntityListResult.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataEntityListResult.Serialization.cs new file mode 100644 index 0000000000000..34fdbe3860a1c --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataEntityListResult.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + internal partial class MetadataEntityListResult + { + internal static MetadataEntityListResult DeserializeMetadataEntityListResult(JsonElement element) + { + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(MetadataEntityData.DeserializeMetadataEntityData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new MetadataEntityListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataEntityListResult.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataEntityListResult.cs new file mode 100644 index 0000000000000..dcb65884cf940 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataEntityListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.ResourceHealth; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// The list of metadata entities. + internal partial class MetadataEntityListResult + { + /// Initializes a new instance of MetadataEntityListResult. + internal MetadataEntityListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of MetadataEntityListResult. + /// The list of metadata entities. + /// The link used to get the next page of metadata. + internal MetadataEntityListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// The list of metadata entities. + public IReadOnlyList Value { get; } + /// The link used to get the next page of metadata. + public string NextLink { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataSupportedValueDetail.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataSupportedValueDetail.Serialization.cs new file mode 100644 index 0000000000000..4e4dae5b975f9 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataSupportedValueDetail.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class MetadataSupportedValueDetail + { + internal static MetadataSupportedValueDetail DeserializeMetadataSupportedValueDetail(JsonElement element) + { + Optional id = default; + Optional displayName = default; + Optional> resourceTypes = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + resourceTypes = array; + continue; + } + } + return new MetadataSupportedValueDetail(id.Value, displayName.Value, Optional.ToList(resourceTypes)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataSupportedValueDetail.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataSupportedValueDetail.cs new file mode 100644 index 0000000000000..6854cfe61153b --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/MetadataSupportedValueDetail.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// The metadata supported value detail. + public partial class MetadataSupportedValueDetail + { + /// Initializes a new instance of MetadataSupportedValueDetail. + internal MetadataSupportedValueDetail() + { + ResourceTypes = new ChangeTrackingList(); + } + + /// Initializes a new instance of MetadataSupportedValueDetail. + /// The id. + /// The display name. + /// The list of associated resource types. + internal MetadataSupportedValueDetail(string id, string displayName, IReadOnlyList resourceTypes) + { + Id = id; + DisplayName = displayName; + ResourceTypes = resourceTypes; + } + + /// The id. + public string Id { get; } + /// The display name. + public string DisplayName { get; } + /// The list of associated resource types. + public IReadOnlyList ResourceTypes { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ReasonChronicityType.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ReasonChronicityType.cs new file mode 100644 index 0000000000000..0974ed010c322 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ReasonChronicityType.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.ResourceHealth.Models +{ + /// Chronicity of the availability transition. + public readonly partial struct ReasonChronicityType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ReasonChronicityType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TransientValue = "Transient"; + private const string PersistentValue = "Persistent"; + + /// Transient. + public static ReasonChronicityType Transient { get; } = new ReasonChronicityType(TransientValue); + /// Persistent. + public static ReasonChronicityType Persistent { get; } = new ReasonChronicityType(PersistentValue); + /// Determines if two values are the same. + public static bool operator ==(ReasonChronicityType left, ReasonChronicityType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ReasonChronicityType left, ReasonChronicityType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ReasonChronicityType(string value) => new ReasonChronicityType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReasonChronicityType other && Equals(other); + /// + public bool Equals(ReasonChronicityType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/RecommendedAction.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/RecommendedAction.Serialization.cs new file mode 100644 index 0000000000000..62ad0db2be5e2 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/RecommendedAction.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class RecommendedAction + { + internal static RecommendedAction DeserializeRecommendedAction(JsonElement element) + { + Optional action = default; + Optional actionUrl = default; + Optional actionUrlText = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("action"u8)) + { + action = property.Value.GetString(); + continue; + } + if (property.NameEquals("actionUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + actionUrl = null; + continue; + } + actionUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("actionUrlText"u8)) + { + actionUrlText = property.Value.GetString(); + continue; + } + } + return new RecommendedAction(action.Value, actionUrl.Value, actionUrlText.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/RecommendedAction.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/RecommendedAction.cs new file mode 100644 index 0000000000000..9d25e912fa154 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/RecommendedAction.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Lists actions the user can take based on the current availabilityState of the resource. + public partial class RecommendedAction + { + /// Initializes a new instance of RecommendedAction. + internal RecommendedAction() + { + } + + /// Initializes a new instance of RecommendedAction. + /// Recommended action. + /// Link to the action. + /// Substring of action, it describes which text should host the action url. + internal RecommendedAction(string action, Uri actionUri, string actionUrlText) + { + Action = action; + ActionUri = actionUri; + ActionUrlText = actionUrlText; + } + + /// Recommended action. + public string Action { get; } + /// Link to the action. + public Uri ActionUri { get; } + /// Substring of action, it describes which text should host the action url. + public string ActionUrlText { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Scenario.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Scenario.cs new file mode 100644 index 0000000000000..74a62a769f167 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Scenario.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// The Scenario. + public readonly partial struct Scenario : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Scenario(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AlertsValue = "Alerts"; + + /// Alerts. + public static Scenario Alerts { get; } = new Scenario(AlertsValue); + /// Determines if two values are the same. + public static bool operator ==(Scenario left, Scenario right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Scenario left, Scenario right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator Scenario(string value) => new Scenario(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Scenario other && Equals(other); + /// + public bool Equals(Scenario other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEvent.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEvent.Serialization.cs new file mode 100644 index 0000000000000..fb6f708fcb46b --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEvent.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class ServiceImpactingEvent + { + internal static ServiceImpactingEvent DeserializeServiceImpactingEvent(JsonElement element) + { + Optional eventStartTime = default; + Optional eventStatusLastModifiedTime = default; + Optional correlationId = default; + Optional status = default; + Optional incidentProperties = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("eventStartTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + eventStartTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("eventStatusLastModifiedTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + eventStatusLastModifiedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("correlationId"u8)) + { + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = ServiceImpactingEventStatus.DeserializeServiceImpactingEventStatus(property.Value); + continue; + } + if (property.NameEquals("incidentProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + incidentProperties = ServiceImpactingEventIncidentProperties.DeserializeServiceImpactingEventIncidentProperties(property.Value); + continue; + } + } + return new ServiceImpactingEvent(Optional.ToNullable(eventStartTime), Optional.ToNullable(eventStatusLastModifiedTime), correlationId.Value, status.Value, incidentProperties.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEvent.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEvent.cs new file mode 100644 index 0000000000000..db34ca9d1b904 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEvent.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Lists the service impacting events that may be affecting the health of the resource. + public partial class ServiceImpactingEvent + { + /// Initializes a new instance of ServiceImpactingEvent. + internal ServiceImpactingEvent() + { + } + + /// Initializes a new instance of ServiceImpactingEvent. + /// Timestamp for when the event started. + /// Timestamp for when event was submitted/detected. + /// Correlation id for the event. + /// Status of the service impacting event. + /// Properties of the service impacting event. + internal ServiceImpactingEvent(DateTimeOffset? eventStartOn, DateTimeOffset? eventStatusLastModifiedOn, string correlationId, ServiceImpactingEventStatus status, ServiceImpactingEventIncidentProperties incidentProperties) + { + EventStartOn = eventStartOn; + EventStatusLastModifiedOn = eventStatusLastModifiedOn; + CorrelationId = correlationId; + Status = status; + IncidentProperties = incidentProperties; + } + + /// Timestamp for when the event started. + public DateTimeOffset? EventStartOn { get; } + /// Timestamp for when event was submitted/detected. + public DateTimeOffset? EventStatusLastModifiedOn { get; } + /// Correlation id for the event. + public string CorrelationId { get; } + /// Status of the service impacting event. + internal ServiceImpactingEventStatus Status { get; } + /// Current status of the event. + public string StatusValue + { + get => Status?.Value; + } + + /// Properties of the service impacting event. + public ServiceImpactingEventIncidentProperties IncidentProperties { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventIncidentProperties.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventIncidentProperties.Serialization.cs new file mode 100644 index 0000000000000..707631efa00b0 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventIncidentProperties.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class ServiceImpactingEventIncidentProperties + { + internal static ServiceImpactingEventIncidentProperties DeserializeServiceImpactingEventIncidentProperties(JsonElement element) + { + Optional title = default; + Optional service = default; + Optional region = default; + Optional incidentType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("service"u8)) + { + service = property.Value.GetString(); + continue; + } + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("incidentType"u8)) + { + incidentType = property.Value.GetString(); + continue; + } + } + return new ServiceImpactingEventIncidentProperties(title.Value, service.Value, region.Value, incidentType.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventIncidentProperties.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventIncidentProperties.cs new file mode 100644 index 0000000000000..301d54f4f2cb6 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventIncidentProperties.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Properties of the service impacting event. + public partial class ServiceImpactingEventIncidentProperties + { + /// Initializes a new instance of ServiceImpactingEventIncidentProperties. + internal ServiceImpactingEventIncidentProperties() + { + } + + /// Initializes a new instance of ServiceImpactingEventIncidentProperties. + /// Title of the incident. + /// Service impacted by the event. + /// Region impacted by the event. + /// Type of Event. + internal ServiceImpactingEventIncidentProperties(string title, string service, string region, string incidentType) + { + Title = title; + Service = service; + Region = region; + IncidentType = incidentType; + } + + /// Title of the incident. + public string Title { get; } + /// Service impacted by the event. + public string Service { get; } + /// Region impacted by the event. + public string Region { get; } + /// Type of Event. + public string IncidentType { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventStatus.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventStatus.Serialization.cs new file mode 100644 index 0000000000000..7050b0a6b033b --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventStatus.Serialization.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + internal partial class ServiceImpactingEventStatus + { + internal static ServiceImpactingEventStatus DeserializeServiceImpactingEventStatus(JsonElement element) + { + Optional value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + } + return new ServiceImpactingEventStatus(value.Value); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventStatus.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventStatus.cs new file mode 100644 index 0000000000000..88286c5addbc4 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/ServiceImpactingEventStatus.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Status of the service impacting event. + internal partial class ServiceImpactingEventStatus + { + /// Initializes a new instance of ServiceImpactingEventStatus. + internal ServiceImpactingEventStatus() + { + } + + /// Initializes a new instance of ServiceImpactingEventStatus. + /// Current status of the event. + internal ServiceImpactingEventStatus(string value) + { + Value = value; + } + + /// Current status of the event. + public string Value { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/SeverityValue.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/SeverityValue.cs new file mode 100644 index 0000000000000..feb96bedc0b15 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/SeverityValue.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.ResourceHealth.Models +{ + /// The severity level of this active event. + public readonly partial struct SeverityValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SeverityValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InformationValue = "Information"; + private const string WarningValue = "Warning"; + private const string ErrorValue = "Error"; + + /// Information. + public static SeverityValue Information { get; } = new SeverityValue(InformationValue); + /// Warning. + public static SeverityValue Warning { get; } = new SeverityValue(WarningValue); + /// Error. + public static SeverityValue Error { get; } = new SeverityValue(ErrorValue); + /// Determines if two values are the same. + public static bool operator ==(SeverityValue left, SeverityValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SeverityValue left, SeverityValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SeverityValue(string value) => new SeverityValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SeverityValue other && Equals(other); + /// + public bool Equals(SeverityValue other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StageValue.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StageValue.cs new file mode 100644 index 0000000000000..d70548a820684 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StageValue.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.ResourceHealth.Models +{ + /// The stage of this active event. + public readonly partial struct StageValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StageValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "Active"; + private const string ResolveValue = "Resolve"; + private const string ArchivedValue = "Archived"; + + /// Active. + public static StageValue Active { get; } = new StageValue(ActiveValue); + /// Resolve. + public static StageValue Resolve { get; } = new StageValue(ResolveValue); + /// Archived. + public static StageValue Archived { get; } = new StageValue(ArchivedValue); + /// Determines if two values are the same. + public static bool operator ==(StageValue left, StageValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StageValue left, StageValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator StageValue(string value) => new StageValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StageValue other && Equals(other); + /// + public bool Equals(StageValue other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusActiveEvent.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusActiveEvent.Serialization.cs new file mode 100644 index 0000000000000..99fc8b81d9100 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusActiveEvent.Serialization.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class StatusActiveEvent + { + internal static StatusActiveEvent DeserializeStatusActiveEvent(JsonElement element) + { + Optional title = default; + Optional description = default; + Optional trackingId = default; + Optional startTime = default; + Optional cloud = default; + Optional severity = default; + Optional stage = default; + Optional published = default; + Optional lastModifiedTime = default; + Optional> impacts = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("trackingId"u8)) + { + trackingId = property.Value.GetString(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("cloud"u8)) + { + cloud = property.Value.GetString(); + continue; + } + if (property.NameEquals("severity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + severity = new SeverityValue(property.Value.GetString()); + continue; + } + if (property.NameEquals("stage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + stage = new StageValue(property.Value.GetString()); + continue; + } + if (property.NameEquals("published"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + published = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("lastModifiedTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + lastModifiedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("impacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(EmergingIssueImpact.DeserializeEmergingIssueImpact(item)); + } + impacts = array; + continue; + } + } + return new StatusActiveEvent(title.Value, description.Value, trackingId.Value, Optional.ToNullable(startTime), cloud.Value, Optional.ToNullable(severity), Optional.ToNullable(stage), Optional.ToNullable(published), Optional.ToNullable(lastModifiedTime), Optional.ToList(impacts)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusActiveEvent.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusActiveEvent.cs new file mode 100644 index 0000000000000..cc64e9175a25c --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusActiveEvent.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Active event type of emerging issue. + public partial class StatusActiveEvent + { + /// Initializes a new instance of StatusActiveEvent. + internal StatusActiveEvent() + { + Impacts = new ChangeTrackingList(); + } + + /// Initializes a new instance of StatusActiveEvent. + /// The active event title. + /// The details of active event. + /// The tracking id of this active event. + /// The impact start time on this active event. + /// The cloud type of this active event. + /// The severity level of this active event. + /// The stage of this active event. + /// The boolean value of this active event if published or not. + /// The last time modified on this banner. + /// The list of emerging issues impacts. + internal StatusActiveEvent(string title, string description, string trackingId, DateTimeOffset? startOn, string cloud, SeverityValue? severity, StageValue? stage, bool? published, DateTimeOffset? lastModifiedOn, IReadOnlyList impacts) + { + Title = title; + Description = description; + TrackingId = trackingId; + StartOn = startOn; + Cloud = cloud; + Severity = severity; + Stage = stage; + Published = published; + LastModifiedOn = lastModifiedOn; + Impacts = impacts; + } + + /// The active event title. + public string Title { get; } + /// The details of active event. + public string Description { get; } + /// The tracking id of this active event. + public string TrackingId { get; } + /// The impact start time on this active event. + public DateTimeOffset? StartOn { get; } + /// The cloud type of this active event. + public string Cloud { get; } + /// The severity level of this active event. + public SeverityValue? Severity { get; } + /// The stage of this active event. + public StageValue? Stage { get; } + /// The boolean value of this active event if published or not. + public bool? Published { get; } + /// The last time modified on this banner. + public DateTimeOffset? LastModifiedOn { get; } + /// The list of emerging issues impacts. + public IReadOnlyList Impacts { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusBanner.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusBanner.Serialization.cs new file mode 100644 index 0000000000000..c55a6746f72e9 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusBanner.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class StatusBanner + { + internal static StatusBanner DeserializeStatusBanner(JsonElement element) + { + Optional title = default; + Optional message = default; + Optional cloud = default; + Optional lastModifiedTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("cloud"u8)) + { + cloud = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastModifiedTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + lastModifiedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new StatusBanner(title.Value, message.Value, cloud.Value, Optional.ToNullable(lastModifiedTime)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusBanner.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusBanner.cs new file mode 100644 index 0000000000000..3bf4bb3ca1eb9 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/StatusBanner.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Banner type of emerging issue. + public partial class StatusBanner + { + /// Initializes a new instance of StatusBanner. + internal StatusBanner() + { + } + + /// Initializes a new instance of StatusBanner. + /// The banner title. + /// The details of banner. + /// The cloud type of this banner. + /// The last time modified on this banner. + internal StatusBanner(string title, string message, string cloud, DateTimeOffset? lastModifiedOn) + { + Title = title; + Message = message; + Cloud = cloud; + LastModifiedOn = lastModifiedOn; + } + + /// The banner title. + public string Title { get; } + /// The details of banner. + public string Message { get; } + /// The cloud type of this banner. + public string Cloud { get; } + /// The last time modified on this banner. + public DateTimeOffset? LastModifiedOn { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Update.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Update.Serialization.cs new file mode 100644 index 0000000000000..8f4a71f61aee4 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Update.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + public partial class Update + { + internal static Update DeserializeUpdate(JsonElement element) + { + Optional summary = default; + Optional updateDateTime = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("summary"u8)) + { + summary = property.Value.GetString(); + continue; + } + if (property.NameEquals("updateDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + updateDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new Update(summary.Value, Optional.ToNullable(updateDateTime)); + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Update.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Update.cs new file mode 100644 index 0000000000000..15c24fd627dbc --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/Models/Update.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.ResourceHealth.Models +{ + /// Update for service health event. + public partial class Update + { + /// Initializes a new instance of Update. + internal Update() + { + } + + /// Initializes a new instance of Update. + /// Summary text for the given update for the service health event. + /// It provides the Timestamp for the given update for the service health event. + internal Update(string summary, DateTimeOffset? updateOn) + { + Summary = summary; + UpdateOn = updateOn; + } + + /// Summary text for the given update for the service health event. + public string Summary { get; } + /// It provides the Timestamp for the given update for the service health event. + public DateTimeOffset? UpdateOn { get; } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ProviderConstants.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/ProviderConstants.cs new file mode 100644 index 0000000000000..56228ffa8ed3d --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/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.ResourceHealth +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/AvailabilityStatusesRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/AvailabilityStatusesRestOperations.cs new file mode 100644 index 0000000000000..f059be928d80a --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/AvailabilityStatusesRestOperations.cs @@ -0,0 +1,580 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + internal partial class AvailabilityStatusesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of AvailabilityStatusesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public AvailabilityStatusesRestOperations(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 ?? "2022-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListBySubscriptionIdRequest(string subscriptionId, string filter, string expand) + { + 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.ResourceHealth/availabilityStatuses", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the current availability status for all the resources in the subscription. + /// The ID of the target subscription. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionIdAsync(string subscriptionId, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionIdRequest(subscriptionId, filter, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the current availability status for all the resources in the subscription. + /// The ID of the target subscription. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionId(string subscriptionId, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionIdRequest(subscriptionId, filter, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName, string filter, string expand) + { + 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.ResourceHealth/availabilityStatuses", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the current availability status for all the resources in the resource group. + /// The ID of the target subscription. + /// The name of the resource group. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// 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, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the current availability status for all the resources in the resource group. + /// The ID of the target subscription. + /// The name of the resource group. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// 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, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName, filter, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetByResourceRequest(string resourceUri, string filter, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ResourceHealth/availabilityStatuses/current", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets current availability status for a single resource. + /// The fully qualified ID of the resource, including the resource name and resource type. Currently the API support not nested and one nesting level resource types : /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} and /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// is null. + public async Task> GetByResourceAsync(string resourceUri, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateGetByResourceRequest(resourceUri, filter, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AvailabilityStatusData.DeserializeAvailabilityStatusData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AvailabilityStatusData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets current availability status for a single resource. + /// The fully qualified ID of the resource, including the resource name and resource type. Currently the API support not nested and one nesting level resource types : /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} and /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// is null. + public Response GetByResource(string resourceUri, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateGetByResourceRequest(resourceUri, filter, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AvailabilityStatusData.DeserializeAvailabilityStatusData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((AvailabilityStatusData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string resourceUri, string filter, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ResourceHealth/availabilityStatuses", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (expand != null) + { + uri.AppendQuery("$expand", expand, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all historical availability transitions and impacting events for a single resource. + /// The fully qualified ID of the resource, including the resource name and resource type. Currently the API support not nested and one nesting level resource types : /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} and /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// is null. + public async Task> ListAsync(string resourceUri, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListRequest(resourceUri, filter, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all historical availability transitions and impacting events for a single resource. + /// The fully qualified ID of the resource, including the resource name and resource type. Currently the API support not nested and one nesting level resource types : /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} and /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// is null. + public Response List(string resourceUri, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListRequest(resourceUri, filter, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionIdNextPageRequest(string nextLink, string subscriptionId, string filter, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the current availability status for all the resources in the subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionIdNextPageAsync(string nextLink, string subscriptionId, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionIdNextPageRequest(nextLink, subscriptionId, filter, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the current availability status for all the resources in the subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionIdNextPage(string nextLink, string subscriptionId, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionIdNextPageRequest(nextLink, subscriptionId, filter, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string filter, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists the current availability status for all the resources in the resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// 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, string filter = null, string expand = null, 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, filter, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists the current availability status for all the resources in the resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// 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, string filter = null, string expand = null, 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, filter, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string resourceUri, string filter, string expand) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists all historical availability transitions and impacting events for a single resource. + /// The URL to the next page of results. + /// The fully qualified ID of the resource, including the resource name and resource type. Currently the API support not nested and one nesting level resource types : /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} and /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// or is null. + public async Task> ListNextPageAsync(string nextLink, string resourceUri, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListNextPageRequest(nextLink, resourceUri, filter, expand); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists all historical availability transitions and impacting events for a single resource. + /// The URL to the next page of results. + /// The fully qualified ID of the resource, including the resource name and resource type. Currently the API support not nested and one nesting level resource types : /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} and /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Setting $expand=recommendedactions in url query expands the recommendedactions in the response. + /// The cancellation token to use. + /// or is null. + public Response ListNextPage(string nextLink, string resourceUri, string filter = null, string expand = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListNextPageRequest(nextLink, resourceUri, filter, expand); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + AvailabilityStatusListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = AvailabilityStatusListResult.DeserializeAvailabilityStatusListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EmergingIssuesRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EmergingIssuesRestOperations.cs new file mode 100644 index 0000000000000..07bcf97781199 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EmergingIssuesRestOperations.cs @@ -0,0 +1,219 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + internal partial class EmergingIssuesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of EmergingIssuesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public EmergingIssuesRestOperations(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 ?? "2022-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ResourceHealth/emergingIssues", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists Azure services' emerging issues. + /// The cancellation token to use. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EmergingIssueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EmergingIssueListResult.DeserializeEmergingIssueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists Azure services' emerging issues. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EmergingIssueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EmergingIssueListResult.DeserializeEmergingIssueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(IssueNameParameter issueName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ResourceHealth/emergingIssues/", false); + uri.AppendPath(issueName.ToString(), true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets Azure services' emerging issues. + /// The name of the emerging issue. + /// The cancellation token to use. + public async Task> GetAsync(IssueNameParameter issueName, CancellationToken cancellationToken = default) + { + using var message = CreateGetRequest(issueName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EmergingIssuesGetResultData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EmergingIssuesGetResultData.DeserializeEmergingIssuesGetResultData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EmergingIssuesGetResultData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets Azure services' emerging issues. + /// The name of the emerging issue. + /// The cancellation token to use. + public Response Get(IssueNameParameter issueName, CancellationToken cancellationToken = default) + { + using var message = CreateGetRequest(issueName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EmergingIssuesGetResultData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EmergingIssuesGetResultData.DeserializeEmergingIssuesGetResultData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EmergingIssuesGetResultData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists Azure services' emerging issues. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EmergingIssueListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EmergingIssueListResult.DeserializeEmergingIssueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists Azure services' emerging issues. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EmergingIssueListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EmergingIssueListResult.DeserializeEmergingIssueListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventRestOperations.cs new file mode 100644 index 0000000000000..d02a7f11e61fb --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventRestOperations.cs @@ -0,0 +1,349 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.ResourceHealth +{ + internal partial class EventRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of EventRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public EventRestOperations(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 ?? "2022-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetBySubscriptionIdAndTrackingIdRequest(string subscriptionId, string eventTrackingId, string filter, string queryStartTime) + { + 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.ResourceHealth/events/", false); + uri.AppendPath(eventTrackingId, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (queryStartTime != null) + { + uri.AppendQuery("queryStartTime", queryStartTime, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Service health event in the subscription by event tracking id. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetBySubscriptionIdAndTrackingIdAsync(string subscriptionId, string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateGetBySubscriptionIdAndTrackingIdRequest(subscriptionId, eventTrackingId, filter, queryStartTime); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventData.DeserializeEventData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EventData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Service health event in the subscription by event tracking id. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response GetBySubscriptionIdAndTrackingId(string subscriptionId, string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateGetBySubscriptionIdAndTrackingIdRequest(subscriptionId, eventTrackingId, filter, queryStartTime); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventData.DeserializeEventData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EventData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateFetchDetailsBySubscriptionIdAndTrackingIdRequest(string subscriptionId, string eventTrackingId) + { + 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("/providers/Microsoft.ResourceHealth/events/", false); + uri.AppendPath(eventTrackingId, true); + uri.AppendPath("/fetchEventDetails", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> FetchDetailsBySubscriptionIdAndTrackingIdAsync(string subscriptionId, string eventTrackingId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateFetchDetailsBySubscriptionIdAndTrackingIdRequest(subscriptionId, eventTrackingId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventData.DeserializeEventData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response FetchDetailsBySubscriptionIdAndTrackingId(string subscriptionId, string eventTrackingId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateFetchDetailsBySubscriptionIdAndTrackingIdRequest(subscriptionId, eventTrackingId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventData.DeserializeEventData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetByTenantIdAndTrackingIdRequest(string eventTrackingId, string filter, string queryStartTime) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ResourceHealth/events/", false); + uri.AppendPath(eventTrackingId, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (queryStartTime != null) + { + uri.AppendQuery("queryStartTime", queryStartTime, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Service health event in the tenant by event tracking id. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GetByTenantIdAndTrackingIdAsync(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateGetByTenantIdAndTrackingIdRequest(eventTrackingId, filter, queryStartTime); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventData.DeserializeEventData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EventData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Service health event in the tenant by event tracking id. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response GetByTenantIdAndTrackingId(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateGetByTenantIdAndTrackingIdRequest(eventTrackingId, filter, queryStartTime); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventData.DeserializeEventData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EventData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateFetchDetailsByTenantIdAndTrackingIdRequest(string eventTrackingId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ResourceHealth/events/", false); + uri.AppendPath(eventTrackingId, true); + uri.AppendPath("/fetchEventDetails", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events. + /// Event Id which uniquely identifies ServiceHealth event. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> FetchDetailsByTenantIdAndTrackingIdAsync(string eventTrackingId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateFetchDetailsByTenantIdAndTrackingIdRequest(eventTrackingId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventData.DeserializeEventData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events. + /// Event Id which uniquely identifies ServiceHealth event. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response FetchDetailsByTenantIdAndTrackingId(string eventTrackingId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateFetchDetailsByTenantIdAndTrackingIdRequest(eventTrackingId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventData.DeserializeEventData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventsRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventsRestOperations.cs new file mode 100644 index 0000000000000..bc4ea1a823fe9 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/EventsRestOperations.cs @@ -0,0 +1,463 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + internal partial class EventsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of EventsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public EventsRestOperations(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 ?? "2022-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListBySubscriptionIdRequest(string subscriptionId, string filter, string queryStartTime) + { + 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.ResourceHealth/events", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (queryStartTime != null) + { + uri.AppendQuery("queryStartTime", queryStartTime, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists service health events in the subscription. + /// The ID of the target subscription. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionIdAsync(string subscriptionId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionIdRequest(subscriptionId, filter, queryStartTime); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists service health events in the subscription. + /// The ID of the target subscription. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionId(string subscriptionId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionIdRequest(subscriptionId, filter, queryStartTime); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByTenantIdRequest(string filter, string queryStartTime) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ResourceHealth/events", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + if (queryStartTime != null) + { + uri.AppendQuery("queryStartTime", queryStartTime, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists current service health events in the tenant. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + public async Task> ListByTenantIdAsync(string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + using var message = CreateListByTenantIdRequest(filter, queryStartTime); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists current service health events in the tenant. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + public Response ListByTenantId(string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + using var message = CreateListByTenantIdRequest(filter, queryStartTime); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySingleResourceRequest(string resourceUri, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendPath(resourceUri, false); + uri.AppendPath("/providers/Microsoft.ResourceHealth/events", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists current service health events for given resource. + /// The fully qualified ID of the resource, including the resource name and resource type. Currently the API support not nested and one nesting level resource types : /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} and /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// is null. + public async Task> ListBySingleResourceAsync(string resourceUri, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListBySingleResourceRequest(resourceUri, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists current service health events for given resource. + /// The fully qualified ID of the resource, including the resource name and resource type. Currently the API support not nested and one nesting level resource types : /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} and /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// is null. + public Response ListBySingleResource(string resourceUri, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListBySingleResourceRequest(resourceUri, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionIdNextPageRequest(string nextLink, string subscriptionId, string filter, string queryStartTime) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists service health events in the subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionIdNextPageAsync(string nextLink, string subscriptionId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionIdNextPageRequest(nextLink, subscriptionId, filter, queryStartTime); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists service health events in the subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionIdNextPage(string nextLink, string subscriptionId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionIdNextPageRequest(nextLink, subscriptionId, filter, queryStartTime); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByTenantIdNextPageRequest(string nextLink, string filter, string queryStartTime) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists current service health events in the tenant. + /// The URL to the next page of results. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is null. + public async Task> ListByTenantIdNextPageAsync(string nextLink, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListByTenantIdNextPageRequest(nextLink, filter, queryStartTime); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists current service health events in the tenant. + /// The URL to the next page of results. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is null. + public Response ListByTenantIdNextPage(string nextLink, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListByTenantIdNextPageRequest(nextLink, filter, queryStartTime); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySingleResourceNextPageRequest(string nextLink, string resourceUri, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists current service health events for given resource. + /// The URL to the next page of results. + /// The fully qualified ID of the resource, including the resource name and resource type. Currently the API support not nested and one nesting level resource types : /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} and /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// or is null. + public async Task> ListBySingleResourceNextPageAsync(string nextLink, string resourceUri, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListBySingleResourceNextPageRequest(nextLink, resourceUri, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists current service health events for given resource. + /// The URL to the next page of results. + /// The fully qualified ID of the resource, including the resource name and resource type. Currently the API support not nested and one nesting level resource types : /subscriptions/{subscriptionId}/resourceGroups/{resource-group-name}/providers/{resource-provider-name}/{resource-type}/{resource-name} and /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resource-provider-name}/{parentResourceType}/{parentResourceName}/{resourceType}/{resourceName}. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// or is null. + public Response ListBySingleResourceNextPage(string nextLink, string resourceUri, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNull(resourceUri, nameof(resourceUri)); + + using var message = CreateListBySingleResourceNextPageRequest(nextLink, resourceUri, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + Events value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = Events.DeserializeEvents(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ImpactedResourcesRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ImpactedResourcesRestOperations.cs new file mode 100644 index 0000000000000..d4bad5883d5c2 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/ImpactedResourcesRestOperations.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + internal partial class ImpactedResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ImpactedResourcesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ImpactedResourcesRestOperations(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 ?? "2022-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListBySubscriptionIdAndEventIdRequest(string subscriptionId, string eventTrackingId, string filter) + { + 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.ResourceHealth/events/", false); + uri.AppendPath(eventTrackingId, true); + uri.AppendPath("/impactedResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists impacted resources in the subscription by an event. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionIdAndEventIdAsync(string subscriptionId, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListBySubscriptionIdAndEventIdRequest(subscriptionId, eventTrackingId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists impacted resources in the subscription by an event. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionIdAndEventId(string subscriptionId, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListBySubscriptionIdAndEventIdRequest(subscriptionId, eventTrackingId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string eventTrackingId, string impactedResourceName) + { + 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.ResourceHealth/events/", false); + uri.AppendPath(eventTrackingId, true); + uri.AppendPath("/impactedResources/", false); + uri.AppendPath(impactedResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specific impacted resource in the subscription by an event. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// Name of the Impacted 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 eventTrackingId, string impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var message = CreateGetRequest(subscriptionId, eventTrackingId, impactedResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventImpactedResourceData.DeserializeEventImpactedResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EventImpactedResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specific impacted resource in the subscription by an event. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// Name of the Impacted 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 eventTrackingId, string impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var message = CreateGetRequest(subscriptionId, eventTrackingId, impactedResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventImpactedResourceData.DeserializeEventImpactedResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EventImpactedResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByTenantIdAndEventIdRequest(string eventTrackingId, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ResourceHealth/events/", false); + uri.AppendPath(eventTrackingId, true); + uri.AppendPath("/impactedResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists impacted resources in the tenant by an event. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListByTenantIdAndEventIdAsync(string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListByTenantIdAndEventIdRequest(eventTrackingId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists impacted resources in the tenant by an event. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListByTenantIdAndEventId(string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListByTenantIdAndEventIdRequest(eventTrackingId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetByTenantIdRequest(string eventTrackingId, string impactedResourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ResourceHealth/events/", false); + uri.AppendPath(eventTrackingId, true); + uri.AppendPath("/impactedResources/", false); + uri.AppendPath(impactedResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the specific impacted resource in the tenant by an event. + /// Event Id which uniquely identifies ServiceHealth event. + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetByTenantIdAsync(string eventTrackingId, string impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var message = CreateGetByTenantIdRequest(eventTrackingId, impactedResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventImpactedResourceData.DeserializeEventImpactedResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EventImpactedResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the specific impacted resource in the tenant by an event. + /// Event Id which uniquely identifies ServiceHealth event. + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response GetByTenantId(string eventTrackingId, string impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var message = CreateGetByTenantIdRequest(eventTrackingId, impactedResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventImpactedResourceData.DeserializeEventImpactedResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((EventImpactedResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionIdAndEventIdNextPageRequest(string nextLink, string subscriptionId, string eventTrackingId, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists impacted resources in the subscription by an event. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionIdAndEventIdNextPageAsync(string nextLink, string subscriptionId, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListBySubscriptionIdAndEventIdNextPageRequest(nextLink, subscriptionId, eventTrackingId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists impacted resources in the subscription by an event. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionIdAndEventIdNextPage(string nextLink, string subscriptionId, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListBySubscriptionIdAndEventIdNextPageRequest(nextLink, subscriptionId, eventTrackingId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByTenantIdAndEventIdNextPageRequest(string nextLink, string eventTrackingId, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists impacted resources in the tenant by an event. + /// The URL to the next page of results. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListByTenantIdAndEventIdNextPageAsync(string nextLink, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListByTenantIdAndEventIdNextPageRequest(nextLink, eventTrackingId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists impacted resources in the tenant by an event. + /// The URL to the next page of results. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListByTenantIdAndEventIdNextPage(string nextLink, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListByTenantIdAndEventIdNextPageRequest(nextLink, eventTrackingId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/MetadataRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/MetadataRestOperations.cs new file mode 100644 index 0000000000000..510d9891a5b09 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/MetadataRestOperations.cs @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + internal partial class MetadataRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of MetadataRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public MetadataRestOperations(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 ?? "2022-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ResourceHealth/metadata", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of metadata entities. + /// The cancellation token to use. + public async Task> ListAsync(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetadataEntityListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetadataEntityListResult.DeserializeMetadataEntityListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of metadata entities. + /// The cancellation token to use. + public Response List(CancellationToken cancellationToken = default) + { + using var message = CreateListRequest(); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetadataEntityListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetadataEntityListResult.DeserializeMetadataEntityListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetEntityRequest(string name) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ResourceHealth/metadata/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of metadata entities. + /// Name of metadata entity. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> GetEntityAsync(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var message = CreateGetEntityRequest(name); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetadataEntityData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetadataEntityData.DeserializeMetadataEntityData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MetadataEntityData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of metadata entities. + /// Name of metadata entity. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response GetEntity(string name, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + + using var message = CreateGetEntityRequest(name); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetadataEntityData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetadataEntityData.DeserializeMetadataEntityData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MetadataEntityData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Gets the list of metadata entities. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public async Task> ListNextPageAsync(string nextLink, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MetadataEntityListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MetadataEntityListResult.DeserializeMetadataEntityListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Gets the list of metadata entities. + /// The URL to the next page of results. + /// The cancellation token to use. + /// is null. + public Response ListNextPage(string nextLink, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListNextPageRequest(nextLink); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MetadataEntityListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MetadataEntityListResult.DeserializeMetadataEntityListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/SecurityAdvisoryImpactedResourcesRestOperations.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/SecurityAdvisoryImpactedResourcesRestOperations.cs new file mode 100644 index 0000000000000..9e4bd514f4c89 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/RestOperations/SecurityAdvisoryImpactedResourcesRestOperations.cs @@ -0,0 +1,336 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.ResourceHealth.Models; + +namespace Azure.ResourceManager.ResourceHealth +{ + internal partial class SecurityAdvisoryImpactedResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of SecurityAdvisoryImpactedResourcesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public SecurityAdvisoryImpactedResourcesRestOperations(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 ?? "2022-10-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListBySubscriptionIdAndEventIdRequest(string subscriptionId, string eventTrackingId, string filter) + { + 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("/providers/Microsoft.ResourceHealth/events/", false); + uri.AppendPath(eventTrackingId, true); + uri.AppendPath("/listSecurityAdvisoryImpactedResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists impacted resources in the subscription by an event (Security Advisory). + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionIdAndEventIdAsync(string subscriptionId, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListBySubscriptionIdAndEventIdRequest(subscriptionId, eventTrackingId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists impacted resources in the subscription by an event (Security Advisory). + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionIdAndEventId(string subscriptionId, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListBySubscriptionIdAndEventIdRequest(subscriptionId, eventTrackingId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByTenantIdAndEventIdRequest(string eventTrackingId, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.ResourceHealth/events/", false); + uri.AppendPath(eventTrackingId, true); + uri.AppendPath("/listSecurityAdvisoryImpactedResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("$filter", filter, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists impacted resources in the tenant by an event (Security Advisory). + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListByTenantIdAndEventIdAsync(string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListByTenantIdAndEventIdRequest(eventTrackingId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists impacted resources in the tenant by an event (Security Advisory). + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListByTenantIdAndEventId(string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListByTenantIdAndEventIdRequest(eventTrackingId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListBySubscriptionIdAndEventIdNextPageRequest(string nextLink, string subscriptionId, string eventTrackingId, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists impacted resources in the subscription by an event (Security Advisory). + /// The URL to the next page of results. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionIdAndEventIdNextPageAsync(string nextLink, string subscriptionId, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListBySubscriptionIdAndEventIdNextPageRequest(nextLink, subscriptionId, eventTrackingId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists impacted resources in the subscription by an event (Security Advisory). + /// The URL to the next page of results. + /// The ID of the target subscription. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionIdAndEventIdNextPage(string nextLink, string subscriptionId, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListBySubscriptionIdAndEventIdNextPageRequest(nextLink, subscriptionId, eventTrackingId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByTenantIdAndEventIdNextPageRequest(string nextLink, string eventTrackingId, string filter) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Lists impacted resources in the tenant by an event (Security Advisory). + /// The URL to the next page of results. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListByTenantIdAndEventIdNextPageAsync(string nextLink, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListByTenantIdAndEventIdNextPageRequest(nextLink, eventTrackingId, filter); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Lists impacted resources in the tenant by an event (Security Advisory). + /// The URL to the next page of results. + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListByTenantIdAndEventIdNextPage(string nextLink, string eventTrackingId, string filter = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var message = CreateListByTenantIdAndEventIdNextPageRequest(nextLink, eventTrackingId, filter); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EventImpactedResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EventImpactedResourceListResult.DeserializeEventImpactedResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionEventCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionEventCollection.cs new file mode 100644 index 0000000000000..f84c50994f4e7 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionEventCollection.cs @@ -0,0 +1,276 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetSubscriptionEvents method from an instance of . + /// + public partial class SubscriptionEventCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _subscriptionEventEventClientDiagnostics; + private readonly EventRestOperations _subscriptionEventEventRestClient; + private readonly ClientDiagnostics _subscriptionEventEventsClientDiagnostics; + private readonly EventsRestOperations _subscriptionEventEventsRestClient; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionEventCollection() + { + } + + /// 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 SubscriptionEventCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _subscriptionEventEventClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", SubscriptionEventResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SubscriptionEventResource.ResourceType, out string subscriptionEventEventApiVersion); + _subscriptionEventEventRestClient = new EventRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, subscriptionEventEventApiVersion); + _subscriptionEventEventsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", SubscriptionEventResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SubscriptionEventResource.ResourceType, out string subscriptionEventEventsApiVersion); + _subscriptionEventEventsRestClient = new EventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, subscriptionEventEventsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Service health event in the subscription by event tracking id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _subscriptionEventEventClientDiagnostics.CreateScope("SubscriptionEventCollection.Get"); + scope.Start(); + try + { + var response = await _subscriptionEventEventRestClient.GetBySubscriptionIdAndTrackingIdAsync(Id.SubscriptionId, eventTrackingId, filter, queryStartTime, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Service health event in the subscription by event tracking id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _subscriptionEventEventClientDiagnostics.CreateScope("SubscriptionEventCollection.Get"); + scope.Start(); + try + { + var response = _subscriptionEventEventRestClient.GetBySubscriptionIdAndTrackingId(Id.SubscriptionId, eventTrackingId, filter, queryStartTime, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists service health events in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events + /// + /// + /// Operation Id + /// Events_ListBySubscriptionId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _subscriptionEventEventsRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId, filter, queryStartTime); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _subscriptionEventEventsRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId, filter, queryStartTime); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SubscriptionEventResource(Client, EventData.DeserializeEventData(e)), _subscriptionEventEventsClientDiagnostics, Pipeline, "SubscriptionEventCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists service health events in the subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events + /// + /// + /// Operation Id + /// Events_ListBySubscriptionId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _subscriptionEventEventsRestClient.CreateListBySubscriptionIdRequest(Id.SubscriptionId, filter, queryStartTime); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _subscriptionEventEventsRestClient.CreateListBySubscriptionIdNextPageRequest(nextLink, Id.SubscriptionId, filter, queryStartTime); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SubscriptionEventResource(Client, EventData.DeserializeEventData(e)), _subscriptionEventEventsClientDiagnostics, Pipeline, "SubscriptionEventCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _subscriptionEventEventClientDiagnostics.CreateScope("SubscriptionEventCollection.Exists"); + scope.Start(); + try + { + var response = await _subscriptionEventEventRestClient.GetBySubscriptionIdAndTrackingIdAsync(Id.SubscriptionId, eventTrackingId, filter, queryStartTime, 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}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _subscriptionEventEventClientDiagnostics.CreateScope("SubscriptionEventCollection.Exists"); + scope.Start(); + try + { + var response = _subscriptionEventEventRestClient.GetBySubscriptionIdAndTrackingId(Id.SubscriptionId, eventTrackingId, filter, queryStartTime, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionEventResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionEventResource.cs new file mode 100644 index 0000000000000..606b481e463b2 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionEventResource.cs @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A Class representing a SubscriptionEvent along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSubscriptionEventResource method. + /// Otherwise you can get one from its parent resource using the GetSubscriptionEvent method. + /// + public partial class SubscriptionEventResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string eventTrackingId) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _subscriptionEventEventClientDiagnostics; + private readonly EventRestOperations _subscriptionEventEventRestClient; + private readonly ClientDiagnostics _securityAdvisoryImpactedResourcesClientDiagnostics; + private readonly SecurityAdvisoryImpactedResourcesRestOperations _securityAdvisoryImpactedResourcesRestClient; + private readonly EventData _data; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionEventResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SubscriptionEventResource(ArmClient client, EventData 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 SubscriptionEventResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _subscriptionEventEventClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string subscriptionEventEventApiVersion); + _subscriptionEventEventRestClient = new EventRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, subscriptionEventEventApiVersion); + _securityAdvisoryImpactedResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _securityAdvisoryImpactedResourcesRestClient = new SecurityAdvisoryImpactedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ResourceHealth/events"; + + /// 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 EventData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of SubscriptionResourceHealthEventImpactedResources in the SubscriptionEvent. + /// An object representing collection of SubscriptionResourceHealthEventImpactedResources and their operations over a SubscriptionResourceHealthEventImpactedResource. + public virtual SubscriptionResourceHealthEventImpactedResourceCollection GetSubscriptionResourceHealthEventImpactedResources() + { + return GetCachedClient(Client => new SubscriptionResourceHealthEventImpactedResourceCollection(Client, Id)); + } + + /// + /// Gets the specific impacted resource in the subscription by an event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_Get + /// + /// + /// + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetSubscriptionResourceHealthEventImpactedResourceAsync(string impactedResourceName, CancellationToken cancellationToken = default) + { + return await GetSubscriptionResourceHealthEventImpactedResources().GetAsync(impactedResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specific impacted resource in the subscription by an event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_Get + /// + /// + /// + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetSubscriptionResourceHealthEventImpactedResource(string impactedResourceName, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceHealthEventImpactedResources().Get(impactedResourceName, cancellationToken); + } + + /// + /// Service health event in the subscription by event tracking id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + public virtual async Task> GetAsync(string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + using var scope = _subscriptionEventEventClientDiagnostics.CreateScope("SubscriptionEventResource.Get"); + scope.Start(); + try + { + var response = await _subscriptionEventEventRestClient.GetBySubscriptionIdAndTrackingIdAsync(Id.SubscriptionId, Id.Name, filter, queryStartTime, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Service health event in the subscription by event tracking id + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetBySubscriptionIdAndTrackingId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + public virtual Response Get(string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + using var scope = _subscriptionEventEventClientDiagnostics.CreateScope("SubscriptionEventResource.Get"); + scope.Start(); + try + { + var response = _subscriptionEventEventRestClient.GetBySubscriptionIdAndTrackingId(Id.SubscriptionId, Id.Name, filter, queryStartTime, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists impacted resources in the subscription by an event (Security Advisory). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources + /// + /// + /// Operation Id + /// SecurityAdvisoryImpactedResources_ListBySubscriptionIdAndEventId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecurityAdvisoryImpactedResourcesBySubscriptionIdAndEventIdAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _securityAdvisoryImpactedResourcesRestClient.CreateListBySubscriptionIdAndEventIdRequest(Id.SubscriptionId, Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _securityAdvisoryImpactedResourcesRestClient.CreateListBySubscriptionIdAndEventIdNextPageRequest(nextLink, Id.SubscriptionId, Id.Name, filter); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EventImpactedResourceData.DeserializeEventImpactedResourceData, _securityAdvisoryImpactedResourcesClientDiagnostics, Pipeline, "SubscriptionEventResource.GetSecurityAdvisoryImpactedResourcesBySubscriptionIdAndEventId", "value", "nextLink", cancellationToken); + } + + /// + /// Lists impacted resources in the subscription by an event (Security Advisory). + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources + /// + /// + /// Operation Id + /// SecurityAdvisoryImpactedResources_ListBySubscriptionIdAndEventId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecurityAdvisoryImpactedResourcesBySubscriptionIdAndEventId(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _securityAdvisoryImpactedResourcesRestClient.CreateListBySubscriptionIdAndEventIdRequest(Id.SubscriptionId, Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _securityAdvisoryImpactedResourcesRestClient.CreateListBySubscriptionIdAndEventIdNextPageRequest(nextLink, Id.SubscriptionId, Id.Name, filter); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EventImpactedResourceData.DeserializeEventImpactedResourceData, _securityAdvisoryImpactedResourcesClientDiagnostics, Pipeline, "SubscriptionEventResource.GetSecurityAdvisoryImpactedResourcesBySubscriptionIdAndEventId", "value", "nextLink", cancellationToken); + } + + /// + /// Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails + /// + /// + /// Operation Id + /// Event_fetchDetailsBySubscriptionIdAndTrackingId + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> FetchDetailsBySubscriptionIdAndTrackingIdAsync(CancellationToken cancellationToken = default) + { + using var scope = _subscriptionEventEventClientDiagnostics.CreateScope("SubscriptionEventResource.FetchDetailsBySubscriptionIdAndTrackingId"); + scope.Start(); + try + { + var response = await _subscriptionEventEventRestClient.FetchDetailsBySubscriptionIdAndTrackingIdAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new SubscriptionEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Service health event details in the subscription by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails + /// + /// + /// Operation Id + /// Event_fetchDetailsBySubscriptionIdAndTrackingId + /// + /// + /// + /// The cancellation token to use. + public virtual Response FetchDetailsBySubscriptionIdAndTrackingId(CancellationToken cancellationToken = default) + { + using var scope = _subscriptionEventEventClientDiagnostics.CreateScope("SubscriptionEventResource.FetchDetailsBySubscriptionIdAndTrackingId"); + scope.Start(); + try + { + var response = _subscriptionEventEventRestClient.FetchDetailsBySubscriptionIdAndTrackingId(Id.SubscriptionId, Id.Name, cancellationToken); + return Response.FromValue(new SubscriptionEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionResourceHealthEventImpactedResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionResourceHealthEventImpactedResource.cs new file mode 100644 index 0000000000000..a66d444e9e6d3 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionResourceHealthEventImpactedResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A Class representing a SubscriptionResourceHealthEventImpactedResource along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetSubscriptionResourceHealthEventImpactedResource method. + /// Otherwise you can get one from its parent resource using the GetSubscriptionResourceHealthEventImpactedResource method. + /// + public partial class SubscriptionResourceHealthEventImpactedResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string eventTrackingId, string impactedResourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics; + private readonly ImpactedResourcesRestOperations _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient; + private readonly EventImpactedResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionResourceHealthEventImpactedResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal SubscriptionResourceHealthEventImpactedResource(ArmClient client, EventImpactedResourceData 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 SubscriptionResourceHealthEventImpactedResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string subscriptionResourceHealthEventImpactedResourceImpactedResourcesApiVersion); + _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient = new ImpactedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, subscriptionResourceHealthEventImpactedResourceImpactedResourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ResourceHealth/events/impactedResources"; + + /// 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 EventImpactedResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the specific impacted resource in the subscription by an event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("SubscriptionResourceHealthEventImpactedResource.Get"); + scope.Start(); + try + { + var response = await _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specific impacted resource in the subscription by an event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("SubscriptionResourceHealthEventImpactedResource.Get"); + scope.Start(); + try + { + var response = _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient.Get(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionResourceHealthEventImpactedResourceCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionResourceHealthEventImpactedResourceCollection.cs new file mode 100644 index 0000000000000..77cc928e81888 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/SubscriptionResourceHealthEventImpactedResourceCollection.cs @@ -0,0 +1,260 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetSubscriptionResourceHealthEventImpactedResources method from an instance of . + /// + public partial class SubscriptionResourceHealthEventImpactedResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics; + private readonly ImpactedResourcesRestOperations _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionResourceHealthEventImpactedResourceCollection() + { + } + + /// 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 SubscriptionResourceHealthEventImpactedResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", SubscriptionResourceHealthEventImpactedResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(SubscriptionResourceHealthEventImpactedResource.ResourceType, out string subscriptionResourceHealthEventImpactedResourceImpactedResourcesApiVersion); + _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient = new ImpactedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, subscriptionResourceHealthEventImpactedResourceImpactedResourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != "Microsoft.ResourceHealth/events") + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, "Microsoft.ResourceHealth/events"), nameof(id)); + } + + /// + /// Gets the specific impacted resource in the subscription by an event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_Get + /// + /// + /// + /// Name of the Impacted 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 impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("SubscriptionResourceHealthEventImpactedResourceCollection.Get"); + scope.Start(); + try + { + var response = await _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetAsync(Id.SubscriptionId, Id.Name, impactedResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specific impacted resource in the subscription by an event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_Get + /// + /// + /// + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("SubscriptionResourceHealthEventImpactedResourceCollection.Get"); + scope.Start(); + try + { + var response = _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient.Get(Id.SubscriptionId, Id.Name, impactedResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new SubscriptionResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists impacted resources in the subscription by an event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources + /// + /// + /// Operation Id + /// ImpactedResources_ListBySubscriptionIdAndEventId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient.CreateListBySubscriptionIdAndEventIdRequest(Id.SubscriptionId, Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient.CreateListBySubscriptionIdAndEventIdNextPageRequest(nextLink, Id.SubscriptionId, Id.Name, filter); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new SubscriptionResourceHealthEventImpactedResource(Client, EventImpactedResourceData.DeserializeEventImpactedResourceData(e)), _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics, Pipeline, "SubscriptionResourceHealthEventImpactedResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists impacted resources in the subscription by an event. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources + /// + /// + /// Operation Id + /// ImpactedResources_ListBySubscriptionIdAndEventId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient.CreateListBySubscriptionIdAndEventIdRequest(Id.SubscriptionId, Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient.CreateListBySubscriptionIdAndEventIdNextPageRequest(nextLink, Id.SubscriptionId, Id.Name, filter); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new SubscriptionResourceHealthEventImpactedResource(Client, EventImpactedResourceData.DeserializeEventImpactedResourceData(e)), _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics, Pipeline, "SubscriptionResourceHealthEventImpactedResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_Get + /// + /// + /// + /// Name of the Impacted 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 impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("SubscriptionResourceHealthEventImpactedResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetAsync(Id.SubscriptionId, Id.Name, impactedResourceName, 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}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_Get + /// + /// + /// + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _subscriptionResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("SubscriptionResourceHealthEventImpactedResourceCollection.Exists"); + scope.Start(); + try + { + var response = _subscriptionResourceHealthEventImpactedResourceImpactedResourcesRestClient.Get(Id.SubscriptionId, Id.Name, impactedResourceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantEventCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantEventCollection.cs new file mode 100644 index 0000000000000..acc920a83ec6c --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantEventCollection.cs @@ -0,0 +1,276 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetTenantEvents method from an instance of . + /// + public partial class TenantEventCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _tenantEventEventClientDiagnostics; + private readonly EventRestOperations _tenantEventEventRestClient; + private readonly ClientDiagnostics _tenantEventEventsClientDiagnostics; + private readonly EventsRestOperations _tenantEventEventsRestClient; + + /// Initializes a new instance of the class for mocking. + protected TenantEventCollection() + { + } + + /// 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 TenantEventCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _tenantEventEventClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", TenantEventResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(TenantEventResource.ResourceType, out string tenantEventEventApiVersion); + _tenantEventEventRestClient = new EventRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, tenantEventEventApiVersion); + _tenantEventEventsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", TenantEventResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(TenantEventResource.ResourceType, out string tenantEventEventsApiVersion); + _tenantEventEventsRestClient = new EventsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, tenantEventEventsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != TenantResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, TenantResource.ResourceType), nameof(id)); + } + + /// + /// Service health event in the tenant by event tracking id + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _tenantEventEventClientDiagnostics.CreateScope("TenantEventCollection.Get"); + scope.Start(); + try + { + var response = await _tenantEventEventRestClient.GetByTenantIdAndTrackingIdAsync(eventTrackingId, filter, queryStartTime, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TenantEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Service health event in the tenant by event tracking id + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _tenantEventEventClientDiagnostics.CreateScope("TenantEventCollection.Get"); + scope.Start(); + try + { + var response = _tenantEventEventRestClient.GetByTenantIdAndTrackingId(eventTrackingId, filter, queryStartTime, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TenantEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists current service health events in the tenant. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events + /// + /// + /// Operation Id + /// Events_ListByTenantId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _tenantEventEventsRestClient.CreateListByTenantIdRequest(filter, queryStartTime); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _tenantEventEventsRestClient.CreateListByTenantIdNextPageRequest(nextLink, filter, queryStartTime); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TenantEventResource(Client, EventData.DeserializeEventData(e)), _tenantEventEventsClientDiagnostics, Pipeline, "TenantEventCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists current service health events in the tenant. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events + /// + /// + /// Operation Id + /// Events_ListByTenantId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _tenantEventEventsRestClient.CreateListByTenantIdRequest(filter, queryStartTime); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _tenantEventEventsRestClient.CreateListByTenantIdNextPageRequest(nextLink, filter, queryStartTime); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TenantEventResource(Client, EventData.DeserializeEventData(e)), _tenantEventEventsClientDiagnostics, Pipeline, "TenantEventCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _tenantEventEventClientDiagnostics.CreateScope("TenantEventCollection.Exists"); + scope.Start(); + try + { + var response = await _tenantEventEventRestClient.GetByTenantIdAndTrackingIdAsync(eventTrackingId, filter, queryStartTime, 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 + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// Event Id which uniquely identifies ServiceHealth event. + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string eventTrackingId, string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(eventTrackingId, nameof(eventTrackingId)); + + using var scope = _tenantEventEventClientDiagnostics.CreateScope("TenantEventCollection.Exists"); + scope.Start(); + try + { + var response = _tenantEventEventRestClient.GetByTenantIdAndTrackingId(eventTrackingId, filter, queryStartTime, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantEventResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantEventResource.cs new file mode 100644 index 0000000000000..1afacecf5b840 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantEventResource.cs @@ -0,0 +1,321 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A Class representing a TenantEvent along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetTenantEventResource method. + /// Otherwise you can get one from its parent resource using the GetTenantEvent method. + /// + public partial class TenantEventResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string eventTrackingId) + { + var resourceId = $"/providers/Microsoft.ResourceHealth/events/{eventTrackingId}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _tenantEventEventClientDiagnostics; + private readonly EventRestOperations _tenantEventEventRestClient; + private readonly ClientDiagnostics _securityAdvisoryImpactedResourcesClientDiagnostics; + private readonly SecurityAdvisoryImpactedResourcesRestOperations _securityAdvisoryImpactedResourcesRestClient; + private readonly EventData _data; + + /// Initializes a new instance of the class for mocking. + protected TenantEventResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal TenantEventResource(ArmClient client, EventData 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 TenantEventResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _tenantEventEventClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string tenantEventEventApiVersion); + _tenantEventEventRestClient = new EventRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, tenantEventEventApiVersion); + _securityAdvisoryImpactedResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _securityAdvisoryImpactedResourcesRestClient = new SecurityAdvisoryImpactedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ResourceHealth/events"; + + /// 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 EventData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of TenantResourceHealthEventImpactedResources in the TenantEvent. + /// An object representing collection of TenantResourceHealthEventImpactedResources and their operations over a TenantResourceHealthEventImpactedResource. + public virtual TenantResourceHealthEventImpactedResourceCollection GetTenantResourceHealthEventImpactedResources() + { + return GetCachedClient(Client => new TenantResourceHealthEventImpactedResourceCollection(Client, Id)); + } + + /// + /// Gets the specific impacted resource in the tenant by an event. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_GetByTenantId + /// + /// + /// + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetTenantResourceHealthEventImpactedResourceAsync(string impactedResourceName, CancellationToken cancellationToken = default) + { + return await GetTenantResourceHealthEventImpactedResources().GetAsync(impactedResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Gets the specific impacted resource in the tenant by an event. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_GetByTenantId + /// + /// + /// + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetTenantResourceHealthEventImpactedResource(string impactedResourceName, CancellationToken cancellationToken = default) + { + return GetTenantResourceHealthEventImpactedResources().Get(impactedResourceName, cancellationToken); + } + + /// + /// Service health event in the tenant by event tracking id + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + public virtual async Task> GetAsync(string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + using var scope = _tenantEventEventClientDiagnostics.CreateScope("TenantEventResource.Get"); + scope.Start(); + try + { + var response = await _tenantEventEventRestClient.GetByTenantIdAndTrackingIdAsync(Id.Name, filter, queryStartTime, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TenantEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Service health event in the tenant by event tracking id + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId} + /// + /// + /// Operation Id + /// Event_GetByTenantIdAndTrackingId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// Specifies from when to return events, based on the lastUpdateTime property. For example, queryStartTime = 7/24/2020 OR queryStartTime=7%2F24%2F2020. + /// The cancellation token to use. + public virtual Response Get(string filter = null, string queryStartTime = null, CancellationToken cancellationToken = default) + { + using var scope = _tenantEventEventClientDiagnostics.CreateScope("TenantEventResource.Get"); + scope.Start(); + try + { + var response = _tenantEventEventRestClient.GetByTenantIdAndTrackingId(Id.Name, filter, queryStartTime, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TenantEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists impacted resources in the tenant by an event (Security Advisory). + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources + /// + /// + /// Operation Id + /// SecurityAdvisoryImpactedResources_ListByTenantIdAndEventId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetSecurityAdvisoryImpactedResourcesByTenantIdAndEventIdAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _securityAdvisoryImpactedResourcesRestClient.CreateListByTenantIdAndEventIdRequest(Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _securityAdvisoryImpactedResourcesRestClient.CreateListByTenantIdAndEventIdNextPageRequest(nextLink, Id.Name, filter); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, EventImpactedResourceData.DeserializeEventImpactedResourceData, _securityAdvisoryImpactedResourcesClientDiagnostics, Pipeline, "TenantEventResource.GetSecurityAdvisoryImpactedResourcesByTenantIdAndEventId", "value", "nextLink", cancellationToken); + } + + /// + /// Lists impacted resources in the tenant by an event (Security Advisory). + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/listSecurityAdvisoryImpactedResources + /// + /// + /// Operation Id + /// SecurityAdvisoryImpactedResources_ListByTenantIdAndEventId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetSecurityAdvisoryImpactedResourcesByTenantIdAndEventId(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _securityAdvisoryImpactedResourcesRestClient.CreateListByTenantIdAndEventIdRequest(Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _securityAdvisoryImpactedResourcesRestClient.CreateListByTenantIdAndEventIdNextPageRequest(nextLink, Id.Name, filter); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, EventImpactedResourceData.DeserializeEventImpactedResourceData, _securityAdvisoryImpactedResourcesClientDiagnostics, Pipeline, "TenantEventResource.GetSecurityAdvisoryImpactedResourcesByTenantIdAndEventId", "value", "nextLink", cancellationToken); + } + + /// + /// Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails + /// + /// + /// Operation Id + /// Event_fetchDetailsByTenantIdAndTrackingId + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> FetchDetailsByTenantIdAndTrackingIdAsync(CancellationToken cancellationToken = default) + { + using var scope = _tenantEventEventClientDiagnostics.CreateScope("TenantEventResource.FetchDetailsByTenantIdAndTrackingId"); + scope.Start(); + try + { + var response = await _tenantEventEventRestClient.FetchDetailsByTenantIdAndTrackingIdAsync(Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new TenantEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Service health event details in the tenant by event tracking id. This can be used to fetch sensitive properties for Security Advisory events + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/fetchEventDetails + /// + /// + /// Operation Id + /// Event_fetchDetailsByTenantIdAndTrackingId + /// + /// + /// + /// The cancellation token to use. + public virtual Response FetchDetailsByTenantIdAndTrackingId(CancellationToken cancellationToken = default) + { + using var scope = _tenantEventEventClientDiagnostics.CreateScope("TenantEventResource.FetchDetailsByTenantIdAndTrackingId"); + scope.Start(); + try + { + var response = _tenantEventEventRestClient.FetchDetailsByTenantIdAndTrackingId(Id.Name, cancellationToken); + return Response.FromValue(new TenantEventResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResource.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResource.cs new file mode 100644 index 0000000000000..896cf867dc6eb --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A Class representing a TenantResourceHealthEventImpactedResource along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetTenantResourceHealthEventImpactedResource method. + /// Otherwise you can get one from its parent resource using the GetTenantResourceHealthEventImpactedResource method. + /// + public partial class TenantResourceHealthEventImpactedResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string eventTrackingId, string impactedResourceName) + { + var resourceId = $"/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics; + private readonly ImpactedResourcesRestOperations _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient; + private readonly EventImpactedResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected TenantResourceHealthEventImpactedResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal TenantResourceHealthEventImpactedResource(ArmClient client, EventImpactedResourceData 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 TenantResourceHealthEventImpactedResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string tenantResourceHealthEventImpactedResourceImpactedResourcesApiVersion); + _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient = new ImpactedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, tenantResourceHealthEventImpactedResourceImpactedResourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.ResourceHealth/events/impactedResources"; + + /// 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 EventImpactedResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Gets the specific impacted resource in the tenant by an event. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_GetByTenantId + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("TenantResourceHealthEventImpactedResource.Get"); + scope.Start(); + try + { + var response = await _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetByTenantIdAsync(Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TenantResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specific impacted resource in the tenant by an event. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_GetByTenantId + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("TenantResourceHealthEventImpactedResource.Get"); + scope.Start(); + try + { + var response = _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetByTenantId(Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TenantResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResourceCollection.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResourceCollection.cs new file mode 100644 index 0000000000000..5657fbfbb14a1 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Generated/TenantResourceHealthEventImpactedResourceCollection.cs @@ -0,0 +1,260 @@ +// 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 Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.ResourceHealth +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetTenantResourceHealthEventImpactedResources method from an instance of . + /// + public partial class TenantResourceHealthEventImpactedResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics; + private readonly ImpactedResourcesRestOperations _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient; + + /// Initializes a new instance of the class for mocking. + protected TenantResourceHealthEventImpactedResourceCollection() + { + } + + /// 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 TenantResourceHealthEventImpactedResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.ResourceHealth", TenantResourceHealthEventImpactedResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(TenantResourceHealthEventImpactedResource.ResourceType, out string tenantResourceHealthEventImpactedResourceImpactedResourcesApiVersion); + _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient = new ImpactedResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, tenantResourceHealthEventImpactedResourceImpactedResourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != "Microsoft.ResourceHealth/events") + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, "Microsoft.ResourceHealth/events"), nameof(id)); + } + + /// + /// Gets the specific impacted resource in the tenant by an event. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_GetByTenantId + /// + /// + /// + /// Name of the Impacted 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 impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("TenantResourceHealthEventImpactedResourceCollection.Get"); + scope.Start(); + try + { + var response = await _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetByTenantIdAsync(Id.Name, impactedResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TenantResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Gets the specific impacted resource in the tenant by an event. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_GetByTenantId + /// + /// + /// + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("TenantResourceHealthEventImpactedResourceCollection.Get"); + scope.Start(); + try + { + var response = _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetByTenantId(Id.Name, impactedResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new TenantResourceHealthEventImpactedResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Lists impacted resources in the tenant by an event. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources + /// + /// + /// Operation Id + /// ImpactedResources_ListByTenantIdAndEventId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.CreateListByTenantIdAndEventIdRequest(Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.CreateListByTenantIdAndEventIdNextPageRequest(nextLink, Id.Name, filter); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new TenantResourceHealthEventImpactedResource(Client, EventImpactedResourceData.DeserializeEventImpactedResourceData(e)), _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics, Pipeline, "TenantResourceHealthEventImpactedResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Lists impacted resources in the tenant by an event. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources + /// + /// + /// Operation Id + /// ImpactedResources_ListByTenantIdAndEventId + /// + /// + /// + /// The filter to apply on the operation. For more information please see https://docs.microsoft.com/en-us/rest/api/apimanagement/apis?redirectedfrom=MSDN. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string filter = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.CreateListByTenantIdAndEventIdRequest(Id.Name, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.CreateListByTenantIdAndEventIdNextPageRequest(nextLink, Id.Name, filter); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new TenantResourceHealthEventImpactedResource(Client, EventImpactedResourceData.DeserializeEventImpactedResourceData(e)), _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics, Pipeline, "TenantResourceHealthEventImpactedResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_GetByTenantId + /// + /// + /// + /// Name of the Impacted 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 impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("TenantResourceHealthEventImpactedResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetByTenantIdAsync(Id.Name, impactedResourceName, 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 + /// /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName} + /// + /// + /// Operation Id + /// ImpactedResources_GetByTenantId + /// + /// + /// + /// Name of the Impacted Resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string impactedResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactedResourceName, nameof(impactedResourceName)); + + using var scope = _tenantResourceHealthEventImpactedResourceImpactedResourcesClientDiagnostics.CreateScope("TenantResourceHealthEventImpactedResourceCollection.Exists"); + scope.Start(); + try + { + var response = _tenantResourceHealthEventImpactedResourceImpactedResourcesRestClient.GetByTenantId(Id.Name, impactedResourceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, 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/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Properties/AssemblyInfo.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..c8b832472911e --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.ResourceHealth")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Azure.ResourceManager.ResourceHealth.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/autorest.md b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/autorest.md new file mode 100644 index 0000000000000..0cd230ff4e5bc --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/src/autorest.md @@ -0,0 +1,55 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +azure-arm: true +csharp: true +library-name: ResourceHealth +namespace: Azure.ResourceManager.ResourceHealth +require: https://github.com/Azure/azure-rest-api-specs/tree/5ad3e3cef3193e676d3d4abe80423515f19c9a1e/specification/resourcehealth/resource-manager/readme.md +# tag: package-preview-2022-10 +output-folder: $(this-folder)/Generated +clear-output-folder: true +skip-csproj: true +modelerfour: + flatten-payloads: false + +rename-mapping: + Link.type: LinkType + +format-by-name-rules: + 'tenantId': 'uuid' + 'ETag': 'etag' + 'location': 'azure-location' + '*Uri': 'Uri' + '*Uris': 'Uri' + +rename-rules: + CPU: Cpu + CPUs: Cpus + Os: OS + Ip: IP + Ips: IPs|ips + ID: Id + IDs: Ids + VM: Vm + VMs: Vms + Vmos: VmOS + VMScaleSet: VmScaleSet + DNS: Dns + VPN: Vpn + NAT: Nat + WAN: Wan + Ipv4: IPv4|ipv4 + Ipv6: IPv6|ipv6 + Ipsec: IPsec|ipsec + SSO: Sso + URI: Uri + Etag: ETag|etag + +request-path-to-resource-name: + /subscriptions/{subscriptionId}/providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}: SubscriptionResourceHealthEventImpactedResource + /providers/Microsoft.ResourceHealth/events/{eventTrackingId}/impactedResources/{impactedResourceName}: TenantResourceHealthEventImpactedResource + +``` \ No newline at end of file diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/Azure.ResourceManager.ResourceHealth.Tests.csproj b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/Azure.ResourceManager.ResourceHealth.Tests.csproj new file mode 100644 index 0000000000000..cdff0dc86a67f --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/Azure.ResourceManager.ResourceHealth.Tests.csproj @@ -0,0 +1,5 @@ + + + + + diff --git a/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/ResourceHealthManagementTestBase.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/ResourceHealthManagementTestBase.cs new file mode 100644 index 0000000000000..837d2b3f05138 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/ResourceHealthManagementTestBase.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.ResourceHealth.Tests +{ + public class ResourceHealthManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + + protected ResourceHealthManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected ResourceHealthManagementTestBase(bool isAsync) + : base(isAsync) + { + } + + [SetUp] + public void CreateCommonClient() + { + Client = GetArmClient(); + } + + 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/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/ResourceHealthManagementTestEnvironment.cs b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/ResourceHealthManagementTestEnvironment.cs new file mode 100644 index 0000000000000..36ad589c85dea --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/tests/ResourceHealthManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.ResourceHealth.Tests +{ + public class ResourceHealthManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/resourcehealth/ci.mgmt.yml b/sdk/resourcehealth/ci.mgmt.yml new file mode 100644 index 0000000000000..fb0a27171a692 --- /dev/null +++ b/sdk/resourcehealth/ci.mgmt.yml @@ -0,0 +1,24 @@ +# 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/resourcehealth/ci.mgmt.yml + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + SdkType: mgmtclient + ServiceDirectory: resourcehealth + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.ResourceHealth + safeName: AzureResourceManagerResourceHealth diff --git a/sdk/resourcehealth/service.projects b/sdk/resourcehealth/service.projects new file mode 100644 index 0000000000000..1756bd53d667a --- /dev/null +++ b/sdk/resourcehealth/service.projects @@ -0,0 +1,25 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index 6b8f772e47bc6..c884a40f30191 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -134,6 +134,7 @@ trigger: - sdk/relay/Azure.ResourceManager.Relay - sdk/reservations/Azure.ResourceManager.Reservations - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth - sdk/resourcemover/Azure.ResourceManager.ResourceMover - sdk/resources/Azure.ResourceManager.Resources - sdk/search/Azure.ResourceManager.Search @@ -163,7 +164,6 @@ trigger: - sdk/websites/Azure.ResourceManager.AppService - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor - sdk/workloads/Azure.ResourceManager.Workloads - - sdk/impact/Azure.ResourceManager.Impact pr: branches: @@ -300,6 +300,7 @@ pr: - sdk/relay/Azure.ResourceManager.Relay - sdk/reservations/Azure.ResourceManager.Reservations - sdk/resourcegraph/Azure.ResourceManager.ResourceGraph + - sdk/resourcehealth/Azure.ResourceManager.ResourceHealth - sdk/resourcemover/Azure.ResourceManager.ResourceMover - sdk/resources/Azure.ResourceManager.Resources - sdk/search/Azure.ResourceManager.Search @@ -329,7 +330,6 @@ pr: - sdk/websites/Azure.ResourceManager.AppService - sdk/workloadmonitor/Azure.ResourceManager.WorkloadMonitor - sdk/workloads/Azure.ResourceManager.Workloads - - sdk/impact/Azure.ResourceManager.Impact extends: template: /eng/pipelines/templates/stages/archetype-sdk-client.yml diff --git a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/autorest.tests.md b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/autorest.tests.md index c62a0b0cbd03a..2302a7c2321d7 100644 --- a/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/autorest.tests.md +++ b/sdk/voiceservices/Azure.ResourceManager.VoiceServices/samples/autorest.tests.md @@ -2,7 +2,7 @@ Run `dotnet build /t:GenerateTests` to generate code. -# Azure.ResourceManager.ElasticSan.Tests +# Azure.ResourceManager.VoiceServices.Tests > see https://aka.ms/autorest ``` yaml