diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/api/Azure.ResourceManager.Maintenance.netstandard2.0.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/api/Azure.ResourceManager.Maintenance.netstandard2.0.cs index 6fc08853027e..b66507439b4a 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/api/Azure.ResourceManager.Maintenance.netstandard2.0.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/api/Azure.ResourceManager.Maintenance.netstandard2.0.cs @@ -1,3 +1,5 @@ +using System.Collections.Generic; + namespace Azure.ResourceManager.Maintenance { public partial class MaintenanceApplyUpdateCollection : Azure.ResourceManager.ArmCollection @@ -46,6 +48,7 @@ public MaintenanceConfigurationData(Azure.Core.AzureLocation location) : base (d public System.TimeSpan? Duration { get { throw null; } set { } } public System.DateTimeOffset? ExpireOn { get { throw null; } set { } } public System.Collections.Generic.IDictionary ExtensionProperties { get { throw null; } } + public Azure.ResourceManager.Maintenance.Models.InputPatchConfiguration InstallPatches { get { throw null; } set { } } public Azure.ResourceManager.Maintenance.Models.MaintenanceScope? MaintenanceScope { get { throw null; } set { } } public string Namespace { get { throw null; } set { } } public string RecurEvery { get { throw null; } set { } } @@ -79,25 +82,57 @@ public static partial class MaintenanceExtensions public static System.Threading.Tasks.Task> CreateOrUpdateApplyUpdateAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response CreateOrUpdateApplyUpdateByParent(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> CreateOrUpdateApplyUpdateByParentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static Azure.Response CreateOrUpdateConfigurationAssignment(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static System.Threading.Tasks.Task> CreateOrUpdateConfigurationAssignmentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static Azure.Response CreateOrUpdateConfigurationAssignmentByParent(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static Azure.Response CreateOrUpdateConfigurationAssignmentByParent(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static System.Threading.Tasks.Task> CreateOrUpdateConfigurationAssignmentByParentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static System.Threading.Tasks.Task> CreateOrUpdateConfigurationAssignmentByParentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static Azure.Response DeleteConfigurationAssignment(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static System.Threading.Tasks.Task> DeleteConfigurationAssignmentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static Azure.Response DeleteConfigurationAssignmentByParent(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static Azure.Response DeleteConfigurationAssignmentByParent(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static System.Threading.Tasks.Task> DeleteConfigurationAssignmentByParentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static System.Threading.Tasks.Task> DeleteConfigurationAssignmentByParentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetApplyUpdatesByParent(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceGetApplyUpdatesByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetApplyUpdatesByParent(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetApplyUpdatesByParentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, Azure.ResourceManager.Maintenance.Models.ResourceGroupResourceGetApplyUpdatesByParentOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetApplyUpdatesByParentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static Azure.Pageable GetConfigurationAssignments(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static Azure.AsyncPageable GetConfigurationAssignmentsAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static Azure.Pageable GetConfigurationAssignmentsByParent(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public static Azure.AsyncPageable GetConfigurationAssignmentsByParentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Response GetMaintenanceApplyUpdate(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetMaintenanceApplyUpdateAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string applyUpdateName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -113,15 +148,60 @@ public static partial class MaintenanceExtensions public static Azure.ResourceManager.Maintenance.MaintenanceConfigurationCollection GetMaintenanceConfigurations(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } public static Azure.Pageable GetMaintenanceConfigurations(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetMaintenanceConfigurationsAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Response GetMaintenanceNestedResourceConfigurationAssignment(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetMaintenanceNestedResourceConfigurationAssignmentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Maintenance.MaintenanceNestedResourceConfigurationAssignmentResource GetMaintenanceNestedResourceConfigurationAssignmentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Maintenance.MaintenanceNestedResourceConfigurationAssignmentCollection GetMaintenanceNestedResourceConfigurationAssignments(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName) { throw null; } public static Azure.Response GetMaintenancePublicConfiguration(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static System.Threading.Tasks.Task> GetMaintenancePublicConfigurationAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.Maintenance.MaintenancePublicConfigurationResource GetMaintenancePublicConfigurationResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.Maintenance.MaintenancePublicConfigurationCollection GetMaintenancePublicConfigurations(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.Response GetMaintenanceResourceConfigurationAssignment(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetMaintenanceResourceConfigurationAssignmentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Maintenance.MaintenanceResourceConfigurationAssignmentResource GetMaintenanceResourceConfigurationAssignmentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Maintenance.MaintenanceResourceConfigurationAssignmentCollection GetMaintenanceResourceConfigurationAssignments(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName) { throw null; } + public static Azure.Response GetMaintenanceResourceGroupConfigurationAssignment(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string resourceGroupName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetMaintenanceResourceGroupConfigurationAssignmentAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string resourceGroupName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Maintenance.MaintenanceResourceGroupConfigurationAssignmentResource GetMaintenanceResourceGroupConfigurationAssignmentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Maintenance.MaintenanceResourceGroupConfigurationAssignmentCollection GetMaintenanceResourceGroupConfigurationAssignments(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.Response GetMaintenanceSubscriptionConfigurationAssignment(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetMaintenanceSubscriptionConfigurationAssignmentAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Maintenance.MaintenanceSubscriptionConfigurationAssignmentResource GetMaintenanceSubscriptionConfigurationAssignmentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Maintenance.MaintenanceSubscriptionConfigurationAssignmentCollection GetMaintenanceSubscriptionConfigurationAssignments(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } public static Azure.Pageable GetUpdates(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetUpdatesAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.Pageable GetUpdatesByParent(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.AsyncPageable GetUpdatesByParentAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class MaintenanceNestedResourceConfigurationAssignmentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected MaintenanceNestedResourceConfigurationAssignmentCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class MaintenanceNestedResourceConfigurationAssignmentResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected MaintenanceNestedResourceConfigurationAssignmentResource() { } + public virtual Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } public partial class MaintenancePublicConfigurationCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected MaintenancePublicConfigurationCollection() { } @@ -145,6 +225,88 @@ protected MaintenancePublicConfigurationResource() { } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } + public partial class MaintenanceResourceConfigurationAssignmentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected MaintenanceResourceConfigurationAssignmentCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class MaintenanceResourceConfigurationAssignmentResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected MaintenanceResourceConfigurationAssignmentResource() { } + public virtual Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName, string resourceType, string resourceName, string configurationAssignmentName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MaintenanceResourceGroupConfigurationAssignmentCollection : Azure.ResourceManager.ArmCollection + { + protected MaintenanceResourceGroupConfigurationAssignmentCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string resourceGroupName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string resourceGroupName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string resourceGroupName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string resourceGroupName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceGroupName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceGroupName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MaintenanceResourceGroupConfigurationAssignmentResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected MaintenanceResourceGroupConfigurationAssignmentResource() { } + public virtual Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configurationAssignmentName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, string resourceGroupName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteAsync(Azure.WaitUntil waitUntil, string resourceGroupName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string resourceGroupName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string resourceGroupName, string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Update(string resourceGroupName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(string resourceGroupName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class MaintenanceSubscriptionConfigurationAssignmentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected MaintenanceSubscriptionConfigurationAssignmentCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string configurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class MaintenanceSubscriptionConfigurationAssignmentResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected MaintenanceSubscriptionConfigurationAssignmentResource() { } + public virtual Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string configurationAssignmentName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } } namespace Azure.ResourceManager.Maintenance.Models { @@ -155,12 +317,44 @@ public static partial class ArmMaintenanceModelFactory public static Azure.ResourceManager.Maintenance.MaintenanceConfigurationData MaintenanceConfigurationData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string @namespace = null, System.Collections.Generic.IDictionary extensionProperties = null, Azure.ResourceManager.Maintenance.Models.MaintenanceScope? maintenanceScope = default(Azure.ResourceManager.Maintenance.Models.MaintenanceScope?), Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationVisibility? visibility = default(Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationVisibility?), System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? expireOn = default(System.DateTimeOffset?), System.TimeSpan? duration = default(System.TimeSpan?), string timeZone = null, string recurEvery = null) { throw null; } public static Azure.ResourceManager.Maintenance.Models.MaintenanceUpdate MaintenanceUpdate(Azure.ResourceManager.Maintenance.Models.MaintenanceScope? maintenanceScope = default(Azure.ResourceManager.Maintenance.Models.MaintenanceScope?), Azure.ResourceManager.Maintenance.Models.MaintenanceImpactType? impactType = default(Azure.ResourceManager.Maintenance.Models.MaintenanceImpactType?), Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus? status = default(Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus?), int? impactDurationInSec = default(int?), System.DateTimeOffset? notBefore = default(System.DateTimeOffset?), Azure.Core.ResourceIdentifier resourceId = null) { throw null; } } + public partial class InputLinuxParameters + { + public InputLinuxParameters() { } + public System.Collections.Generic.IList ClassificationsToInclude { get { throw null; } } + public System.Collections.Generic.IList PackageNameMasksToExclude { get { throw null; } } + public System.Collections.Generic.IList PackageNameMasksToInclude { get { throw null; } } + } + public partial class InputPatchConfiguration + { + public InputPatchConfiguration() { } + public Azure.ResourceManager.Maintenance.Models.InputLinuxParameters LinuxParameters { get { throw null; } set { } } + public Azure.ResourceManager.Maintenance.Models.RebootOption? RebootSetting { get { throw null; } set { } } + public Azure.ResourceManager.Maintenance.Models.InputWindowsParameters WindowsParameters { get { throw null; } set { } } + } + public partial class InputWindowsParameters + { + public InputWindowsParameters() { } + public System.Collections.Generic.IList ClassificationsToInclude { get { throw null; } } + public bool? ExcludeKbsRequiringReboot { get { throw null; } set { } } + public System.Collections.Generic.IList KbNumbersToExclude { get { throw null; } } + public System.Collections.Generic.IList KbNumbersToInclude { get { throw null; } } + } + public partial class ConfigurationAssignmentFilterProperties + { + public ConfigurationAssignmentFilterProperties() { } + public System.Collections.Generic.IList ResourceTypes { get { throw null; } } + public System.Collections.Generic.IList ResourceGroups { get { throw null; } } + public System.Collections.Generic.IList OSTypes { get { throw null; } } + public System.Collections.Generic.IList Locations { get { throw null; } } + public Azure.ResourceManager.Maintenance.Models.TagSettingsProperties TagSettings { get { throw null; }; set; } + } public partial class MaintenanceConfigurationAssignmentData : Azure.ResourceManager.Models.ResourceData { public MaintenanceConfigurationAssignmentData() { } public Azure.Core.AzureLocation? Location { get { throw null; } set { } } public Azure.Core.ResourceIdentifier MaintenanceConfigurationId { get { throw null; } set { } } public Azure.Core.ResourceIdentifier ResourceId { get { throw null; } set { } } + public Azure.ResourceManager.Maintenance.Models.ConfigurationAssignmentFilterProperties Filter { get { throw null; }; set; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MaintenanceConfigurationVisibility : System.IEquatable @@ -210,6 +404,7 @@ public MaintenanceConfigurationAssignmentData() { } public static Azure.ResourceManager.Maintenance.Models.MaintenanceScope Host { get { throw null; } } public static Azure.ResourceManager.Maintenance.Models.MaintenanceScope InGuestPatch { get { throw null; } } public static Azure.ResourceManager.Maintenance.Models.MaintenanceScope OSImage { get { throw null; } } + public static Azure.ResourceManager.Maintenance.Models.MaintenanceScope Resource { get { throw null; } } public static Azure.ResourceManager.Maintenance.Models.MaintenanceScope SqlDB { get { throw null; } } public static Azure.ResourceManager.Maintenance.Models.MaintenanceScope SqlManagedInstance { get { throw null; } } public bool Equals(Azure.ResourceManager.Maintenance.Models.MaintenanceScope other) { throw null; } @@ -253,6 +448,27 @@ internal MaintenanceUpdate() { } public static bool operator !=(Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus left, Azure.ResourceManager.Maintenance.Models.MaintenanceUpdateStatus right) { throw null; } public override string ToString() { throw null; } } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RebootOption : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RebootOption(string value) { throw null; } + public static Azure.ResourceManager.Maintenance.Models.RebootOption Always { get { throw null; } } + public static Azure.ResourceManager.Maintenance.Models.RebootOption IfRequired { get { throw null; } } + public static Azure.ResourceManager.Maintenance.Models.RebootOption Never { get { throw null; } } + public bool Equals(Azure.ResourceManager.Maintenance.Models.RebootOption 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.Maintenance.Models.RebootOption left, Azure.ResourceManager.Maintenance.Models.RebootOption right) { throw null; } + public static implicit operator Azure.ResourceManager.Maintenance.Models.RebootOption (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Maintenance.Models.RebootOption left, Azure.ResourceManager.Maintenance.Models.RebootOption right) { throw null; } + public override string ToString() { throw null; } + } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public partial class ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions { public ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, Azure.ResourceManager.Maintenance.Models.MaintenanceConfigurationAssignmentData data) { } @@ -264,6 +480,8 @@ public ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions public string ResourceParentType { get { throw null; } } public string ResourceType { get { throw null; } } } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + [System.ObsoleteAttribute("This method is obsolete and will be removed in a future release", false)] public partial class ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions { public ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName) { } @@ -284,4 +502,15 @@ public ResourceGroupResourceGetApplyUpdatesByParentOptions(string providerName, public string ResourceParentType { get { throw null; } } public string ResourceType { get { throw null; } } } + public enum TagOperator + { + All = 0, + Any = 1, + } + public partial class TagSettingsProperties + { + public TagSettingsProperties() { } + public Azure.ResourceManager.Maintenance.Models.TagOperator? FilterOperator { get { throw null; } set { } } + public System.Collections.Generic.IDictionary> Tags { get { throw null; } } + } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Azure.ResourceManager.Maintenance.csproj b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Azure.ResourceManager.Maintenance.csproj index 2401a1494aed..fdc27c27f65d 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Azure.ResourceManager.Maintenance.csproj +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Azure.ResourceManager.Maintenance.csproj @@ -1,8 +1,8 @@ - + 1.2.0-beta.2 - 1.1.2 + 1.1.1 Azure.ResourceManager.Maintenance Microsoft Azure Resource Manager client SDK for Azure resource provider Microsoft.Maintenance. azure;management;arm;resource manager;maintenance diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MaintenanceExtensions.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MaintenanceExtensions.cs index a7662fa882c3..aa643298e154 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MaintenanceExtensions.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/MaintenanceExtensions.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Text; using Azure.ResourceManager.Resources; using System.Threading.Tasks; @@ -14,6 +15,20 @@ namespace Azure.ResourceManager.Maintenance { public static partial class MaintenanceExtensions { + /// + /// Get extension client + /// + /// Resource Group + /// + private static ResourceGroupResourceExtensionClient GetExtensionClient(ResourceGroupResource resourceGroupResource) + { + return resourceGroupResource.GetCachedClient((client) => + { + return new ResourceGroupResourceExtensionClient(client, resourceGroupResource.Id); + } + ); + } + /// /// Track maintenance updates to resource with parent /// @@ -122,9 +137,7 @@ public static async Task> Creat Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); Argument.AssertNotNull(data, nameof(data)); - ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options = new ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, data); - - return await resourceGroupResource.CreateOrUpdateConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.CreateOrUpdateConfigurationAssignmentByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); } /// @@ -161,9 +174,7 @@ public static Response CreateOrUpdateCon Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); Argument.AssertNotNull(data, nameof(data)); - ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options = new ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, data); - - return resourceGroupResource.CreateOrUpdateConfigurationAssignmentByParent(options, cancellationToken); + return resourceGroupResource.CreateOrUpdateConfigurationAssignmentByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken); } /// @@ -198,9 +209,7 @@ public static async Task> Delet Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options = new ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName); - - return await resourceGroupResource.DeleteConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.DeleteConfigurationAssignmentByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// @@ -235,9 +244,271 @@ public static Response DeleteConfigurati Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options = new ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName); + return resourceGroupResource.DeleteConfigurationAssignmentByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName, cancellationToken); + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdate + /// + /// + /// + /// The instance the method will execute against. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + [EditorBrowsable(EditorBrowsableState.Never)] + public static async Task> CreateOrUpdateConfigurationAssignmentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + return await GetExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignmentAsync(providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdate + /// + /// + /// + /// The instance the method will execute against. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Response CreateOrUpdateConfigurationAssignment(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + return GetExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignment(providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken); + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_Delete + /// + /// + /// + /// The instance the method will execute against. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Unique configuration assignment name. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + [EditorBrowsable(EditorBrowsableState.Never)] + public static async Task> DeleteConfigurationAssignmentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + return await GetExtensionClient(resourceGroupResource).DeleteConfigurationAssignmentAsync(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_Delete + /// + /// + /// + /// The instance the method will execute against. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Unique configuration assignment name. + /// The cancellation token to use. + /// , , or is an empty string, and was expected to be non-empty. + /// , , or is null. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Response DeleteConfigurationAssignment(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + return GetExtensionClient(resourceGroupResource).DeleteConfigurationAssignment(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_ListParent + /// + /// + /// + /// The instance the method will execute against. + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public static AsyncPageable GetConfigurationAssignmentsByParentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + return GetExtensionClient(resourceGroupResource).GetConfigurationAssignmentsByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_ListParent + /// + /// + /// + /// The instance the method will execute against. + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , , , or is an empty string, and was expected to be non-empty. + /// , , , or is null. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Pageable GetConfigurationAssignmentsByParent(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + return GetExtensionClient(resourceGroupResource).GetConfigurationAssignmentsByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_List + /// + /// + /// + /// The instance the method will execute against. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public static AsyncPageable GetConfigurationAssignmentsAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + + return GetExtensionClient(resourceGroupResource).GetConfigurationAssignmentsAsync(providerName, resourceType, resourceName, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_List + /// + /// + /// + /// The instance the method will execute against. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// , or is an empty string, and was expected to be non-empty. + /// , or is null. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public static Pageable GetConfigurationAssignments(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - return resourceGroupResource.DeleteConfigurationAssignmentByParent(options, cancellationToken); + return GetExtensionClient(resourceGroupResource).GetConfigurationAssignments(providerName, resourceType, resourceName, cancellationToken); } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/ResourceGroupResourceExtensionClient.cs new file mode 100644 index 000000000000..68d340b89943 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Custom/Extensions/ResourceGroupResourceExtensionClient.cs @@ -0,0 +1,275 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Maintenance.Models; + +namespace Azure.ResourceManager.Maintenance +{ + /// A class to add extension methods to ResourceGroupResource. + internal partial class ResourceGroupResourceExtensionClient : ArmResource + { + private ClientDiagnostics _configurationAssignmentsClientDiagnostics; + private ConfigurationAssignmentsRestOperations _configurationAssignmentsRestClient; + + private ClientDiagnostics ConfigurationAssignmentsClientDiagnostics => _configurationAssignmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); + private ConfigurationAssignmentsRestOperations ConfigurationAssignmentsRestClient => _configurationAssignmentsRestClient ??= new ConfigurationAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdate + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual async Task> CreateOrUpdateConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignment"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdate + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Response CreateOrUpdateConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignment"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_Delete + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Unique configuration assignment name. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual async Task> DeleteConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignment"); + scope.Start(); + try + { + var response = await ConfigurationAssignmentsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_Delete + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Unique configuration assignment name. + /// The cancellation token to use. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Response DeleteConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignment"); + scope.Start(); + try + { + var response = ConfigurationAssignmentsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_ListParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetConfigurationAssignmentsByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignmentsByParent", "value", null, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_ListParent + /// + /// + /// + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetConfigurationAssignmentsByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); + return PageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignmentsByParent", "value", null, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_List + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual AsyncPageable GetConfigurationAssignmentsAsync(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignments", "value", null, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_List + /// + /// + /// + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + [EditorBrowsable(EditorBrowsableState.Never)] + public virtual Pageable GetConfigurationAssignments(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); + return PageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignments", "value", null, cancellationToken); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/ArmMaintenanceModelFactory.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/ArmMaintenanceModelFactory.cs index 79d9910f57c0..a3fd3ed3c607 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/ArmMaintenanceModelFactory.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/ArmMaintenanceModelFactory.cs @@ -27,18 +27,19 @@ public static partial class ArmMaintenanceModelFactory /// Gets or sets extensionProperties of the maintenanceConfiguration. /// Gets or sets maintenanceScope of the configuration. /// Gets or sets the visibility of the configuration. The default value is 'Custom'. + /// The input parameters to be passed to the patch run operation. /// Effective start date of the maintenance window in YYYY-MM-DD hh:mm format. The start date can be set to either the current date or future date. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. /// Effective expiration date of the maintenance window in YYYY-MM-DD hh:mm format. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. Expiration date must be set to a future date. If not provided, it will be set to the maximum datetime 9999-12-31 23:59:59. /// Duration of the maintenance window in HH:mm format. If not provided, default value will be used based on maintenance scope provided. Example: 05:00. /// Name of the timezone. List of timezones can be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. Example: Pacific Standard Time, UTC, W. Europe Standard Time, Korea Standard Time, Cen. Australia Standard Time. - /// Rate at which a Maintenance window is expected to recur. The rate can be expressed as daily, weekly, or monthly schedules. Daily schedule are formatted as recurEvery: [Frequency as integer]['Day(s)']. If no frequency is provided, the default frequency is 1. Daily schedule examples are recurEvery: Day, recurEvery: 3Days. Weekly schedule are formatted as recurEvery: [Frequency as integer]['Week(s)'] [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule examples are recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly schedules are formatted as [Frequency as integer]['Month(s)'] [Comma separated list of month days] or [Frequency as integer]['Month(s)'] [Week of Month (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday]. Monthly schedule examples are recurEvery: Month, recurEvery: 2Months, recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: Month Fourth Monday. + /// Rate at which a Maintenance window is expected to recur. The rate can be expressed as daily, weekly, or monthly schedules. Daily schedule are formatted as recurEvery: [Frequency as integer]['Day(s)']. If no frequency is provided, the default frequency is 1. Daily schedule examples are recurEvery: Day, recurEvery: 3Days. Weekly schedule are formatted as recurEvery: [Frequency as integer]['Week(s)'] [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule examples are recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly schedules are formatted as [Frequency as integer]['Month(s)'] [Comma separated list of month days] or [Frequency as integer]['Month(s)'] [Week of Month (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday] [Optional Offset(No. of days)]. Offset value must be between -6 to 6 inclusive. Monthly schedule examples are recurEvery: Month, recurEvery: 2Months, recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: Month Fourth Monday, recurEvery: Month Last Sunday Offset-3, recurEvery: Month Third Sunday Offset6. /// A new instance for mocking. - public static MaintenanceConfigurationData MaintenanceConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string @namespace = null, IDictionary extensionProperties = null, MaintenanceScope? maintenanceScope = null, MaintenanceConfigurationVisibility? visibility = null, DateTimeOffset? startOn = null, DateTimeOffset? expireOn = null, TimeSpan? duration = null, string timeZone = null, string recurEvery = null) + public static MaintenanceConfigurationData MaintenanceConfigurationData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string @namespace = null, IDictionary extensionProperties = null, MaintenanceScope? maintenanceScope = null, MaintenanceConfigurationVisibility? visibility = null, InputPatchConfiguration installPatches = null, DateTimeOffset? startOn = null, DateTimeOffset? expireOn = null, TimeSpan? duration = null, string timeZone = null, string recurEvery = null) { tags ??= new Dictionary(); extensionProperties ??= new Dictionary(); - return new MaintenanceConfigurationData(id, name, resourceType, systemData, tags, location, @namespace, extensionProperties, maintenanceScope, visibility, startOn, expireOn, duration, timeZone, recurEvery); + return new MaintenanceConfigurationData(id, name, resourceType, systemData, tags, location, @namespace, extensionProperties, maintenanceScope, visibility, installPatches, startOn, expireOn, duration, timeZone, recurEvery); } /// Initializes a new instance of MaintenanceApplyUpdateData. @@ -63,10 +64,11 @@ public static MaintenanceApplyUpdateData MaintenanceApplyUpdateData(ResourceIden /// Location of the resource. /// The maintenance configuration Id. /// The unique resourceId. - /// A new instance for mocking. - public static MaintenanceConfigurationAssignmentData MaintenanceConfigurationAssignmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, ResourceIdentifier maintenanceConfigurationId = null, ResourceIdentifier resourceId = null) + /// Properties of the configuration assignment. + /// A new instance for mocking. + public static MaintenanceConfigurationAssignmentData MaintenanceConfigurationAssignmentData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, AzureLocation? location = null, ResourceIdentifier maintenanceConfigurationId = null, ResourceIdentifier resourceId = null, ConfigurationAssignmentFilterProperties filter = null) { - return new MaintenanceConfigurationAssignmentData(id, name, resourceType, systemData, location, maintenanceConfigurationId, resourceId); + return new MaintenanceConfigurationAssignmentData(id, name, resourceType, systemData, location, maintenanceConfigurationId, resourceId, filter); } /// Initializes a new instance of MaintenanceUpdate. diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MaintenanceExtensions.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MaintenanceExtensions.cs index 9b0eb2c3108f..c5b90fb21fa3 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MaintenanceExtensions.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/MaintenanceExtensions.cs @@ -107,6 +107,63 @@ public static MaintenanceApplyUpdateResource GetMaintenanceApplyUpdateResource(t } #endregion + #region MaintenanceConfigurationAssignmentResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MaintenanceConfigurationAssignmentResource GetMaintenanceConfigurationAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + MaintenanceConfigurationAssignmentResource.ValidateResourceId(id); + return new MaintenanceConfigurationAssignmentResource(client, id); + } + ); + } + #endregion + + #region MaintenanceSubscriptionConfigurationAssignmentResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MaintenanceSubscriptionConfigurationAssignmentResource GetMaintenanceSubscriptionConfigurationAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + MaintenanceSubscriptionConfigurationAssignmentResource.ValidateResourceId(id); + return new MaintenanceSubscriptionConfigurationAssignmentResource(client, id); + } + ); + } + #endregion + + #region MaintenanceResourceGroupConfigurationAssignmentResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static MaintenanceResourceGroupConfigurationAssignmentResource GetMaintenanceResourceGroupConfigurationAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + MaintenanceResourceGroupConfigurationAssignmentResource.ValidateResourceId(id); + return new MaintenanceResourceGroupConfigurationAssignmentResource(client, id); + } + ); + } + #endregion + /// Gets a collection of MaintenanceConfigurationResources in the ResourceGroupResource. /// The instance the method will execute against. /// An object representing collection of MaintenanceConfigurationResources and their operations over a MaintenanceConfigurationResource. @@ -225,77 +282,17 @@ public static Response GetMaintenanceApplyUpdate return resourceGroupResource.GetMaintenanceApplyUpdates().Get(providerName, resourceType, resourceName, applyUpdateName, cancellationToken); } - /// - /// Track maintenance updates to resource with parent - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} - /// - /// - /// Operation Id - /// ApplyUpdates_GetParent - /// - /// - /// - /// The instance the method will execute against. - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// is null. - public static async Task> GetApplyUpdatesByParentAsync(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetApplyUpdatesByParentOptions options, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(options, nameof(options)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApplyUpdatesByParentAsync(options, cancellationToken).ConfigureAwait(false); - } - - /// - /// Track maintenance updates to resource with parent - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} - /// - /// - /// Operation Id - /// ApplyUpdates_GetParent - /// - /// - /// - /// The instance the method will execute against. - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - /// is null. - public static Response GetApplyUpdatesByParent(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetApplyUpdatesByParentOptions options, CancellationToken cancellationToken = default) - { - Argument.AssertNotNull(options, nameof(options)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApplyUpdatesByParent(options, cancellationToken); - } - - /// - /// Apply maintenance updates to resource with parent - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default - /// - /// - /// Operation Id - /// ApplyUpdates_CreateOrUpdateParent - /// - /// - /// + /// Gets a collection of MaintenanceConfigurationAssignmentResources in the ResourceGroupResource. /// The instance the method will execute against. /// Resource provider name. /// Resource parent type. /// Resource parent identifier. /// Resource type. /// Resource identifier. - /// The cancellation token to use. /// , , , or is an empty string, and was expected to be non-empty. /// , , , or is null. - public static async Task> CreateOrUpdateApplyUpdateByParentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + /// An object representing collection of MaintenanceConfigurationAssignmentResources and their operations over a MaintenanceConfigurationAssignmentResource. + public static MaintenanceConfigurationAssignmentCollection GetMaintenanceConfigurationAssignments(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); @@ -303,19 +300,19 @@ public static async Task> CreateOrUpdat Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdateByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMaintenanceConfigurationAssignments(providerName, resourceParentType, resourceParentName, resourceType, resourceName); } /// - /// Apply maintenance updates to resource with parent + /// Get configuration assignment for resource.. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} /// /// /// Operation Id - /// ApplyUpdates_CreateOrUpdateParent + /// ConfigurationAssignments_GetParent /// /// /// @@ -325,136 +322,111 @@ public static async Task> CreateOrUpdat /// Resource parent identifier. /// Resource type. /// Resource identifier. + /// Configuration assignment name. /// The cancellation token to use. - /// , , , or is an empty string, and was expected to be non-empty. - /// , , , or is null. - public static Response CreateOrUpdateApplyUpdateByParent(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + /// , , , , or is an empty string, and was expected to be non-empty. + /// , , , , or is null. + [ForwardsClientCalls] + public static async Task> GetMaintenanceConfigurationAssignmentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdateByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + return await resourceGroupResource.GetMaintenanceConfigurationAssignments(providerName, resourceParentType, resourceParentName, resourceType, resourceName).GetAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// - /// Apply maintenance updates to resource + /// Get configuration assignment for resource.. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} /// /// /// Operation Id - /// ApplyUpdates_CreateOrUpdate + /// ConfigurationAssignments_GetParent /// /// /// /// The instance the method will execute against. /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. /// Resource type. /// Resource identifier. + /// Configuration assignment name. /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. - /// , or is null. - public static async Task> CreateOrUpdateApplyUpdateAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + /// , , , , or is an empty string, and was expected to be non-empty. + /// , , , , or is null. + [ForwardsClientCalls] + public static Response GetMaintenanceConfigurationAssignment(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdateAsync(providerName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); + return resourceGroupResource.GetMaintenanceConfigurationAssignments(providerName, resourceParentType, resourceParentName, resourceType, resourceName).Get(configurationAssignmentName, cancellationToken); } - /// - /// Apply maintenance updates to resource - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default - /// - /// - /// Operation Id - /// ApplyUpdates_CreateOrUpdate - /// - /// - /// + /// Gets a collection of MaintenanceResourceGroupConfigurationAssignmentResources in the ResourceGroupResource. /// The instance the method will execute against. - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// , or is an empty string, and was expected to be non-empty. - /// , or is null. - public static Response CreateOrUpdateApplyUpdate(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + /// An object representing collection of MaintenanceResourceGroupConfigurationAssignmentResources and their operations over a MaintenanceResourceGroupConfigurationAssignmentResource. + public static MaintenanceResourceGroupConfigurationAssignmentCollection GetMaintenanceResourceGroupConfigurationAssignments(this ResourceGroupResource resourceGroupResource) { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdate(providerName, resourceType, resourceName, cancellationToken); + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetMaintenanceResourceGroupConfigurationAssignments(); } /// - /// Register configuration for resource. + /// Get configuration assignment for resource.. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} /// /// /// Operation Id - /// ConfigurationAssignments_CreateOrUpdateParent + /// ConfigurationAssignmentsForResourceGroup_Get /// /// /// /// The instance the method will execute against. - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// Configuration assignment name. /// The cancellation token to use. - /// is null. - public static async Task> CreateOrUpdateConfigurationAssignmentByParentAsync(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetMaintenanceResourceGroupConfigurationAssignmentAsync(this ResourceGroupResource resourceGroupResource, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await resourceGroupResource.GetMaintenanceResourceGroupConfigurationAssignments().GetAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); } /// - /// Register configuration for resource. + /// Get configuration assignment for resource.. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} /// /// /// Operation Id - /// ConfigurationAssignments_CreateOrUpdateParent + /// ConfigurationAssignmentsForResourceGroup_Get /// /// /// /// The instance the method will execute against. - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. + /// Configuration assignment name. /// The cancellation token to use. - /// is null. - public static Response CreateOrUpdateConfigurationAssignmentByParent(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetMaintenanceResourceGroupConfigurationAssignment(this ResourceGroupResource resourceGroupResource, string configurationAssignmentName, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(options, nameof(options)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignmentByParent(options, cancellationToken); + return resourceGroupResource.GetMaintenanceResourceGroupConfigurationAssignments().Get(configurationAssignmentName, cancellationToken); } /// - /// Unregister configuration for resource. + /// Track maintenance updates to resource with parent /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} /// /// /// Operation Id - /// ConfigurationAssignments_DeleteParent + /// ApplyUpdates_GetParent /// /// /// @@ -462,23 +434,23 @@ public static Response CreateOrUpdateCon /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. /// The cancellation token to use. /// is null. - public static async Task> DeleteConfigurationAssignmentByParentAsync(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) + public static async Task> GetApplyUpdatesByParentAsync(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetApplyUpdatesByParentOptions options, CancellationToken cancellationToken = default) { Argument.AssertNotNull(options, nameof(options)); - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteConfigurationAssignmentByParentAsync(options, cancellationToken).ConfigureAwait(false); + return await GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApplyUpdatesByParentAsync(options, cancellationToken).ConfigureAwait(false); } /// - /// Unregister configuration for resource. + /// Track maintenance updates to resource with parent /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} /// /// /// Operation Id - /// ConfigurationAssignments_DeleteParent + /// ApplyUpdates_GetParent /// /// /// @@ -486,151 +458,23 @@ public static async Task> Delet /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. /// The cancellation token to use. /// is null. - public static Response DeleteConfigurationAssignmentByParent(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) + public static Response GetApplyUpdatesByParent(this ResourceGroupResource resourceGroupResource, ResourceGroupResourceGetApplyUpdatesByParentOptions options, CancellationToken cancellationToken = default) { Argument.AssertNotNull(options, nameof(options)); - return GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteConfigurationAssignmentByParent(options, cancellationToken); - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_CreateOrUpdate - /// - /// - /// - /// The instance the method will execute against. - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. - /// , , , or is null. - public static async Task> CreateOrUpdateConfigurationAssignmentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignmentAsync(providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_CreateOrUpdate - /// - /// - /// - /// The instance the method will execute against. - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. - /// , , , or is null. - public static Response CreateOrUpdateConfigurationAssignment(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateConfigurationAssignment(providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken); - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_Delete - /// - /// - /// - /// The instance the method will execute against. - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Unique configuration assignment name. - /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. - /// , , or is null. - public static async Task> DeleteConfigurationAssignmentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return await GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteConfigurationAssignmentAsync(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_Delete - /// - /// - /// - /// The instance the method will execute against. - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Unique configuration assignment name. - /// The cancellation token to use. - /// , , or is an empty string, and was expected to be non-empty. - /// , , or is null. - public static Response DeleteConfigurationAssignment(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); - Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); - Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); - - return GetResourceGroupResourceExtensionClient(resourceGroupResource).DeleteConfigurationAssignment(providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetApplyUpdatesByParent(options, cancellationToken); } /// - /// List configurationAssignments for resource. + /// Apply maintenance updates to resource with parent /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default /// /// /// Operation Id - /// ConfigurationAssignments_ListParent + /// ApplyUpdates_CreateOrUpdateParent /// /// /// @@ -643,8 +487,7 @@ public static Response DeleteConfigurati /// The cancellation token to use. /// , , , or is an empty string, and was expected to be non-empty. /// , , , or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetConfigurationAssignmentsByParentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + public static async Task> CreateOrUpdateApplyUpdateByParentAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); @@ -652,19 +495,19 @@ public static AsyncPageable GetConfigura Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentsByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdateByParentAsync(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); } /// - /// List configurationAssignments for resource. + /// Apply maintenance updates to resource with parent /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default /// /// /// Operation Id - /// ConfigurationAssignments_ListParent + /// ApplyUpdates_CreateOrUpdateParent /// /// /// @@ -677,8 +520,7 @@ public static AsyncPageable GetConfigura /// The cancellation token to use. /// , , , or is an empty string, and was expected to be non-empty. /// , , , or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetConfigurationAssignmentsByParent(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + public static Response CreateOrUpdateApplyUpdateByParent(this ResourceGroupResource resourceGroupResource, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); @@ -686,19 +528,19 @@ public static Pageable GetConfigurationA Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentsByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); + return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdateByParent(providerName, resourceParentType, resourceParentName, resourceType, resourceName, cancellationToken); } /// - /// List configurationAssignments for resource. + /// Apply maintenance updates to resource /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default /// /// /// Operation Id - /// ConfigurationAssignments_List + /// ApplyUpdates_CreateOrUpdate /// /// /// @@ -709,26 +551,25 @@ public static Pageable GetConfigurationA /// The cancellation token to use. /// , or is an empty string, and was expected to be non-empty. /// , or is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetConfigurationAssignmentsAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + public static async Task> CreateOrUpdateApplyUpdateAsync(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignmentsAsync(providerName, resourceType, resourceName, cancellationToken); + return await GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdateAsync(providerName, resourceType, resourceName, cancellationToken).ConfigureAwait(false); } /// - /// List configurationAssignments for resource. + /// Apply maintenance updates to resource /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/default /// /// /// Operation Id - /// ConfigurationAssignments_List + /// ApplyUpdates_CreateOrUpdate /// /// /// @@ -739,14 +580,13 @@ public static AsyncPageable GetConfigura /// The cancellation token to use. /// , or is an empty string, and was expected to be non-empty. /// , or is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetConfigurationAssignments(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) + public static Response CreateOrUpdateApplyUpdate(this ResourceGroupResource resourceGroupResource, string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); - return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetConfigurationAssignments(providerName, resourceType, resourceName, cancellationToken); + return GetResourceGroupResourceExtensionClient(resourceGroupResource).CreateOrUpdateApplyUpdate(providerName, resourceType, resourceName, cancellationToken); } /// @@ -975,6 +815,62 @@ public static Response GetMaintenancePub return subscriptionResource.GetMaintenancePublicConfigurations().Get(resourceName, cancellationToken); } + /// Gets a collection of MaintenanceSubscriptionConfigurationAssignmentResources in the SubscriptionResource. + /// The instance the method will execute against. + /// An object representing collection of MaintenanceSubscriptionConfigurationAssignmentResources and their operations over a MaintenanceSubscriptionConfigurationAssignmentResource. + public static MaintenanceSubscriptionConfigurationAssignmentCollection GetMaintenanceSubscriptionConfigurationAssignments(this SubscriptionResource subscriptionResource) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetMaintenanceSubscriptionConfigurationAssignments(); + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Get + /// + /// + /// + /// The instance the method will execute against. + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static async Task> GetMaintenanceSubscriptionConfigurationAssignmentAsync(this SubscriptionResource subscriptionResource, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + return await subscriptionResource.GetMaintenanceSubscriptionConfigurationAssignments().GetAsync(configurationAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Get + /// + /// + /// + /// The instance the method will execute against. + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public static Response GetMaintenanceSubscriptionConfigurationAssignment(this SubscriptionResource subscriptionResource, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + return subscriptionResource.GetMaintenanceSubscriptionConfigurationAssignments().Get(configurationAssignmentName, cancellationToken); + } + /// /// Get Configuration records within a subscription /// diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs index 36817dcb5b45..1ef78e20d4e3 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -21,8 +21,6 @@ internal partial class ResourceGroupResourceExtensionClient : ArmResource { private ClientDiagnostics _maintenanceApplyUpdateApplyUpdatesClientDiagnostics; private ApplyUpdatesRestOperations _maintenanceApplyUpdateApplyUpdatesRestClient; - private ClientDiagnostics _configurationAssignmentsClientDiagnostics; - private ConfigurationAssignmentsRestOperations _configurationAssignmentsRestClient; private ClientDiagnostics _applyUpdateForResourceGroupClientDiagnostics; private ApplyUpdateForResourceGroupRestOperations _applyUpdateForResourceGroupRestClient; private ClientDiagnostics _updatesClientDiagnostics; @@ -42,8 +40,6 @@ internal ResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifi private ClientDiagnostics MaintenanceApplyUpdateApplyUpdatesClientDiagnostics => _maintenanceApplyUpdateApplyUpdatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceApplyUpdateResource.ResourceType.Namespace, Diagnostics); private ApplyUpdatesRestOperations MaintenanceApplyUpdateApplyUpdatesRestClient => _maintenanceApplyUpdateApplyUpdatesRestClient ??= new ApplyUpdatesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(MaintenanceApplyUpdateResource.ResourceType)); - private ClientDiagnostics ConfigurationAssignmentsClientDiagnostics => _configurationAssignmentsClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); - private ConfigurationAssignmentsRestOperations ConfigurationAssignmentsRestClient => _configurationAssignmentsRestClient ??= new ConfigurationAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics ApplyUpdateForResourceGroupClientDiagnostics => _applyUpdateForResourceGroupClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); private ApplyUpdateForResourceGroupRestOperations ApplyUpdateForResourceGroupRestClient => _applyUpdateForResourceGroupRestClient ??= new ApplyUpdateForResourceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); private ClientDiagnostics UpdatesClientDiagnostics => _updatesClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Maintenance", ProviderConstants.DefaultProviderNamespace, Diagnostics); @@ -69,6 +65,25 @@ public virtual MaintenanceApplyUpdateCollection GetMaintenanceApplyUpdates() return GetCachedClient(Client => new MaintenanceApplyUpdateCollection(Client, Id)); } + /// Gets a collection of MaintenanceConfigurationAssignmentResources in the ResourceGroupResource. + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// An object representing collection of MaintenanceConfigurationAssignmentResources and their operations over a MaintenanceConfigurationAssignmentResource. + public virtual MaintenanceConfigurationAssignmentCollection GetMaintenanceConfigurationAssignments(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName) + { + return new MaintenanceConfigurationAssignmentCollection(Client, Id, providerName, resourceParentType, resourceParentName, resourceType, resourceName); + } + + /// Gets a collection of MaintenanceResourceGroupConfigurationAssignmentResources in the ResourceGroupResource. + /// An object representing collection of MaintenanceResourceGroupConfigurationAssignmentResources and their operations over a MaintenanceResourceGroupConfigurationAssignmentResource. + public virtual MaintenanceResourceGroupConfigurationAssignmentCollection GetMaintenanceResourceGroupConfigurationAssignments() + { + return GetCachedClient(Client => new MaintenanceResourceGroupConfigurationAssignmentCollection(Client, Id)); + } + /// /// Track maintenance updates to resource with parent /// @@ -267,368 +282,6 @@ public virtual Response CreateOrUpdateApplyUpdat } } - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_CreateOrUpdateParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateConfigurationAssignmentByParentAsync(ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignmentByParent"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsRestClient.CreateOrUpdateParentAsync(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, options.Data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_CreateOrUpdateParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual Response CreateOrUpdateConfigurationAssignmentByParent(ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignmentByParent"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsRestClient.CreateOrUpdateParent(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, options.Data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_DeleteParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual async Task> DeleteConfigurationAssignmentByParentAsync(ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignmentByParent"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsRestClient.DeleteParentAsync(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_DeleteParent - /// - /// - /// - /// A property bag which contains all the parameters of this method except the LRO qualifier and request context parameter. - /// The cancellation token to use. - public virtual Response DeleteConfigurationAssignmentByParent(ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions options, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignmentByParent"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsRestClient.DeleteParent(Id.SubscriptionId, Id.ResourceGroupName, options.ProviderName, options.ResourceParentType, options.ResourceParentName, options.ResourceType, options.ResourceName, options.ConfigurationAssignmentName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_CreateOrUpdate - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual async Task> CreateOrUpdateConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignment"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Register configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_CreateOrUpdate - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Configuration assignment name. - /// The configurationAssignment. - /// The cancellation token to use. - public virtual Response CreateOrUpdateConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.CreateOrUpdateConfigurationAssignment"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, data, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_Delete - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Unique configuration assignment name. - /// The cancellation token to use. - public virtual async Task> DeleteConfigurationAssignmentAsync(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignment"); - scope.Start(); - try - { - var response = await ConfigurationAssignmentsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// Unregister configuration for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} - /// - /// - /// Operation Id - /// ConfigurationAssignments_Delete - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// Unique configuration assignment name. - /// The cancellation token to use. - public virtual Response DeleteConfigurationAssignment(string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) - { - using var scope = ConfigurationAssignmentsClientDiagnostics.CreateScope("ResourceGroupResourceExtensionClient.DeleteConfigurationAssignment"); - scope.Start(); - try - { - var response = ConfigurationAssignmentsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// List configurationAssignments for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments - /// - /// - /// Operation Id - /// ConfigurationAssignments_ListParent - /// - /// - /// - /// Resource provider name. - /// Resource parent type. - /// Resource parent identifier. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfigurationAssignmentsByParentAsync(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignmentsByParent", "value", null, cancellationToken); - } - - /// - /// List configurationAssignments for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments - /// - /// - /// Operation Id - /// ConfigurationAssignments_ListParent - /// - /// - /// - /// Resource provider name. - /// Resource parent type. - /// Resource parent identifier. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfigurationAssignmentsByParent(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName); - return PageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignmentsByParent", "value", null, cancellationToken); - } - - /// - /// List configurationAssignments for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments - /// - /// - /// Operation Id - /// ConfigurationAssignments_List - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetConfigurationAssignmentsAsync(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); - return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignments", "value", null, cancellationToken); - } - - /// - /// List configurationAssignments for resource. - /// - /// - /// Request Path - /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments - /// - /// - /// Operation Id - /// ConfigurationAssignments_List - /// - /// - /// - /// Resource provider name. - /// Resource type. - /// Resource identifier. - /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetConfigurationAssignments(string providerName, string resourceType, string resourceName, CancellationToken cancellationToken = default) - { - HttpMessage FirstPageRequest(int? pageSizeHint) => ConfigurationAssignmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, providerName, resourceType, resourceName); - return PageableHelpers.CreatePageable(FirstPageRequest, null, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData, ConfigurationAssignmentsClientDiagnostics, Pipeline, "ResourceGroupResourceExtensionClient.GetConfigurationAssignments", "value", null, cancellationToken); - } - /// /// Get Configuration records within a subscription and resource group /// diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs index 39539bd2bceb..63e0e6a32095 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -51,6 +51,13 @@ public virtual MaintenancePublicConfigurationCollection GetMaintenancePublicConf return GetCachedClient(Client => new MaintenancePublicConfigurationCollection(Client, Id)); } + /// Gets a collection of MaintenanceSubscriptionConfigurationAssignmentResources in the SubscriptionResource. + /// An object representing collection of MaintenanceSubscriptionConfigurationAssignmentResources and their operations over a MaintenanceSubscriptionConfigurationAssignmentResource. + public virtual MaintenanceSubscriptionConfigurationAssignmentCollection GetMaintenanceSubscriptionConfigurationAssignments() + { + return GetCachedClient(Client => new MaintenanceSubscriptionConfigurationAssignmentCollection(Client, Id)); + } + /// /// Get Configuration records within a subscription /// diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationAssignmentCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationAssignmentCollection.cs new file mode 100644 index 000000000000..c8d9e605bcf4 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationAssignmentCollection.cs @@ -0,0 +1,356 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Maintenance +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetMaintenanceConfigurationAssignments method from an instance of . + /// + public partial class MaintenanceConfigurationAssignmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics; + private readonly ConfigurationAssignmentsRestOperations _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient; + private readonly string _providerName; + private readonly string _resourceParentType; + private readonly string _resourceParentName; + private readonly string _resourceType; + private readonly string _resourceName; + + /// Initializes a new instance of the class for mocking. + protected MaintenanceConfigurationAssignmentCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// , , , or is null. + /// , , , or is an empty string, and was expected to be non-empty. + internal MaintenanceConfigurationAssignmentCollection(ArmClient client, ResourceIdentifier id, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName) : base(client, id) + { + _providerName = providerName; + _resourceParentType = resourceParentType; + _resourceParentName = resourceParentName; + _resourceType = resourceType; + _resourceName = resourceName; + _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceConfigurationAssignmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MaintenanceConfigurationAssignmentResource.ResourceType, out string maintenanceConfigurationAssignmentConfigurationAssignmentsApiVersion); + _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient = new ConfigurationAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, maintenanceConfigurationAssignmentConfigurationAssignmentsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdateParent + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.CreateOrUpdateParentAsync(Id.SubscriptionId, Id.ResourceGroupName, _providerName, _resourceParentType, _resourceParentName, _resourceType, _resourceName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdateParent + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.CreateOrUpdateParent(Id.SubscriptionId, Id.ResourceGroupName, _providerName, _resourceParentType, _resourceParentName, _resourceType, _resourceName, configurationAssignmentName, data, cancellationToken); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_GetParent + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentCollection.Get"); + scope.Start(); + try + { + var response = await _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.GetParentAsync(Id.SubscriptionId, Id.ResourceGroupName, _providerName, _resourceParentType, _resourceParentName, _resourceType, _resourceName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_GetParent + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentCollection.Get"); + scope.Start(); + try + { + var response = _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.GetParent(Id.SubscriptionId, Id.ResourceGroupName, _providerName, _resourceParentType, _resourceParentName, _resourceType, _resourceName, configurationAssignmentName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_ListParent + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, _providerName, _resourceParentType, _resourceParentName, _resourceType, _resourceName); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MaintenanceConfigurationAssignmentResource(Client, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(e)), _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics, Pipeline, "MaintenanceConfigurationAssignmentCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// List configurationAssignments for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignments_ListParent + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.CreateListParentRequest(Id.SubscriptionId, Id.ResourceGroupName, _providerName, _resourceParentType, _resourceParentName, _resourceType, _resourceName); + return PageableHelpers.CreatePageable(FirstPageRequest, null, e => new MaintenanceConfigurationAssignmentResource(Client, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(e)), _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics, Pipeline, "MaintenanceConfigurationAssignmentCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_GetParent + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentCollection.Exists"); + scope.Start(); + try + { + var response = await _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.GetParentAsync(Id.SubscriptionId, Id.ResourceGroupName, _providerName, _resourceParentType, _resourceParentName, _resourceType, _resourceName, configurationAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_GetParent + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentCollection.Exists"); + scope.Start(); + try + { + var response = _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.GetParent(Id.SubscriptionId, Id.ResourceGroupName, _providerName, _resourceParentType, _resourceParentName, _resourceType, _resourceName, configurationAssignmentName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentData.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationAssignmentData.cs similarity index 72% rename from sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentData.cs rename to sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationAssignmentData.cs index 69d5fe7ffd90..18dcc2293bf9 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentData.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationAssignmentData.cs @@ -6,11 +6,15 @@ #nullable disable using Azure.Core; +using Azure.ResourceManager.Maintenance.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Maintenance.Models +namespace Azure.ResourceManager.Maintenance { - /// Configuration Assignment. + /// + /// A class representing the MaintenanceConfigurationAssignment data model. + /// Configuration Assignment + /// public partial class MaintenanceConfigurationAssignmentData : ResourceData { /// Initializes a new instance of MaintenanceConfigurationAssignmentData. @@ -26,11 +30,13 @@ public MaintenanceConfigurationAssignmentData() /// Location of the resource. /// The maintenance configuration Id. /// The unique resourceId. - internal MaintenanceConfigurationAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ResourceIdentifier maintenanceConfigurationId, ResourceIdentifier resourceId) : base(id, name, resourceType, systemData) + /// Properties of the configuration assignment. + internal MaintenanceConfigurationAssignmentData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, AzureLocation? location, ResourceIdentifier maintenanceConfigurationId, ResourceIdentifier resourceId, ConfigurationAssignmentFilterProperties filter) : base(id, name, resourceType, systemData) { Location = location; MaintenanceConfigurationId = maintenanceConfigurationId; ResourceId = resourceId; + Filter = filter; } /// Location of the resource. @@ -39,5 +45,7 @@ internal MaintenanceConfigurationAssignmentData(ResourceIdentifier id, string na public ResourceIdentifier MaintenanceConfigurationId { get; set; } /// The unique resourceId. public ResourceIdentifier ResourceId { get; set; } + /// Properties of the configuration assignment. + public ConfigurationAssignmentFilterProperties Filter { get; set; } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationAssignmentResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationAssignmentResource.cs new file mode 100644 index 000000000000..61db1d01f316 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationAssignmentResource.cs @@ -0,0 +1,299 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Maintenance +{ + /// + /// A Class representing a MaintenanceConfigurationAssignment along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetMaintenanceConfigurationAssignmentResource method. + /// Otherwise you can get one from its parent resource using the GetMaintenanceConfigurationAssignment method. + /// + public partial class MaintenanceConfigurationAssignmentResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics; + private readonly ConfigurationAssignmentsRestOperations _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient; + private readonly MaintenanceConfigurationAssignmentData _data; + + /// Initializes a new instance of the class for mocking. + protected MaintenanceConfigurationAssignmentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal MaintenanceConfigurationAssignmentResource(ArmClient client, MaintenanceConfigurationAssignmentData 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 MaintenanceConfigurationAssignmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Maintenance", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string maintenanceConfigurationAssignmentConfigurationAssignmentsApiVersion); + _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient = new ConfigurationAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, maintenanceConfigurationAssignmentConfigurationAssignmentsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Maintenance/configurationAssignments"; + + /// 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 MaintenanceConfigurationAssignmentData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_GetParent + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentResource.Get"); + scope.Start(); + try + { + var response = await _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.GetParentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.ResourceType.Namespace, Id.Parent.Parent.ResourceType.GetLastType(), Id.Parent.Parent.Name, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_GetParent + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentResource.Get"); + scope.Start(); + try + { + var response = _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.GetParent(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.ResourceType.Namespace, Id.Parent.Parent.ResourceType.GetLastType(), Id.Parent.Parent.Name, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_DeleteParent + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentResource.Delete"); + scope.Start(); + try + { + var response = await _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.DeleteParentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.ResourceType.Namespace, Id.Parent.Parent.ResourceType.GetLastType(), Id.Parent.Parent.Name, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_DeleteParent + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentResource.Delete"); + scope.Start(); + try + { + var response = _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.DeleteParent(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.ResourceType.Namespace, Id.Parent.Parent.ResourceType.GetLastType(), Id.Parent.Parent.Name, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, cancellationToken); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdateParent + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The configurationAssignment. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentResource.Update"); + scope.Start(); + try + { + var response = await _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.CreateOrUpdateParentAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.ResourceType.Namespace, Id.Parent.Parent.ResourceType.GetLastType(), Id.Parent.Parent.Name, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignments_CreateOrUpdateParent + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The configurationAssignment. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceConfigurationAssignmentConfigurationAssignmentsClientDiagnostics.CreateScope("MaintenanceConfigurationAssignmentResource.Update"); + scope.Start(); + try + { + var response = _maintenanceConfigurationAssignmentConfigurationAssignmentsRestClient.CreateOrUpdateParent(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Parent.ResourceType.Namespace, Id.Parent.Parent.ResourceType.GetLastType(), Id.Parent.Parent.Name, Id.Parent.ResourceType.GetLastType(), Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationData.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationData.cs index 53867b700bdf..55fe3c5bea0e 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationData.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceConfigurationData.cs @@ -37,17 +37,19 @@ public MaintenanceConfigurationData(AzureLocation location) : base(location) /// Gets or sets extensionProperties of the maintenanceConfiguration. /// Gets or sets maintenanceScope of the configuration. /// Gets or sets the visibility of the configuration. The default value is 'Custom'. + /// The input parameters to be passed to the patch run operation. /// Effective start date of the maintenance window in YYYY-MM-DD hh:mm format. The start date can be set to either the current date or future date. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. /// Effective expiration date of the maintenance window in YYYY-MM-DD hh:mm format. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. Expiration date must be set to a future date. If not provided, it will be set to the maximum datetime 9999-12-31 23:59:59. /// Duration of the maintenance window in HH:mm format. If not provided, default value will be used based on maintenance scope provided. Example: 05:00. /// Name of the timezone. List of timezones can be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. Example: Pacific Standard Time, UTC, W. Europe Standard Time, Korea Standard Time, Cen. Australia Standard Time. - /// Rate at which a Maintenance window is expected to recur. The rate can be expressed as daily, weekly, or monthly schedules. Daily schedule are formatted as recurEvery: [Frequency as integer]['Day(s)']. If no frequency is provided, the default frequency is 1. Daily schedule examples are recurEvery: Day, recurEvery: 3Days. Weekly schedule are formatted as recurEvery: [Frequency as integer]['Week(s)'] [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule examples are recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly schedules are formatted as [Frequency as integer]['Month(s)'] [Comma separated list of month days] or [Frequency as integer]['Month(s)'] [Week of Month (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday]. Monthly schedule examples are recurEvery: Month, recurEvery: 2Months, recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: Month Fourth Monday. - internal MaintenanceConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string @namespace, IDictionary extensionProperties, MaintenanceScope? maintenanceScope, MaintenanceConfigurationVisibility? visibility, DateTimeOffset? startOn, DateTimeOffset? expireOn, TimeSpan? duration, string timeZone, string recurEvery) : base(id, name, resourceType, systemData, tags, location) + /// Rate at which a Maintenance window is expected to recur. The rate can be expressed as daily, weekly, or monthly schedules. Daily schedule are formatted as recurEvery: [Frequency as integer]['Day(s)']. If no frequency is provided, the default frequency is 1. Daily schedule examples are recurEvery: Day, recurEvery: 3Days. Weekly schedule are formatted as recurEvery: [Frequency as integer]['Week(s)'] [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule examples are recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly schedules are formatted as [Frequency as integer]['Month(s)'] [Comma separated list of month days] or [Frequency as integer]['Month(s)'] [Week of Month (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday] [Optional Offset(No. of days)]. Offset value must be between -6 to 6 inclusive. Monthly schedule examples are recurEvery: Month, recurEvery: 2Months, recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: Month Fourth Monday, recurEvery: Month Last Sunday Offset-3, recurEvery: Month Third Sunday Offset6. + internal MaintenanceConfigurationData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, string @namespace, IDictionary extensionProperties, MaintenanceScope? maintenanceScope, MaintenanceConfigurationVisibility? visibility, InputPatchConfiguration installPatches, DateTimeOffset? startOn, DateTimeOffset? expireOn, TimeSpan? duration, string timeZone, string recurEvery) : base(id, name, resourceType, systemData, tags, location) { Namespace = @namespace; ExtensionProperties = extensionProperties; MaintenanceScope = maintenanceScope; Visibility = visibility; + InstallPatches = installPatches; StartOn = startOn; ExpireOn = expireOn; Duration = duration; @@ -63,6 +65,8 @@ internal MaintenanceConfigurationData(ResourceIdentifier id, string name, Resour public MaintenanceScope? MaintenanceScope { get; set; } /// Gets or sets the visibility of the configuration. The default value is 'Custom'. public MaintenanceConfigurationVisibility? Visibility { get; set; } + /// The input parameters to be passed to the patch run operation. + public InputPatchConfiguration InstallPatches { get; set; } /// Effective start date of the maintenance window in YYYY-MM-DD hh:mm format. The start date can be set to either the current date or future date. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. public DateTimeOffset? StartOn { get; set; } /// Effective expiration date of the maintenance window in YYYY-MM-DD hh:mm format. The window will be created in the time zone provided and adjusted to daylight savings according to that time zone. Expiration date must be set to a future date. If not provided, it will be set to the maximum datetime 9999-12-31 23:59:59. @@ -71,7 +75,7 @@ internal MaintenanceConfigurationData(ResourceIdentifier id, string name, Resour public TimeSpan? Duration { get; set; } /// Name of the timezone. List of timezones can be obtained by executing [System.TimeZoneInfo]::GetSystemTimeZones() in PowerShell. Example: Pacific Standard Time, UTC, W. Europe Standard Time, Korea Standard Time, Cen. Australia Standard Time. public string TimeZone { get; set; } - /// Rate at which a Maintenance window is expected to recur. The rate can be expressed as daily, weekly, or monthly schedules. Daily schedule are formatted as recurEvery: [Frequency as integer]['Day(s)']. If no frequency is provided, the default frequency is 1. Daily schedule examples are recurEvery: Day, recurEvery: 3Days. Weekly schedule are formatted as recurEvery: [Frequency as integer]['Week(s)'] [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule examples are recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly schedules are formatted as [Frequency as integer]['Month(s)'] [Comma separated list of month days] or [Frequency as integer]['Month(s)'] [Week of Month (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday]. Monthly schedule examples are recurEvery: Month, recurEvery: 2Months, recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: Month Fourth Monday. + /// Rate at which a Maintenance window is expected to recur. The rate can be expressed as daily, weekly, or monthly schedules. Daily schedule are formatted as recurEvery: [Frequency as integer]['Day(s)']. If no frequency is provided, the default frequency is 1. Daily schedule examples are recurEvery: Day, recurEvery: 3Days. Weekly schedule are formatted as recurEvery: [Frequency as integer]['Week(s)'] [Optional comma separated list of weekdays Monday-Sunday]. Weekly schedule examples are recurEvery: 3Weeks, recurEvery: Week Saturday,Sunday. Monthly schedules are formatted as [Frequency as integer]['Month(s)'] [Comma separated list of month days] or [Frequency as integer]['Month(s)'] [Week of Month (First, Second, Third, Fourth, Last)] [Weekday Monday-Sunday] [Optional Offset(No. of days)]. Offset value must be between -6 to 6 inclusive. Monthly schedule examples are recurEvery: Month, recurEvery: 2Months, recurEvery: Month day23,day24, recurEvery: Month Last Sunday, recurEvery: Month Fourth Monday, recurEvery: Month Last Sunday Offset-3, recurEvery: Month Third Sunday Offset6. public string RecurEvery { get; set; } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceResourceGroupConfigurationAssignmentCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceResourceGroupConfigurationAssignmentCollection.cs new file mode 100644 index 000000000000..14d55f3d84bd --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceResourceGroupConfigurationAssignmentCollection.cs @@ -0,0 +1,280 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Maintenance +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetMaintenanceResourceGroupConfigurationAssignments method from an instance of . + /// + public partial class MaintenanceResourceGroupConfigurationAssignmentCollection : ArmCollection + { + private readonly ClientDiagnostics _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics; + private readonly ConfigurationAssignmentsForResourceGroupRestOperations _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient; + + /// Initializes a new instance of the class for mocking. + protected MaintenanceResourceGroupConfigurationAssignmentCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal MaintenanceResourceGroupConfigurationAssignmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceResourceGroupConfigurationAssignmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MaintenanceResourceGroupConfigurationAssignmentResource.ResourceType, out string maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupApiVersion); + _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient = new ConfigurationAssignmentsForResourceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceResourceGroupConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, data, cancellationToken); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceResourceGroupConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentCollection.Get"); + scope.Start(); + try + { + var response = await _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceResourceGroupConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentCollection.Get"); + scope.Start(); + try + { + var response = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceResourceGroupConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentCollection.Exists"); + scope.Start(); + try + { + var response = await _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentCollection.Exists"); + scope.Start(); + try + { + var response = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, configurationAssignmentName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceResourceGroupConfigurationAssignmentResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceResourceGroupConfigurationAssignmentResource.cs new file mode 100644 index 000000000000..1913aa78b05e --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceResourceGroupConfigurationAssignmentResource.cs @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Maintenance +{ + /// + /// A Class representing a MaintenanceResourceGroupConfigurationAssignment along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetMaintenanceResourceGroupConfigurationAssignmentResource method. + /// Otherwise you can get one from its parent resource using the GetMaintenanceResourceGroupConfigurationAssignment method. + /// + public partial class MaintenanceResourceGroupConfigurationAssignmentResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string configurationAssignmentName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics; + private readonly ConfigurationAssignmentsForResourceGroupRestOperations _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient; + private readonly MaintenanceConfigurationAssignmentData _data; + + /// Initializes a new instance of the class for mocking. + protected MaintenanceResourceGroupConfigurationAssignmentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal MaintenanceResourceGroupConfigurationAssignmentResource(ArmClient client, MaintenanceConfigurationAssignmentData 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 MaintenanceResourceGroupConfigurationAssignmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Maintenance", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupApiVersion); + _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient = new ConfigurationAssignmentsForResourceGroupRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Maintenance/configurationAssignments"; + + /// 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 MaintenanceConfigurationAssignmentData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentResource.Get"); + scope.Start(); + try + { + var response = await _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceResourceGroupConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentResource.Get"); + scope.Start(); + try + { + var response = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceResourceGroupConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentResource.Delete"); + scope.Start(); + try + { + var response = await _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceResourceGroupConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentResource.Delete"); + scope.Start(); + try + { + var response = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceResourceGroupConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Update + /// + /// + /// + /// The configurationAssignment. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentResource.Update"); + scope.Start(); + try + { + var response = await _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new MaintenanceResourceGroupConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForResourceGroup_Update + /// + /// + /// + /// The configurationAssignment. + /// The cancellation token to use. + /// is null. + public virtual Response Update(MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupClientDiagnostics.CreateScope("MaintenanceResourceGroupConfigurationAssignmentResource.Update"); + scope.Start(); + try + { + var response = _maintenanceResourceGroupConfigurationAssignmentConfigurationAssignmentsForResourceGroupRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, data, cancellationToken); + return Response.FromValue(new MaintenanceResourceGroupConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceSubscriptionConfigurationAssignmentCollection.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceSubscriptionConfigurationAssignmentCollection.cs new file mode 100644 index 000000000000..67732041c23d --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceSubscriptionConfigurationAssignmentCollection.cs @@ -0,0 +1,344 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Maintenance +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetMaintenanceSubscriptionConfigurationAssignments method from an instance of . + /// + public partial class MaintenanceSubscriptionConfigurationAssignmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics; + private readonly ConfigurationAssignmentsForSubscriptionsRestOperations _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient; + private readonly ClientDiagnostics _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsWithinSubscriptionClientDiagnostics; + private readonly ConfigurationAssignmentsWithinSubscriptionRestOperations _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsWithinSubscriptionRestClient; + + /// Initializes a new instance of the class for mocking. + protected MaintenanceSubscriptionConfigurationAssignmentCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal MaintenanceSubscriptionConfigurationAssignmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceSubscriptionConfigurationAssignmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MaintenanceSubscriptionConfigurationAssignmentResource.ResourceType, out string maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsApiVersion); + _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient = new ConfigurationAssignmentsForSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsApiVersion); + _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsWithinSubscriptionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Maintenance", MaintenanceSubscriptionConfigurationAssignmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(MaintenanceSubscriptionConfigurationAssignmentResource.ResourceType, out string maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsWithinSubscriptionApiVersion); + _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsWithinSubscriptionRestClient = new ConfigurationAssignmentsWithinSubscriptionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsWithinSubscriptionApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, configurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceSubscriptionConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_CreateOrUpdate + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.CreateOrUpdate(Id.SubscriptionId, configurationAssignmentName, data, cancellationToken); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceSubscriptionConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentCollection.Get"); + scope.Start(); + try + { + var response = await _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.GetAsync(Id.SubscriptionId, configurationAssignmentName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceSubscriptionConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentCollection.Get"); + scope.Start(); + try + { + var response = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.Get(Id.SubscriptionId, configurationAssignmentName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceSubscriptionConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignmentsWithinSubscription_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsWithinSubscriptionRestClient.CreateListRequest(Id.SubscriptionId); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new MaintenanceSubscriptionConfigurationAssignmentResource(Client, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(e)), _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsWithinSubscriptionClientDiagnostics, Pipeline, "MaintenanceSubscriptionConfigurationAssignmentCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Get configuration assignment within a subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments + /// + /// + /// Operation Id + /// ConfigurationAssignmentsWithinSubscription_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsWithinSubscriptionRestClient.CreateListRequest(Id.SubscriptionId); + return PageableHelpers.CreatePageable(FirstPageRequest, null, e => new MaintenanceSubscriptionConfigurationAssignmentResource(Client, MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(e)), _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsWithinSubscriptionClientDiagnostics, Pipeline, "MaintenanceSubscriptionConfigurationAssignmentCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentCollection.Exists"); + scope.Start(); + try + { + var response = await _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.GetAsync(Id.SubscriptionId, configurationAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Get + /// + /// + /// + /// Configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentCollection.Exists"); + scope.Start(); + try + { + var response = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.Get(Id.SubscriptionId, configurationAssignmentName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceSubscriptionConfigurationAssignmentResource.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceSubscriptionConfigurationAssignmentResource.cs new file mode 100644 index 000000000000..4a1fcb38a386 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/MaintenanceSubscriptionConfigurationAssignmentResource.cs @@ -0,0 +1,290 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Maintenance +{ + /// + /// A Class representing a MaintenanceSubscriptionConfigurationAssignment along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetMaintenanceSubscriptionConfigurationAssignmentResource method. + /// Otherwise you can get one from its parent resource using the GetMaintenanceSubscriptionConfigurationAssignment method. + /// + public partial class MaintenanceSubscriptionConfigurationAssignmentResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string configurationAssignmentName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics; + private readonly ConfigurationAssignmentsForSubscriptionsRestOperations _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient; + private readonly MaintenanceConfigurationAssignmentData _data; + + /// Initializes a new instance of the class for mocking. + protected MaintenanceSubscriptionConfigurationAssignmentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal MaintenanceSubscriptionConfigurationAssignmentResource(ArmClient client, MaintenanceConfigurationAssignmentData 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 MaintenanceSubscriptionConfigurationAssignmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Maintenance", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsApiVersion); + _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient = new ConfigurationAssignmentsForSubscriptionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Maintenance/configurationAssignments"; + + /// 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 MaintenanceConfigurationAssignmentData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentResource.Get"); + scope.Start(); + try + { + var response = await _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceSubscriptionConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get configuration assignment for resource.. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentResource.Get"); + scope.Start(); + try + { + var response = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new MaintenanceSubscriptionConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task> DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentResource.Delete"); + scope.Start(); + try + { + var response = await _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.DeleteAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceSubscriptionConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Unregister configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentResource.Delete"); + scope.Start(); + try + { + var response = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.Delete(Id.SubscriptionId, Id.Name, cancellationToken); + var operation = new MaintenanceArmOperation(Response.FromValue(new MaintenanceSubscriptionConfigurationAssignmentResource(Client, response), response.GetRawResponse())); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Update + /// + /// + /// + /// The configurationAssignment. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentResource.Update"); + scope.Start(); + try + { + var response = await _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.UpdateAsync(Id.SubscriptionId, Id.Name, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new MaintenanceSubscriptionConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Register configuration for resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} + /// + /// + /// Operation Id + /// ConfigurationAssignmentsForSubscriptions_Update + /// + /// + /// + /// The configurationAssignment. + /// The cancellation token to use. + /// is null. + public virtual Response Update(MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsClientDiagnostics.CreateScope("MaintenanceSubscriptionConfigurationAssignmentResource.Update"); + scope.Start(); + try + { + var response = _maintenanceSubscriptionConfigurationAssignmentConfigurationAssignmentsForSubscriptionsRestClient.Update(Id.SubscriptionId, Id.Name, data, cancellationToken); + return Response.FromValue(new MaintenanceSubscriptionConfigurationAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ConfigurationAssignmentFilterProperties.Serialization.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ConfigurationAssignmentFilterProperties.Serialization.cs new file mode 100644 index 000000000000..a8a9b62d6106 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ConfigurationAssignmentFilterProperties.Serialization.cs @@ -0,0 +1,149 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Maintenance.Models +{ + public partial class ConfigurationAssignmentFilterProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(ResourceTypes)) + { + writer.WritePropertyName("resourceTypes"u8); + writer.WriteStartArray(); + foreach (var item in ResourceTypes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ResourceGroups)) + { + writer.WritePropertyName("resourceGroups"u8); + writer.WriteStartArray(); + foreach (var item in ResourceGroups) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(OSTypes)) + { + writer.WritePropertyName("osTypes"u8); + writer.WriteStartArray(); + foreach (var item in OSTypes) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Locations)) + { + writer.WritePropertyName("locations"u8); + writer.WriteStartArray(); + foreach (var item in Locations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(TagSettings)) + { + writer.WritePropertyName("tagSettings"u8); + writer.WriteObjectValue(TagSettings); + } + writer.WriteEndObject(); + } + + internal static ConfigurationAssignmentFilterProperties DeserializeConfigurationAssignmentFilterProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> resourceTypes = default; + Optional> resourceGroups = default; + Optional> osTypes = default; + Optional> locations = default; + Optional tagSettings = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + resourceTypes = array; + continue; + } + if (property.NameEquals("resourceGroups"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + resourceGroups = array; + continue; + } + if (property.NameEquals("osTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + osTypes = array; + continue; + } + if (property.NameEquals("locations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + locations = array; + continue; + } + if (property.NameEquals("tagSettings"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + tagSettings = TagSettingsProperties.DeserializeTagSettingsProperties(property.Value); + continue; + } + } + return new ConfigurationAssignmentFilterProperties(Optional.ToList(resourceTypes), Optional.ToList(resourceGroups), Optional.ToList(osTypes), Optional.ToList(locations), tagSettings.Value); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ConfigurationAssignmentFilterProperties.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ConfigurationAssignmentFilterProperties.cs new file mode 100644 index 000000000000..be8a885f5140 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ConfigurationAssignmentFilterProperties.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Maintenance.Models +{ + /// Azure query for the update configuration. + public partial class ConfigurationAssignmentFilterProperties + { + /// Initializes a new instance of ConfigurationAssignmentFilterProperties. + public ConfigurationAssignmentFilterProperties() + { + ResourceTypes = new ChangeTrackingList(); + ResourceGroups = new ChangeTrackingList(); + OSTypes = new ChangeTrackingList(); + Locations = new ChangeTrackingList(); + } + + /// Initializes a new instance of ConfigurationAssignmentFilterProperties. + /// List of allowed resources. + /// List of allowed resource groups. + /// List of allowed operating systems. + /// List of locations to scope the query to. + /// Tag settings for the VM. + internal ConfigurationAssignmentFilterProperties(IList resourceTypes, IList resourceGroups, IList osTypes, IList locations, TagSettingsProperties tagSettings) + { + ResourceTypes = resourceTypes; + ResourceGroups = resourceGroups; + OSTypes = osTypes; + Locations = locations; + TagSettings = tagSettings; + } + + /// List of allowed resources. + public IList ResourceTypes { get; } + /// List of allowed resource groups. + public IList ResourceGroups { get; } + /// List of allowed operating systems. + public IList OSTypes { get; } + /// List of locations to scope the query to. + public IList Locations { get; } + /// Tag settings for the VM. + public TagSettingsProperties TagSettings { get; set; } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputLinuxParameters.Serialization.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputLinuxParameters.Serialization.cs new file mode 100644 index 000000000000..7ee6e1ffdd8d --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputLinuxParameters.Serialization.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Maintenance.Models +{ + public partial class InputLinuxParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(PackageNameMasksToExclude)) + { + writer.WritePropertyName("packageNameMasksToExclude"u8); + writer.WriteStartArray(); + foreach (var item in PackageNameMasksToExclude) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(PackageNameMasksToInclude)) + { + writer.WritePropertyName("packageNameMasksToInclude"u8); + writer.WriteStartArray(); + foreach (var item in PackageNameMasksToInclude) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ClassificationsToInclude)) + { + writer.WritePropertyName("classificationsToInclude"u8); + writer.WriteStartArray(); + foreach (var item in ClassificationsToInclude) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static InputLinuxParameters DeserializeInputLinuxParameters(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> packageNameMasksToExclude = default; + Optional> packageNameMasksToInclude = default; + Optional> classificationsToInclude = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("packageNameMasksToExclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + packageNameMasksToExclude = array; + continue; + } + if (property.NameEquals("packageNameMasksToInclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + packageNameMasksToInclude = array; + continue; + } + if (property.NameEquals("classificationsToInclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + classificationsToInclude = array; + continue; + } + } + return new InputLinuxParameters(Optional.ToList(packageNameMasksToExclude), Optional.ToList(packageNameMasksToInclude), Optional.ToList(classificationsToInclude)); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputLinuxParameters.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputLinuxParameters.cs new file mode 100644 index 000000000000..050163d363c1 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputLinuxParameters.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Maintenance.Models +{ + /// Input properties for patching a Linux machine. + public partial class InputLinuxParameters + { + /// Initializes a new instance of InputLinuxParameters. + public InputLinuxParameters() + { + PackageNameMasksToExclude = new ChangeTrackingList(); + PackageNameMasksToInclude = new ChangeTrackingList(); + ClassificationsToInclude = new ChangeTrackingList(); + } + + /// Initializes a new instance of InputLinuxParameters. + /// Package names to be excluded for patching. + /// Package names to be included for patching. + /// Classification category of patches to be patched. + internal InputLinuxParameters(IList packageNameMasksToExclude, IList packageNameMasksToInclude, IList classificationsToInclude) + { + PackageNameMasksToExclude = packageNameMasksToExclude; + PackageNameMasksToInclude = packageNameMasksToInclude; + ClassificationsToInclude = classificationsToInclude; + } + + /// Package names to be excluded for patching. + public IList PackageNameMasksToExclude { get; } + /// Package names to be included for patching. + public IList PackageNameMasksToInclude { get; } + /// Classification category of patches to be patched. + public IList ClassificationsToInclude { get; } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputPatchConfiguration.Serialization.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputPatchConfiguration.Serialization.cs new file mode 100644 index 000000000000..a169de5a632d --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputPatchConfiguration.Serialization.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Maintenance.Models +{ + public partial class InputPatchConfiguration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(RebootSetting)) + { + writer.WritePropertyName("rebootSetting"u8); + writer.WriteStringValue(RebootSetting.Value.ToString()); + } + if (Optional.IsDefined(WindowsParameters)) + { + writer.WritePropertyName("windowsParameters"u8); + writer.WriteObjectValue(WindowsParameters); + } + if (Optional.IsDefined(LinuxParameters)) + { + writer.WritePropertyName("linuxParameters"u8); + writer.WriteObjectValue(LinuxParameters); + } + writer.WriteEndObject(); + } + + internal static InputPatchConfiguration DeserializeInputPatchConfiguration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional rebootSetting = default; + Optional windowsParameters = default; + Optional linuxParameters = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("rebootSetting"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rebootSetting = new RebootOption(property.Value.GetString()); + continue; + } + if (property.NameEquals("windowsParameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + windowsParameters = InputWindowsParameters.DeserializeInputWindowsParameters(property.Value); + continue; + } + if (property.NameEquals("linuxParameters"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + linuxParameters = InputLinuxParameters.DeserializeInputLinuxParameters(property.Value); + continue; + } + } + return new InputPatchConfiguration(Optional.ToNullable(rebootSetting), windowsParameters.Value, linuxParameters.Value); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputPatchConfiguration.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputPatchConfiguration.cs new file mode 100644 index 000000000000..bbeb6533d1f7 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputPatchConfiguration.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Maintenance.Models +{ + /// Input configuration for a patch run. + public partial class InputPatchConfiguration + { + /// Initializes a new instance of InputPatchConfiguration. + public InputPatchConfiguration() + { + } + + /// Initializes a new instance of InputPatchConfiguration. + /// Possible reboot preference as defined by the user based on which it would be decided to reboot the machine or not after the patch operation is completed. + /// Input parameters specific to patching a Windows machine. For Linux machines, do not pass this property. + /// Input parameters specific to patching Linux machine. For Windows machines, do not pass this property. + internal InputPatchConfiguration(RebootOption? rebootSetting, InputWindowsParameters windowsParameters, InputLinuxParameters linuxParameters) + { + RebootSetting = rebootSetting; + WindowsParameters = windowsParameters; + LinuxParameters = linuxParameters; + } + + /// Possible reboot preference as defined by the user based on which it would be decided to reboot the machine or not after the patch operation is completed. + public RebootOption? RebootSetting { get; set; } + /// Input parameters specific to patching a Windows machine. For Linux machines, do not pass this property. + public InputWindowsParameters WindowsParameters { get; set; } + /// Input parameters specific to patching Linux machine. For Windows machines, do not pass this property. + public InputLinuxParameters LinuxParameters { get; set; } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputWindowsParameters.Serialization.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputWindowsParameters.Serialization.cs new file mode 100644 index 000000000000..6419111b0fb0 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputWindowsParameters.Serialization.cs @@ -0,0 +1,124 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Maintenance.Models +{ + public partial class InputWindowsParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(KbNumbersToExclude)) + { + writer.WritePropertyName("kbNumbersToExclude"u8); + writer.WriteStartArray(); + foreach (var item in KbNumbersToExclude) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(KbNumbersToInclude)) + { + writer.WritePropertyName("kbNumbersToInclude"u8); + writer.WriteStartArray(); + foreach (var item in KbNumbersToInclude) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ClassificationsToInclude)) + { + writer.WritePropertyName("classificationsToInclude"u8); + writer.WriteStartArray(); + foreach (var item in ClassificationsToInclude) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ExcludeKbsRequiringReboot)) + { + writer.WritePropertyName("excludeKbsRequiringReboot"u8); + writer.WriteBooleanValue(ExcludeKbsRequiringReboot.Value); + } + writer.WriteEndObject(); + } + + internal static InputWindowsParameters DeserializeInputWindowsParameters(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> kbNumbersToExclude = default; + Optional> kbNumbersToInclude = default; + Optional> classificationsToInclude = default; + Optional excludeKbsRequiringReboot = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kbNumbersToExclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + kbNumbersToExclude = array; + continue; + } + if (property.NameEquals("kbNumbersToInclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + kbNumbersToInclude = array; + continue; + } + if (property.NameEquals("classificationsToInclude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + classificationsToInclude = array; + continue; + } + if (property.NameEquals("excludeKbsRequiringReboot"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + excludeKbsRequiringReboot = property.Value.GetBoolean(); + continue; + } + } + return new InputWindowsParameters(Optional.ToList(kbNumbersToExclude), Optional.ToList(kbNumbersToInclude), Optional.ToList(classificationsToInclude), Optional.ToNullable(excludeKbsRequiringReboot)); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputWindowsParameters.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputWindowsParameters.cs new file mode 100644 index 000000000000..bc74dfd445e4 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/InputWindowsParameters.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Maintenance.Models +{ + /// Input properties for patching a Windows machine. + public partial class InputWindowsParameters + { + /// Initializes a new instance of InputWindowsParameters. + public InputWindowsParameters() + { + KbNumbersToExclude = new ChangeTrackingList(); + KbNumbersToInclude = new ChangeTrackingList(); + ClassificationsToInclude = new ChangeTrackingList(); + } + + /// Initializes a new instance of InputWindowsParameters. + /// Windows KBID to be excluded for patching. + /// Windows KBID to be included for patching. + /// Classification category of patches to be patched. + /// Exclude patches which need reboot. + internal InputWindowsParameters(IList kbNumbersToExclude, IList kbNumbersToInclude, IList classificationsToInclude, bool? excludeKbsRequiringReboot) + { + KbNumbersToExclude = kbNumbersToExclude; + KbNumbersToInclude = kbNumbersToInclude; + ClassificationsToInclude = classificationsToInclude; + ExcludeKbsRequiringReboot = excludeKbsRequiringReboot; + } + + /// Windows KBID to be excluded for patching. + public IList KbNumbersToExclude { get; } + /// Windows KBID to be included for patching. + public IList KbNumbersToInclude { get; } + /// Classification category of patches to be patched. + public IList ClassificationsToInclude { get; } + /// Exclude patches which need reboot. + public bool? ExcludeKbsRequiringReboot { get; set; } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentData.Serialization.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentData.Serialization.cs index 17a258d576ea..e574577ddacb 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentData.Serialization.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentData.Serialization.cs @@ -7,9 +7,10 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Maintenance.Models; using Azure.ResourceManager.Models; -namespace Azure.ResourceManager.Maintenance.Models +namespace Azure.ResourceManager.Maintenance { public partial class MaintenanceConfigurationAssignmentData : IUtf8JsonSerializable { @@ -33,6 +34,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("resourceId"u8); writer.WriteStringValue(ResourceId); } + if (Optional.IsDefined(Filter)) + { + writer.WritePropertyName("filter"u8); + writer.WriteObjectValue(Filter); + } writer.WriteEndObject(); writer.WriteEndObject(); } @@ -50,6 +56,7 @@ internal static MaintenanceConfigurationAssignmentData DeserializeMaintenanceCon Optional systemData = default; Optional maintenanceConfigurationId = default; Optional resourceId = default; + Optional filter = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location"u8)) @@ -112,11 +119,20 @@ internal static MaintenanceConfigurationAssignmentData DeserializeMaintenanceCon resourceId = new ResourceIdentifier(property0.Value.GetString()); continue; } + if (property0.NameEquals("filter"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filter = ConfigurationAssignmentFilterProperties.DeserializeConfigurationAssignmentFilterProperties(property0.Value); + continue; + } } continue; } } - return new MaintenanceConfigurationAssignmentData(id, name, type, systemData.Value, Optional.ToNullable(location), maintenanceConfigurationId.Value, resourceId.Value); + return new MaintenanceConfigurationAssignmentData(id, name, type, systemData.Value, Optional.ToNullable(location), maintenanceConfigurationId.Value, resourceId.Value, filter.Value); } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentListResult.Serialization.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentListResult.Serialization.cs index 00b82a86d183..ac2d1aa31e88 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentListResult.Serialization.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentListResult.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Maintenance; namespace Azure.ResourceManager.Maintenance.Models { diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentListResult.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentListResult.cs index 1bdd58b52ee3..2ae6ec30014c 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentListResult.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationAssignmentListResult.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Maintenance; namespace Azure.ResourceManager.Maintenance.Models { diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationData.Serialization.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationData.Serialization.cs index 6e9c055f7081..9c45649d6f54 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationData.Serialization.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceConfigurationData.Serialization.cs @@ -32,6 +32,7 @@ internal static MaintenanceConfigurationData DeserializeMaintenanceConfiguration Optional> extensionProperties = default; Optional maintenanceScope = default; Optional visibility = default; + Optional installPatches = default; Optional startDateTime = default; Optional expirationDateTime = default; Optional duration = default; @@ -128,6 +129,15 @@ internal static MaintenanceConfigurationData DeserializeMaintenanceConfiguration visibility = new MaintenanceConfigurationVisibility(property0.Value.GetString()); continue; } + if (property0.NameEquals("installPatches"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + installPatches = InputPatchConfiguration.DeserializeInputPatchConfiguration(property0.Value); + continue; + } if (property0.NameEquals("maintenanceWindow"u8)) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -181,7 +191,7 @@ internal static MaintenanceConfigurationData DeserializeMaintenanceConfiguration continue; } } - return new MaintenanceConfigurationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, @namespace.Value, Optional.ToDictionary(extensionProperties), Optional.ToNullable(maintenanceScope), Optional.ToNullable(visibility), Optional.ToNullable(startDateTime), Optional.ToNullable(expirationDateTime), Optional.ToNullable(duration), timeZone.Value, recurEvery.Value); + return new MaintenanceConfigurationData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, @namespace.Value, Optional.ToDictionary(extensionProperties), Optional.ToNullable(maintenanceScope), Optional.ToNullable(visibility), installPatches.Value, Optional.ToNullable(startDateTime), Optional.ToNullable(expirationDateTime), Optional.ToNullable(duration), timeZone.Value, recurEvery.Value); } } } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceScope.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceScope.cs index 49529449a386..46a4d3bae257 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceScope.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/MaintenanceScope.cs @@ -23,6 +23,7 @@ public MaintenanceScope(string value) } private const string HostValue = "Host"; + private const string ResourceValue = "Resource"; private const string OSImageValue = "OSImage"; private const string ExtensionValue = "Extension"; private const string InGuestPatchValue = "InGuestPatch"; @@ -31,6 +32,8 @@ public MaintenanceScope(string value) /// This maintenance scope controls installation of azure platform updates i.e. services on physical nodes hosting customer VMs. public static MaintenanceScope Host { get; } = new MaintenanceScope(HostValue); + /// This maintenance scope controls the default update maintenance of the Azure Resource. + public static MaintenanceScope Resource { get; } = new MaintenanceScope(ResourceValue); /// This maintenance scope controls os image installation on VM/VMSS. public static MaintenanceScope OSImage { get; } = new MaintenanceScope(OSImageValue); /// This maintenance scope controls extension installation on VM/VMSS. diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/RebootOption.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/RebootOption.cs new file mode 100644 index 000000000000..5dc4f6a2c37e --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/RebootOption.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Maintenance.Models +{ + /// Possible reboot preference as defined by the user based on which it would be decided to reboot the machine or not after the patch operation is completed. + public readonly partial struct RebootOption : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RebootOption(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IfRequiredValue = "IfRequired"; + private const string NeverValue = "Never"; + private const string AlwaysValue = "Always"; + + /// IfRequired. + public static RebootOption IfRequired { get; } = new RebootOption(IfRequiredValue); + /// Never. + public static RebootOption Never { get; } = new RebootOption(NeverValue); + /// Always. + public static RebootOption Always { get; } = new RebootOption(AlwaysValue); + /// Determines if two values are the same. + public static bool operator ==(RebootOption left, RebootOption right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RebootOption left, RebootOption right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RebootOption(string value) => new RebootOption(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RebootOption other && Equals(other); + /// + public bool Equals(RebootOption 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/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions.cs deleted file mode 100644 index 38884ddb43c4..000000000000 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions.cs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.ResourceManager.Maintenance.Models -{ - /// The ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions. - public partial class ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions - { - /// Initializes a new instance of ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions. - /// Resource provider name. - /// Resource parent type. - /// Resource parent identifier. - /// Resource type. - /// Resource identifier. - /// Configuration assignment name. - /// The configurationAssignment. - /// , , , , , or is null. - public ResourceGroupResourceCreateOrUpdateConfigurationAssignmentByParentOptions(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data) - { - Argument.AssertNotNull(providerName, nameof(providerName)); - Argument.AssertNotNull(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNull(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNull(resourceType, nameof(resourceType)); - Argument.AssertNotNull(resourceName, nameof(resourceName)); - Argument.AssertNotNull(configurationAssignmentName, nameof(configurationAssignmentName)); - Argument.AssertNotNull(data, nameof(data)); - - ProviderName = providerName; - ResourceParentType = resourceParentType; - ResourceParentName = resourceParentName; - ResourceType = resourceType; - ResourceName = resourceName; - ConfigurationAssignmentName = configurationAssignmentName; - Data = data; - } - - /// Resource provider name. - public string ProviderName { get; } - /// Resource parent type. - public string ResourceParentType { get; } - /// Resource parent identifier. - public string ResourceParentName { get; } - /// Resource type. - public string ResourceType { get; } - /// Resource identifier. - public string ResourceName { get; } - /// Configuration assignment name. - public string ConfigurationAssignmentName { get; } - /// The configurationAssignment. - public MaintenanceConfigurationAssignmentData Data { get; } - } -} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions.cs deleted file mode 100644 index acc06bc4a61b..000000000000 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.ResourceManager.Maintenance.Models -{ - /// The ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions. - public partial class ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions - { - /// Initializes a new instance of ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions. - /// Resource provider name. - /// Resource parent type. - /// Resource parent identifier. - /// Resource type. - /// Resource identifier. - /// Unique configuration assignment name. - /// , , , , or is null. - public ResourceGroupResourceDeleteConfigurationAssignmentByParentOptions(string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName) - { - Argument.AssertNotNull(providerName, nameof(providerName)); - Argument.AssertNotNull(resourceParentType, nameof(resourceParentType)); - Argument.AssertNotNull(resourceParentName, nameof(resourceParentName)); - Argument.AssertNotNull(resourceType, nameof(resourceType)); - Argument.AssertNotNull(resourceName, nameof(resourceName)); - Argument.AssertNotNull(configurationAssignmentName, nameof(configurationAssignmentName)); - - ProviderName = providerName; - ResourceParentType = resourceParentType; - ResourceParentName = resourceParentName; - ResourceType = resourceType; - ResourceName = resourceName; - ConfigurationAssignmentName = configurationAssignmentName; - } - - /// Resource provider name. - public string ProviderName { get; } - /// Resource parent type. - public string ResourceParentType { get; } - /// Resource parent identifier. - public string ResourceParentName { get; } - /// Resource type. - public string ResourceType { get; } - /// Resource identifier. - public string ResourceName { get; } - /// Unique configuration assignment name. - public string ConfigurationAssignmentName { get; } - } -} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagOperator.Serialization.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagOperator.Serialization.cs new file mode 100644 index 000000000000..7055dccc47fc --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagOperator.Serialization.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Maintenance.Models +{ + internal static partial class TagOperatorExtensions + { + public static string ToSerialString(this TagOperator value) => value switch + { + TagOperator.All => "All", + TagOperator.Any => "Any", + _ => throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TagOperator value.") + }; + + public static TagOperator ToTagOperator(this string value) + { + if (StringComparer.OrdinalIgnoreCase.Equals(value, "All")) return TagOperator.All; + if (StringComparer.OrdinalIgnoreCase.Equals(value, "Any")) return TagOperator.Any; + throw new ArgumentOutOfRangeException(nameof(value), value, "Unknown TagOperator value."); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagOperator.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagOperator.cs new file mode 100644 index 000000000000..3f270a35657f --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagOperator.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Maintenance.Models +{ + /// Filter VMs by Any or All specified tags. + public enum TagOperator + { + /// All. + All, + /// Any. + Any + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagSettingsProperties.Serialization.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagSettingsProperties.Serialization.cs new file mode 100644 index 000000000000..b36061ee2a3f --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagSettingsProperties.Serialization.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Maintenance.Models +{ + public partial class TagSettingsProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteStartArray(); + foreach (var item0 in item.Value) + { + writer.WriteStringValue(item0); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(FilterOperator)) + { + writer.WritePropertyName("filterOperator"u8); + writer.WriteStringValue(FilterOperator.Value.ToSerialString()); + } + writer.WriteEndObject(); + } + + internal static TagSettingsProperties DeserializeTagSettingsProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional>> tags = default; + Optional filterOperator = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary> dictionary = new Dictionary>(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + dictionary.Add(property0.Name, array); + } + } + tags = dictionary; + continue; + } + if (property.NameEquals("filterOperator"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + filterOperator = property.Value.GetString().ToTagOperator(); + continue; + } + } + return new TagSettingsProperties(Optional.ToDictionary(tags), Optional.ToNullable(filterOperator)); + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagSettingsProperties.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagSettingsProperties.cs new file mode 100644 index 000000000000..dd358fd631ef --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/Models/TagSettingsProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Maintenance.Models +{ + /// Tag filter information for the VM. + public partial class TagSettingsProperties + { + /// Initializes a new instance of TagSettingsProperties. + public TagSettingsProperties() + { + Tags = new ChangeTrackingDictionary>(); + } + + /// Initializes a new instance of TagSettingsProperties. + /// Dictionary of tags with its list of values. + /// Filter VMs by Any or All specified tags. + internal TagSettingsProperties(IDictionary> tags, TagOperator? filterOperator) + { + Tags = tags; + FilterOperator = filterOperator; + } + + /// Dictionary of tags with its list of values. + public IDictionary> Tags { get; } + /// Filter VMs by Any or All specified tags. + public TagOperator? FilterOperator { get; set; } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdateForResourceGroupRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdateForResourceGroupRestOperations.cs index e16656feb69d..25c415cfde78 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdateForResourceGroupRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdateForResourceGroupRestOperations.cs @@ -33,7 +33,7 @@ public ApplyUpdateForResourceGroupRestOperations(HttpPipeline pipeline, string a { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-05-01"; + _apiVersion = apiVersion ?? "2023-04-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdatesRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdatesRestOperations.cs index 9ab5caf317e1..ac6362773a27 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdatesRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ApplyUpdatesRestOperations.cs @@ -33,7 +33,7 @@ public ApplyUpdatesRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-05-01"; + _apiVersion = apiVersion ?? "2023-04-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -300,6 +300,7 @@ public async Task> CreateOrUpdateParentAsyn switch (message.Response.Status) { case 200: + case 201: { MaintenanceApplyUpdateData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); @@ -337,6 +338,7 @@ public Response CreateOrUpdateParent(string subscrip switch (message.Response.Status) { case 200: + case 201: { MaintenanceApplyUpdateData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); @@ -395,6 +397,7 @@ public async Task> CreateOrUpdateAsync(stri switch (message.Response.Status) { case 200: + case 201: { MaintenanceApplyUpdateData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); @@ -428,6 +431,7 @@ public Response CreateOrUpdate(string subscriptionId switch (message.Response.Status) { case 200: + case 201: { MaintenanceApplyUpdateData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForResourceGroupRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForResourceGroupRestOperations.cs new file mode 100644 index 000000000000..a0979a225bac --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForResourceGroupRestOperations.cs @@ -0,0 +1,377 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Maintenance +{ + internal partial class ConfigurationAssignmentsForResourceGroupRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConfigurationAssignmentsForResourceGroupRestOperations. + /// 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 ConfigurationAssignmentsForResourceGroupRestOperations(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 ?? "2023-04-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string configurationAssignmentName) + { + 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.Maintenance/configurationAssignments/", false); + uri.AppendPath(configurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get configuration assignment for resource.. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Configuration assignment name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, configurationAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get configuration assignment for resource.. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Configuration assignment name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, configurationAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Maintenance/configurationAssignments/", false); + uri.AppendPath(configurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Register configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string resourceGroupName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, configurationAssignmentName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Register configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string resourceGroupName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, configurationAssignmentName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Maintenance/configurationAssignments/", false); + uri.AppendPath(configurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Register configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, configurationAssignmentName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Register configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, configurationAssignmentName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string configurationAssignmentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourcegroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Maintenance/configurationAssignments/", false); + uri.AppendPath(configurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Unregister configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Unique configuration assignment name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> DeleteAsync(string subscriptionId, string resourceGroupName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, configurationAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 204: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Unregister configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Unique configuration assignment name. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, configurationAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 204: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForSubscriptionsRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForSubscriptionsRestOperations.cs new file mode 100644 index 000000000000..bb7013086a17 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsForSubscriptionsRestOperations.cs @@ -0,0 +1,353 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Maintenance +{ + internal partial class ConfigurationAssignmentsForSubscriptionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConfigurationAssignmentsForSubscriptionsRestOperations. + /// 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 ConfigurationAssignmentsForSubscriptionsRestOperations(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 ?? "2023-04-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string configurationAssignmentName) + { + 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.Maintenance/configurationAssignments/", false); + uri.AppendPath(configurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get configuration assignment for resource.. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Configuration assignment name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateGetRequest(subscriptionId, configurationAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get configuration assignment for resource.. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Configuration assignment name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateGetRequest(subscriptionId, configurationAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Maintenance/configurationAssignments/", false); + uri.AppendPath(configurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Register configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> CreateOrUpdateAsync(string subscriptionId, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, configurationAssignmentName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Register configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, configurationAssignmentName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Maintenance/configurationAssignments/", false); + uri.AppendPath(configurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Register configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, configurationAssignmentName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Register configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Configuration assignment name. + /// The configurationAssignment. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, configurationAssignmentName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string configurationAssignmentName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Maintenance/configurationAssignments/", false); + uri.AppendPath(configurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Unregister configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Unique configuration assignment name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> DeleteAsync(string subscriptionId, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateDeleteRequest(subscriptionId, configurationAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 204: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Unregister configuration for resource. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Unique configuration assignment name. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateDeleteRequest(subscriptionId, configurationAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 204: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsRestOperations.cs index ec2925bf8edb..b95263345b88 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsRestOperations.cs @@ -33,10 +33,122 @@ public ConfigurationAssignmentsRestOperations(HttpPipeline pipeline, string appl { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-05-01"; + _apiVersion = apiVersion ?? "2023-04-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } + internal HttpMessage CreateGetParentRequest(string subscriptionId, string resourceGroupName, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName) + { + 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/", false); + uri.AppendPath(providerName, true); + uri.AppendPath("/", false); + uri.AppendPath(resourceParentType, true); + uri.AppendPath("/", false); + uri.AppendPath(resourceParentName, true); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, true); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.Maintenance/configurationAssignments/", false); + uri.AppendPath(configurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get configuration assignment for resource.. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The cancellation token to use. + /// , , , , , , or is null. + /// , , , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetParentAsync(string subscriptionId, string resourceGroupName, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateGetParentRequest(subscriptionId, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get configuration assignment for resource.. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Resource provider name. + /// Resource parent type. + /// Resource parent identifier. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The cancellation token to use. + /// , , , , , , or is null. + /// , , , , , , or is an empty string, and was expected to be non-empty. + public Response GetParent(string subscriptionId, string resourceGroupName, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceParentType, nameof(resourceParentType)); + Argument.AssertNotNullOrEmpty(resourceParentName, nameof(resourceParentName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateGetParentRequest(subscriptionId, resourceGroupName, providerName, resourceParentType, resourceParentName, resourceType, resourceName, configurationAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateCreateOrUpdateParentRequest(string subscriptionId, string resourceGroupName, string providerName, string resourceParentType, string resourceParentName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data) { var message = _pipeline.CreateMessage(); @@ -101,6 +213,7 @@ public async Task> CreateOrUpda switch (message.Response.Status) { case 200: + case 201: { MaintenanceConfigurationAssignmentData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); @@ -142,6 +255,7 @@ public Response CreateOrUpdateParent(str switch (message.Response.Status) { case 200: + case 201: { MaintenanceConfigurationAssignmentData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); @@ -265,6 +379,106 @@ public Response DeleteParent(string subs } } + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string providerName, string resourceType, string resourceName, string configurationAssignmentName) + { + 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/", false); + uri.AppendPath(providerName, true); + uri.AppendPath("/", false); + uri.AppendPath(resourceType, true); + uri.AppendPath("/", false); + uri.AppendPath(resourceName, true); + uri.AppendPath("/providers/Microsoft.Maintenance/configurationAssignments/", false); + uri.AppendPath(configurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get configuration assignment for resource.. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get configuration assignment for resource.. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// Resource group name. + /// Resource provider name. + /// Resource type. + /// Resource identifier. + /// Configuration assignment name. + /// The cancellation token to use. + /// , , , , or is null. + /// , , , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string providerName, string resourceType, string resourceName, string configurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(providerName, nameof(providerName)); + Argument.AssertNotNullOrEmpty(resourceType, nameof(resourceType)); + Argument.AssertNotNullOrEmpty(resourceName, nameof(resourceName)); + Argument.AssertNotNullOrEmpty(configurationAssignmentName, nameof(configurationAssignmentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, providerName, resourceType, resourceName, configurationAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentData.DeserializeMaintenanceConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((MaintenanceConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string providerName, string resourceType, string resourceName, string configurationAssignmentName, MaintenanceConfigurationAssignmentData data) { var message = _pipeline.CreateMessage(); @@ -321,6 +535,7 @@ public async Task> CreateOrUpda switch (message.Response.Status) { case 200: + case 201: { MaintenanceConfigurationAssignmentData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); @@ -358,6 +573,7 @@ public Response CreateOrUpdate(string su switch (message.Response.Status) { case 200: + case 201: { MaintenanceConfigurationAssignmentData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsWithinSubscriptionRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsWithinSubscriptionRestOperations.cs new file mode 100644 index 000000000000..d123705c78c5 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/ConfigurationAssignmentsWithinSubscriptionRestOperations.cs @@ -0,0 +1,107 @@ +// 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.Maintenance.Models; + +namespace Azure.ResourceManager.Maintenance +{ + internal partial class ConfigurationAssignmentsWithinSubscriptionRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConfigurationAssignmentsWithinSubscriptionRestOperations. + /// 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 ConfigurationAssignmentsWithinSubscriptionRestOperations(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 ?? "2023-04-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Maintenance/configurationAssignments", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get configuration assignment within a subscription. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = MaintenanceConfigurationAssignmentListResult.DeserializeMaintenanceConfigurationAssignmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get configuration assignment within a subscription. + /// Subscription credentials that uniquely identify a Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + MaintenanceConfigurationAssignmentListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = MaintenanceConfigurationAssignmentListResult.DeserializeMaintenanceConfigurationAssignmentListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsForResourceGroupRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsForResourceGroupRestOperations.cs index 18dd017544a3..4887dfcdef8c 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsForResourceGroupRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsForResourceGroupRestOperations.cs @@ -33,7 +33,7 @@ public MaintenanceConfigurationsForResourceGroupRestOperations(HttpPipeline pipe { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-05-01"; + _apiVersion = apiVersion ?? "2023-04-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs index 1fd1c4639033..339001128ef0 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/MaintenanceConfigurationsRestOperations.cs @@ -33,7 +33,7 @@ public MaintenanceConfigurationsRestOperations(HttpPipeline pipeline, string app { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-05-01"; + _apiVersion = apiVersion ?? "2023-04-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -163,6 +163,7 @@ public async Task> CreateOrUpdateAsync(st switch (message.Response.Status) { case 200: + case 201: { MaintenanceConfigurationData value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); @@ -194,6 +195,7 @@ public Response CreateOrUpdate(string subscription switch (message.Response.Status) { case 200: + case 201: { MaintenanceConfigurationData value = default; using var document = JsonDocument.Parse(message.Response.ContentStream); diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/PublicMaintenanceConfigurationsRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/PublicMaintenanceConfigurationsRestOperations.cs index 05ae61b4c0c3..10f5a31635c9 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/PublicMaintenanceConfigurationsRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/PublicMaintenanceConfigurationsRestOperations.cs @@ -33,7 +33,7 @@ public PublicMaintenanceConfigurationsRestOperations(HttpPipeline pipeline, stri { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-05-01"; + _apiVersion = apiVersion ?? "2023-04-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/UpdatesRestOperations.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/UpdatesRestOperations.cs index 6b478cfe4c9d..32b3023d9096 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/UpdatesRestOperations.cs +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/Generated/RestOperations/UpdatesRestOperations.cs @@ -33,7 +33,7 @@ public UpdatesRestOperations(HttpPipeline pipeline, string applicationId, Uri en { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2021-05-01"; + _apiVersion = apiVersion ?? "2023-04-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/autorest.md b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/autorest.md index 822f9c2235ef..572892ac4a5a 100644 --- a/sdk/maintenance/Azure.ResourceManager.Maintenance/src/autorest.md +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/src/autorest.md @@ -9,8 +9,7 @@ csharp: true library-name: Maintenance namespace: Azure.ResourceManager.Maintenance # default tag is a preview version -require: https://github.com/Azure/azure-rest-api-specs/blob/7d5d1db0c45d6fe0934c97b6a6f9bb34112d42d1/specification/maintenance/resource-manager/readme.md -tag: package-2021-05 +require: https://github.com/Azure/azure-rest-api-specs/blob/3731ac6150dcb22856183e9f1ca49eb912459f83/specification/maintenance/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true @@ -28,7 +27,7 @@ rename-mapping: ApplyUpdate: MaintenanceApplyUpdate Update: MaintenanceUpdate ImpactType: MaintenanceImpactType - ConfigurationAssignment: MaintenanceConfigurationAssignmentData + ConfigurationAssignment: MaintenanceConfigurationAssignment ApplyUpdate.properties.resourceId: -|arm-id ConfigurationAssignment.properties.resourceId: -|arm-id Update.properties.resourceId: -|arm-id @@ -58,9 +57,14 @@ request-path-is-non-resource: request-path-to-resource-name: /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/publicMaintenanceConfigurations/{resourceName}: MaintenancePublicConfiguration /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName}: MaintenanceApplyUpdate + /subscriptions/{subscriptionId}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}: MaintenanceSubscriptionConfigurationAssignment + /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}: MaintenanceResourceGroupConfigurationAssignment + /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}: MaintenanceConfigurationAssignment + /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceParentType}/{resourceParentName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName}: MaintenanceConfigurationAssignment list-exception: - /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{providerName}/{resourceType}/{resourceName}/providers/Microsoft.Maintenance/applyUpdates/{applyUpdateName} + - /subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Maintenance/configurationAssignments/{configurationAssignmentName} rename-rules: CPU: Cpu diff --git a/sdk/maintenance/Azure.ResourceManager.Maintenance/tests/Scenario/MaintenancePublicConfigurationTests.cs b/sdk/maintenance/Azure.ResourceManager.Maintenance/tests/Scenario/MaintenancePublicConfigurationTests.cs new file mode 100644 index 000000000000..452ac2fe9c22 --- /dev/null +++ b/sdk/maintenance/Azure.ResourceManager.Maintenance/tests/Scenario/MaintenancePublicConfigurationTests.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Maintenance.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Maintenance.Tests +{ + public sealed class MaintenancePublicConfigurationTests : MaintenanceManagementTestBase + { + public MaintenancePublicConfigurationTests(bool isAsync) : base(isAsync) //, RecordedTestMode.Record) + { } + + [RecordedTest] + public async Task MaintenancePublicConfigurationGetForResourceTest() + { + //string assetName = "maintenance-config-"; + string subscriptionId = "eee2cef4-bc47-4278-b4f8-cfc65f25dfd8"; + string resourceName = "aks-mrp-cfg-weekday_utc-7-eastus2euap"; + ResourceIdentifier maintenanceConfigurationResourceId = MaintenancePublicConfigurationResource.CreateResourceIdentifier(subscriptionId, resourceName); + MaintenancePublicConfigurationResource maintenancePublicConfiguration = Client.GetMaintenancePublicConfigurationResource(maintenanceConfigurationResourceId); + + MaintenancePublicConfigurationResource result = await maintenancePublicConfiguration.GetAsync(); + + MaintenanceConfigurationData resourceData = result.Data; + + Assert.IsNotNull(resourceData); + Assert.IsTrue(resourceData.MaintenanceScope.Equals(MaintenanceScope.Resource)); + } + } +}