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 000000000000..1e57fa618b3c --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/Azure.ResourceManager.Resourcehealth.sln @@ -0,0 +1,51 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30309.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{C9688F41-2CDC-4E21-9C59-3A53108C77F4}") = "Azure.ResourceManager.Resourcehealth", "src\Azure.ResourceManager.Resourcehealth.csproj", "{A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}" +EndProject +Project("{C9688F41-2CDC-4E21-9C59-3A53108C77F4}") = "Azure.ResourceManager.Resourcehealth.Tests", "tests\Azure.ResourceManager.Resourcehealth.Tests.csproj", "{3D83C189-09BE-4F45-81BB-689166D19B36}" +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {8673E589-E253-4233-A3DF-9F99E666A01C} + EndGlobalSection + 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 + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Debug|x64.ActiveCfg = Debug|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Debug|x64.Build.0 = Debug|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Debug|x86.ActiveCfg = Debug|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Debug|x86.Build.0 = Debug|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Release|Any CPU.Build.0 = Release|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Release|x64.ActiveCfg = Release|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Release|x64.Build.0 = Release|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Release|x86.ActiveCfg = Release|Any CPU + {A6FC2FD7-33C9-4C9B-AD40-CE57C0FABBB4}.Release|x86.Build.0 = Release|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Debug|Any CPU.Build.0 = Debug|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Debug|x64.ActiveCfg = Debug|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Debug|x64.Build.0 = Debug|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Debug|x86.ActiveCfg = Debug|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Debug|x86.Build.0 = Debug|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Release|Any CPU.ActiveCfg = Release|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Release|Any CPU.Build.0 = Release|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Release|x64.ActiveCfg = Release|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Release|x64.Build.0 = Release|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Release|x86.ActiveCfg = Release|Any CPU + {3D83C189-09BE-4F45-81BB-689166D19B36}.Release|x86.Build.0 = Release|Any CPU + 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 000000000000..349f18ed58f2 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/CHANGELOG.md @@ -0,0 +1,15 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### General New Features + + - 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 follows the [Azure SDK Design Guidelines for .NET](https://azure.github.io/azure-sdk/dotnet_introduction.html) which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more. + +This is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, please submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). \ 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 000000000000..1a9611bd4924 --- /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 000000000000..5809c7657cf2 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/README.md @@ -0,0 +1,76 @@ +# Azure resourcehealth Management client library for .NET + +This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html) which provide a number of core capabilities that are shared amongst all Azure SDKs, including the intuitive Azure Identity library, an HTTP Pipeline with custom policies, error-handling, distributed tracing, and much more. + +## Getting started + +### Install the package + +Install the Azure resourcehealth management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.Resourcehealth --prerelease +``` + +### Prerequisites + +* You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) + +### Authenticate the Client + +To create an authenticated client and start interacting with Azure resources, please 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 Azure .NET SDK 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://docs.microsoft.com/samples/browse/?branch=master&languages=csharp&term=managing%20using%20Azure%20.NET%20SDK) + +## 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 on Azure SDK, please refer to [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 +(e.g., label, comment). Simply follow the instructions provided by the +bot. You will only need to do this 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 additional 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 000000000000..c09a8bfeaf31 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/api/Azure.ResourceManager.Resourcehealth.netstandard2.0.cs @@ -0,0 +1,117 @@ +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 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; } + } +} +namespace Azure.ResourceManager.Resourcehealth.Models +{ + [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 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; } } + } + [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; } } + } + 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; } } + } +} 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 000000000000..a2fbc5ce4b4a --- /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/AvailabilityStatusData.cs b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Generated/AvailabilityStatusData.cs new file mode 100644 index 000000000000..6bcaca7dd295 --- /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 000000000000..508411f753e9 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Generated/AvailabilityStatusResource.cs @@ -0,0 +1,141 @@ +// 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/Extensions/ArmResourceExtensionClient.cs b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Generated/Extensions/ArmResourceExtensionClient.cs new file mode 100644 index 000000000000..753ddf7ec5d8 --- /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 000000000000..c4896b70ba37 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Generated/Extensions/ResourcehealthExtensions.cs @@ -0,0 +1,62 @@ +// 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 Azure.ResourceManager.Resourcehealth. + public static partial class ResourcehealthExtensions + { + 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 + } +} 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 000000000000..a71851f073b0 --- /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 000000000000..1539c9999836 --- /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")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("properties")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + properties = AvailabilityStatusProperties.DeserializeAvailabilityStatusProperties(property.Value); + continue; + } + if (property.NameEquals("id")) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name")) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type")) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.ToString()); + 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 000000000000..90a059f49dcc --- /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")) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AvailabilityStatusData.DeserializeAvailabilityStatusData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink")) + { + 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 000000000000..5e8660c2f484 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Generated/Models/AvailabilityStatusListResult.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.ResourceManager.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) + { + if (value == null) + { + throw new ArgumentNullException(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 000000000000..71a43a2a8f79 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Generated/Models/AvailabilityStatusProperties.Serialization.cs @@ -0,0 +1,182 @@ +// 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 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")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + availabilityState = new AvailabilityStateValue(property.Value.GetString()); + continue; + } + if (property.NameEquals("title")) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("summary")) + { + summary = property.Value.GetString(); + continue; + } + if (property.NameEquals("detailedStatus")) + { + detailedStatus = property.Value.GetString(); + continue; + } + if (property.NameEquals("reasonType")) + { + reasonType = property.Value.GetString(); + continue; + } + if (property.NameEquals("rootCauseAttributionTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + rootCauseAttributionTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("healthEventType")) + { + healthEventType = property.Value.GetString(); + continue; + } + if (property.NameEquals("healthEventCause")) + { + healthEventCause = property.Value.GetString(); + continue; + } + if (property.NameEquals("healthEventCategory")) + { + healthEventCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("healthEventId")) + { + healthEventId = property.Value.GetString(); + continue; + } + if (property.NameEquals("resolutionETA")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + resolutionETA = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("occuredTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + occuredTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("reasonChronicity")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + reasonChronicity = new ReasonChronicityType(property.Value.GetString()); + continue; + } + if (property.NameEquals("reportedTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + reportedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("recentlyResolved")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + recentlyResolved = AvailabilityStatusPropertiesRecentlyResolved.DeserializeAvailabilityStatusPropertiesRecentlyResolved(property.Value); + continue; + } + if (property.NameEquals("recommendedActions")) + { + 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")) + { + 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, 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 000000000000..458e28d79428 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Generated/Models/AvailabilityStatusProperties.cs @@ -0,0 +1,98 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +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 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, 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; + 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 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 000000000000..5c7e75346d05 --- /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")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + unavailableOccuredTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("resolvedTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + resolvedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("unavailableSummary")) + { + 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 000000000000..c679cf05e68d --- /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/ReasonChronicityType.cs b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Generated/Models/ReasonChronicityType.cs new file mode 100644 index 000000000000..273326c76e4e --- /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 000000000000..d2aeac811b9e --- /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")) + { + action = property.Value.GetString(); + continue; + } + if (property.NameEquals("actionUrl")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + actionUrl = null; + continue; + } + actionUrl = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("actionUrlText")) + { + 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 000000000000..474dd79af3dd --- /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/ServiceImpactingEvent.Serialization.cs b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Generated/Models/ServiceImpactingEvent.Serialization.cs new file mode 100644 index 000000000000..ea95785e2317 --- /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")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + eventStartTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("eventStatusLastModifiedTime")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + eventStatusLastModifiedTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("correlationId")) + { + correlationId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status")) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = ServiceImpactingEventStatus.DeserializeServiceImpactingEventStatus(property.Value); + continue; + } + if (property.NameEquals("incidentProperties")) + { + 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 000000000000..2280074bfd18 --- /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 000000000000..e00fbab0f7b8 --- /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")) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("service")) + { + service = property.Value.GetString(); + continue; + } + if (property.NameEquals("region")) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("incidentType")) + { + 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 000000000000..bc8050c9d962 --- /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 000000000000..370f4da6a21d --- /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")) + { + 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 000000000000..40fc59e62e22 --- /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/ProviderConstants.cs b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..4152f2022da1 --- /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 000000000000..afbe06cd7266 --- /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 ?? "2020-05-01"; + _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. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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. + /// Subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// 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/Properties/AssemblyInfo.cs b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..d9e23eddf9cc --- /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("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 000000000000..50e543107fa8 --- /dev/null +++ b/sdk/resourcehealth/Azure.ResourceManager.Resourcehealth/src/autorest.md @@ -0,0 +1,50 @@ +# 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: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/resourcehealth/resource-manager/readme.md +output-folder: $(this-folder)/Generated +clear-output-folder: true +skip-csproj: true +modelerfour: + flatten-payloads: false + + + +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 + +``` 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 000000000000..47101212986f --- /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 000000000000..17407320f229 --- /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 000000000000..2cd450777625 --- /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