diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/CHANGELOG.md b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/CHANGELOG.md index 93fd455b2ad6e..3d0c0f96a9d9b 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/CHANGELOG.md +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/CHANGELOG.md @@ -1,22 +1,24 @@ # Release History -## 1.2.0-beta.1 (Unreleased) +## 1.2.0 (2024-07-19) ### Features Added -- Enable the new model serialization by using the System.ClientModel, refer this [document](https://aka.ms/azsdk/net/mrw) for more details. - -### Breaking Changes - -### Bugs Fixed +- Upgraded api-version tag from 'package-2022-01-25' to 'package-2024-04-05'. Tag detail available at https://github.com/Azure/azure-rest-api-specs/blob/6dd7b1f0b4e62d1c2d78e1fa6ab3addd032d9920/specification/guestconfiguration/resource-manager/readme.md. +- Enabled the new model serialization by using the System.ClientModel, refer this [document](https://aka.ms/azsdk/net/mrw) for more details. +- Added experimental Bicep serialization. +- Added `ArmOperation.Rehydrate` and `ArmOperation.Rehydrate` static methods to rehydrate a long-running operation. ### Other Changes +- Upgraded Azure.Core from 1.36.0 to 1.41.0 +- Upgraded Azure.ResourceManager from 1.9.0 to 1.12.0 + ## 1.1.0 (2023-11-29) ### Features Added -- Enable mocking for extension methods, refer this [document](https://aka.ms/azsdk/net/mocking) for more details. +- Enabled mocking for extension methods, refer this [document](https://aka.ms/azsdk/net/mocking) for more details. ### Other Changes @@ -26,7 +28,7 @@ ### Features Added -- Enable the model factory feature for model mocking, more information can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-mocking-factory-builder). +- Enabled the model factory feature for model mocking, more information can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-mocking-factory-builder). ### Other Changes diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/api/Azure.ResourceManager.GuestConfiguration.netstandard2.0.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/api/Azure.ResourceManager.GuestConfiguration.netstandard2.0.cs index 37d4b803e5ce6..07beaa7b0281e 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/api/Azure.ResourceManager.GuestConfiguration.netstandard2.0.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/api/Azure.ResourceManager.GuestConfiguration.netstandard2.0.cs @@ -28,6 +28,10 @@ public static partial class GuestConfigurationExtensions public static System.Threading.Tasks.Task> GetGuestConfigurationVmssAssignmentAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public static Azure.ResourceManager.GuestConfiguration.GuestConfigurationVmssAssignmentResource GetGuestConfigurationVmssAssignmentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } public static Azure.ResourceManager.GuestConfiguration.GuestConfigurationVmssAssignmentCollection GetGuestConfigurationVmssAssignments(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } + public static Azure.Response GetGuestConfigurationVMwarevSphereAssignment(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetGuestConfigurationVMwarevSphereAssignmentAsync(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope, string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.GuestConfiguration.GuestConfigurationVMwarevSphereAssignmentResource GetGuestConfigurationVMwarevSphereAssignmentResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.GuestConfiguration.GuestConfigurationVMwarevSphereAssignmentCollection GetGuestConfigurationVMwarevSphereAssignments(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier scope) { throw null; } } public partial class GuestConfigurationHcrpAssignmentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { @@ -112,6 +116,8 @@ protected GuestConfigurationVmAssignmentResource() { } public partial class GuestConfigurationVmssAssignmentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable { protected GuestConfigurationVmssAssignmentCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string name, Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Exists(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> ExistsAsync(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -144,6 +150,48 @@ protected GuestConfigurationVmssAssignmentResource() { } Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class GuestConfigurationVMwarevSphereAssignmentCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected GuestConfigurationVMwarevSphereAssignmentCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string guestConfigurationAssignmentName, Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string guestConfigurationAssignmentName, Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string guestConfigurationAssignmentName, 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 guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string guestConfigurationAssignmentName, 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 GuestConfigurationVMwarevSphereAssignmentResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected GuestConfigurationVMwarevSphereAssignmentResource() { } + public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName) { 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 GetGuestConfigurationConnectedVMwarevSphereAssignmentsReport(string reportId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGuestConfigurationConnectedVMwarevSphereAssignmentsReportAsync(string reportId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetGuestConfigurationConnectedVMwarevSphereAssignmentsReports(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetGuestConfigurationConnectedVMwarevSphereAssignmentsReportsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.GuestConfiguration.GuestConfigurationAssignmentData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } } namespace Azure.ResourceManager.GuestConfiguration.Mocking @@ -163,6 +211,10 @@ protected MockableGuestConfigurationArmClient() { } public virtual System.Threading.Tasks.Task> GetGuestConfigurationVmssAssignmentAsync(Azure.Core.ResourceIdentifier scope, string name, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationVmssAssignmentResource GetGuestConfigurationVmssAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationVmssAssignmentCollection GetGuestConfigurationVmssAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } + public virtual Azure.Response GetGuestConfigurationVMwarevSphereAssignment(Azure.Core.ResourceIdentifier scope, string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetGuestConfigurationVMwarevSphereAssignmentAsync(Azure.Core.ResourceIdentifier scope, string guestConfigurationAssignmentName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationVMwarevSphereAssignmentResource GetGuestConfigurationVMwarevSphereAssignmentResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.GuestConfiguration.GuestConfigurationVMwarevSphereAssignmentCollection GetGuestConfigurationVMwarevSphereAssignments(Azure.Core.ResourceIdentifier scope) { throw null; } } public partial class MockableGuestConfigurationResourceGroupResource : Azure.ResourceManager.ArmResource { @@ -209,7 +261,9 @@ public static partial class ArmGuestConfigurationModelFactory public static Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentReportInfo GuestConfigurationAssignmentReportInfo(Azure.Core.ResourceIdentifier id = null, System.Guid? reportId = default(System.Guid?), Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentInfo assignment = null, Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationVmInfo vm = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), Azure.ResourceManager.GuestConfiguration.Models.AssignedGuestConfigurationMachineComplianceStatus? complianceStatus = default(Azure.ResourceManager.GuestConfiguration.Models.AssignedGuestConfigurationMachineComplianceStatus?), Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentReportType? operationType = default(Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentReportType?), System.Collections.Generic.IEnumerable resources = null) { throw null; } public static Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentReportProperties GuestConfigurationAssignmentReportProperties(Azure.ResourceManager.GuestConfiguration.Models.AssignedGuestConfigurationMachineComplianceStatus? complianceStatus = default(Azure.ResourceManager.GuestConfiguration.Models.AssignedGuestConfigurationMachineComplianceStatus?), System.Guid? reportId = default(System.Guid?), Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentInfo assignment = null, Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationVmInfo vm = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentReportDetails details = null, string vmssResourceId = null) { throw null; } public static Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationInfo GuestConfigurationInfo(string name = null, string version = null) { throw null; } - public static Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationNavigation GuestConfigurationNavigation(Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationKind? kind = default(Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationKind?), string name = null, string version = null, System.Uri contentUri = null, string contentHash = null, Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentType? assignmentType = default(Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentType?), string assignmentSource = null, string contentType = null, System.Collections.Generic.IEnumerable configurationParameters = null, System.Collections.Generic.IEnumerable configurationProtectedParameters = null, Azure.ResourceManager.GuestConfiguration.Models.LcmConfigurationSetting configurationSetting = null) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public static Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationNavigation GuestConfigurationNavigation(Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationKind? kind, string name, string version, System.Uri contentUri, string contentHash, Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentType? assignmentType, string assignmentSource, string contentType, System.Collections.Generic.IEnumerable configurationParameters, System.Collections.Generic.IEnumerable configurationProtectedParameters, Azure.ResourceManager.GuestConfiguration.Models.LcmConfigurationSetting configurationSetting) { throw null; } + public static Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationNavigation GuestConfigurationNavigation(Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationKind? kind = default(Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationKind?), string name = null, string version = null, System.Uri contentUri = null, string contentHash = null, string contentManagedIdentity = null, Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentType? assignmentType = default(Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationAssignmentType?), string assignmentSource = null, string contentType = null, System.Collections.Generic.IEnumerable configurationParameters = null, System.Collections.Generic.IEnumerable configurationProtectedParameters = null, Azure.ResourceManager.GuestConfiguration.Models.LcmConfigurationSetting configurationSetting = null) { throw null; } public static Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationResourceData GuestConfigurationResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.AzureLocation? location = default(Azure.Core.AzureLocation?), Azure.Core.ResourceType? resourceType = default(Azure.Core.ResourceType?), Azure.ResourceManager.Models.SystemData systemData = null) { throw null; } public static Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationVmInfo GuestConfigurationVmInfo(Azure.Core.ResourceIdentifier id = null, System.Guid? uuid = default(System.Guid?)) { throw null; } public static Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationVmssVmInfo GuestConfigurationVmssVmInfo(System.Guid? vmId = default(System.Guid?), Azure.Core.ResourceIdentifier vmResourceId = null, Azure.ResourceManager.GuestConfiguration.Models.AssignedGuestConfigurationMachineComplianceStatus? complianceStatus = default(Azure.ResourceManager.GuestConfiguration.Models.AssignedGuestConfigurationMachineComplianceStatus?), System.Guid? latestReportId = default(System.Guid?), System.DateTimeOffset? lastComplianceCheckedOn = default(System.DateTimeOffset?)) { throw null; } @@ -427,6 +481,7 @@ public GuestConfigurationNavigation() { } public System.Collections.Generic.IList ConfigurationProtectedParameters { get { throw null; } } public Azure.ResourceManager.GuestConfiguration.Models.LcmConfigurationSetting ConfigurationSetting { get { throw null; } } public string ContentHash { get { throw null; } set { } } + public string ContentManagedIdentity { get { throw null; } set { } } public string ContentType { get { throw null; } } public System.Uri ContentUri { get { throw null; } set { } } public Azure.ResourceManager.GuestConfiguration.Models.GuestConfigurationKind? Kind { get { throw null; } set { } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentCollection.cs index bb96c6d8d0ae2..e10a80f41ee65 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_GuestConfigurationHcrpAssignmentCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationHCRPAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/createOrUpdateGuestConfigurationHCRPAssignment.json // this example is just showing the usage of "GuestConfigurationHCRPAssignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -47,7 +47,7 @@ public async Task CreateOrUpdate_CreateOrUpdateGuestConfigurationAssignment() GuestConfiguration = new GuestConfigurationNavigation() { Name = "NotInstalledApplicationForWindows", - Version = "1.*", + Version = "1.0.0.3", ContentUri = new Uri("https://thisisfake/pacakge"), ContentHash = "123contenthash", AssignmentType = GuestConfigurationAssignmentType.ApplyAndAutoCorrect, @@ -80,7 +80,7 @@ public async Task CreateOrUpdate_CreateOrUpdateGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationHCRPAssignment.json // this example is just showing the usage of "GuestConfigurationHCRPAssignments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -114,7 +114,7 @@ public async Task Get_GetAGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationHCRPAssignment.json // this example is just showing the usage of "GuestConfigurationHCRPAssignments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -144,7 +144,7 @@ public async Task Exists_GetAGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationHCRPAssignment.json // this example is just showing the usage of "GuestConfigurationHCRPAssignments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -186,7 +186,7 @@ public async Task GetIfExists_GetAGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAllGuestConfigurationAssignmentsForAVirtualMachine() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationHCRPAssignments.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/listGuestConfigurationHCRPAssignments.json // this example is just showing the usage of "GuestConfigurationHCRPAssignments_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentResource.cs index 3b7f30a5ec6da..f4ec42b25ea90 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentResource.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationHcrpAssignmentResource.cs @@ -20,7 +20,7 @@ public partial class Sample_GuestConfigurationHcrpAssignmentResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateOrUpdateGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationHCRPAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/createOrUpdateGuestConfigurationHCRPAssignment.json // this example is just showing the usage of "GuestConfigurationHCRPAssignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -45,7 +45,7 @@ public async Task Update_CreateOrUpdateGuestConfigurationAssignment() GuestConfiguration = new GuestConfigurationNavigation() { Name = "NotInstalledApplicationForWindows", - Version = "1.*", + Version = "1.0.0.3", ContentUri = new Uri("https://thisisfake/pacakge"), ContentHash = "123contenthash", AssignmentType = GuestConfigurationAssignmentType.ApplyAndAutoCorrect, @@ -78,7 +78,7 @@ public async Task Update_CreateOrUpdateGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationHCRPAssignment.json // this example is just showing the usage of "GuestConfigurationHCRPAssignments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -110,7 +110,7 @@ public async Task Get_GetAGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAnGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationHCRPAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/deleteGuestConfigurationHCRPAssignment.json // this example is just showing the usage of "GuestConfigurationHCRPAssignments_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -138,7 +138,7 @@ public async Task Delete_DeleteAnGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReports_ListAllGuestConfigurationAssignmentsForAVirtualMachine() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationHCRPAssignmentReports.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/listAllGuestConfigurationHCRPAssignmentReports.json // this example is just showing the usage of "GuestConfigurationHCRPAssignmentReports_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -169,7 +169,7 @@ public async Task GetReports_ListAllGuestConfigurationAssignmentsForAVirtualMach [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReport_GetAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationHCRPAssignmentReportById.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationHCRPAssignmentReportById.json // this example is just showing the usage of "GuestConfigurationHCRPAssignmentReports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVMwarevSphereAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVMwarevSphereAssignmentCollection.cs new file mode 100644 index 0000000000000..830d74f4085b6 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVMwarevSphereAssignmentCollection.cs @@ -0,0 +1,220 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.GuestConfiguration.Models; + +namespace Azure.ResourceManager.GuestConfiguration.Samples +{ + public partial class Sample_GuestConfigurationVMwarevSphereAssignmentCollection + { + // Create or update guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/createOrUpdateGuestConfigurationConnectedVMwarevSphereAssignment.json + // this example is just showing the usage of "GuestConfigurationConnectedVMwarevSphereAssignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GuestConfigurationVMwarevSphereAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{2}", subscriptionId, resourceGroupName, vmName)); + GuestConfigurationVMwarevSphereAssignmentCollection collection = client.GetGuestConfigurationVMwarevSphereAssignments(scopeId); + + // invoke the operation + string guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + GuestConfigurationAssignmentData data = new GuestConfigurationAssignmentData() + { + Properties = new GuestConfigurationAssignmentProperties() + { + GuestConfiguration = new GuestConfigurationNavigation() + { + Name = "NotInstalledApplicationForWindows", + Version = "1.0.0.0", + ContentUri = new Uri("https://thisisfake/pacakge"), + ContentHash = "123contenthash", + AssignmentType = GuestConfigurationAssignmentType.ApplyAndAutoCorrect, + ConfigurationParameters = +{ +new GuestConfigurationParameter() +{ +Name = "[InstalledApplication]NotInstalledApplicationResource1;Name", +Value = "NotePad,sql", +} +}, + }, + Context = "Azure policy", + }, + Name = "NotInstalledApplicationForWindows", + Location = new AzureLocation("westcentralus"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, guestConfigurationAssignmentName, data); + GuestConfigurationVMwarevSphereAssignmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuestConfigurationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationConnectedVMwarevSphereAssignment.json + // this example is just showing the usage of "GuestConfigurationConnectedVMwarevSphereAssignments_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GuestConfigurationVMwarevSphereAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{2}", subscriptionId, resourceGroupName, vmName)); + GuestConfigurationVMwarevSphereAssignmentCollection collection = client.GetGuestConfigurationVMwarevSphereAssignments(scopeId); + + // invoke the operation + string guestConfigurationAssignmentName = "SecureProtocol"; + GuestConfigurationVMwarevSphereAssignmentResource result = await collection.GetAsync(guestConfigurationAssignmentName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuestConfigurationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GetAGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationConnectedVMwarevSphereAssignment.json + // this example is just showing the usage of "GuestConfigurationConnectedVMwarevSphereAssignments_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GuestConfigurationVMwarevSphereAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{2}", subscriptionId, resourceGroupName, vmName)); + GuestConfigurationVMwarevSphereAssignmentCollection collection = client.GetGuestConfigurationVMwarevSphereAssignments(scopeId); + + // invoke the operation + string guestConfigurationAssignmentName = "SecureProtocol"; + bool result = await collection.ExistsAsync(guestConfigurationAssignmentName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Get a guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_GetAGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationConnectedVMwarevSphereAssignment.json + // this example is just showing the usage of "GuestConfigurationConnectedVMwarevSphereAssignments_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GuestConfigurationVMwarevSphereAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{2}", subscriptionId, resourceGroupName, vmName)); + GuestConfigurationVMwarevSphereAssignmentCollection collection = client.GetGuestConfigurationVMwarevSphereAssignments(scopeId); + + // invoke the operation + string guestConfigurationAssignmentName = "SecureProtocol"; + NullableResponse response = await collection.GetIfExistsAsync(guestConfigurationAssignmentName); + GuestConfigurationVMwarevSphereAssignmentResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuestConfigurationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // List all guest configuration assignments for a virtual machine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ListAllGuestConfigurationAssignmentsForAVirtualMachine() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/listGuestConfigurationConnectedVMwarevSphereAssignments.json + // this example is just showing the usage of "GuestConfigurationConnectedVMwarevSphereAssignments_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GuestConfigurationVMwarevSphereAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{2}", subscriptionId, resourceGroupName, vmName)); + GuestConfigurationVMwarevSphereAssignmentCollection collection = client.GetGuestConfigurationVMwarevSphereAssignments(scopeId); + + // invoke the operation and iterate over the result + await foreach (GuestConfigurationVMwarevSphereAssignmentResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuestConfigurationAssignmentData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVMwarevSphereAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVMwarevSphereAssignmentResource.cs new file mode 100644 index 0000000000000..377a18600a0ad --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVMwarevSphereAssignmentResource.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.GuestConfiguration.Models; + +namespace Azure.ResourceManager.GuestConfiguration.Samples +{ + public partial class Sample_GuestConfigurationVMwarevSphereAssignmentResource + { + // Create or update guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/createOrUpdateGuestConfigurationConnectedVMwarevSphereAssignment.json + // this example is just showing the usage of "GuestConfigurationConnectedVMwarevSphereAssignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GuestConfigurationVMwarevSphereAssignmentResource created on azure + // for more information of creating GuestConfigurationVMwarevSphereAssignmentResource, please refer to the document of GuestConfigurationVMwarevSphereAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + string guestConfigurationAssignmentName = "NotInstalledApplicationForWindows"; + ResourceIdentifier guestConfigurationVMwarevSphereAssignmentResourceId = GuestConfigurationVMwarevSphereAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + GuestConfigurationVMwarevSphereAssignmentResource guestConfigurationVMwarevSphereAssignment = client.GetGuestConfigurationVMwarevSphereAssignmentResource(guestConfigurationVMwarevSphereAssignmentResourceId); + + // invoke the operation + GuestConfigurationAssignmentData data = new GuestConfigurationAssignmentData() + { + Properties = new GuestConfigurationAssignmentProperties() + { + GuestConfiguration = new GuestConfigurationNavigation() + { + Name = "NotInstalledApplicationForWindows", + Version = "1.0.0.0", + ContentUri = new Uri("https://thisisfake/pacakge"), + ContentHash = "123contenthash", + AssignmentType = GuestConfigurationAssignmentType.ApplyAndAutoCorrect, + ConfigurationParameters = +{ +new GuestConfigurationParameter() +{ +Name = "[InstalledApplication]NotInstalledApplicationResource1;Name", +Value = "NotePad,sql", +} +}, + }, + Context = "Azure policy", + }, + Name = "NotInstalledApplicationForWindows", + Location = new AzureLocation("westcentralus"), + }; + ArmOperation lro = await guestConfigurationVMwarevSphereAssignment.UpdateAsync(WaitUntil.Completed, data); + GuestConfigurationVMwarevSphereAssignmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuestConfigurationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Get a guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GetAGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationConnectedVMwarevSphereAssignment.json + // this example is just showing the usage of "GuestConfigurationConnectedVMwarevSphereAssignments_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GuestConfigurationVMwarevSphereAssignmentResource created on azure + // for more information of creating GuestConfigurationVMwarevSphereAssignmentResource, please refer to the document of GuestConfigurationVMwarevSphereAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + string guestConfigurationAssignmentName = "SecureProtocol"; + ResourceIdentifier guestConfigurationVMwarevSphereAssignmentResourceId = GuestConfigurationVMwarevSphereAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + GuestConfigurationVMwarevSphereAssignmentResource guestConfigurationVMwarevSphereAssignment = client.GetGuestConfigurationVMwarevSphereAssignmentResource(guestConfigurationVMwarevSphereAssignmentResourceId); + + // invoke the operation + GuestConfigurationVMwarevSphereAssignmentResource result = await guestConfigurationVMwarevSphereAssignment.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuestConfigurationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Delete an guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_DeleteAnGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/deleteGuestConfigurationConnectedVMwarevSphereAssignment.json + // this example is just showing the usage of "GuestConfigurationConnectedVMwarevSphereAssignments_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GuestConfigurationVMwarevSphereAssignmentResource created on azure + // for more information of creating GuestConfigurationVMwarevSphereAssignmentResource, please refer to the document of GuestConfigurationVMwarevSphereAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + string guestConfigurationAssignmentName = "SecureProtocol"; + ResourceIdentifier guestConfigurationVMwarevSphereAssignmentResourceId = GuestConfigurationVMwarevSphereAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + GuestConfigurationVMwarevSphereAssignmentResource guestConfigurationVMwarevSphereAssignment = client.GetGuestConfigurationVMwarevSphereAssignmentResource(guestConfigurationVMwarevSphereAssignmentResourceId); + + // invoke the operation + await guestConfigurationVMwarevSphereAssignment.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // List all guest configuration assignments for a virtual machine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetGuestConfigurationConnectedVMwarevSphereAssignmentsReports_ListAllGuestConfigurationAssignmentsForAVirtualMachine() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/listAllGuestConfigurationConnectedVMwarevSphereAssignmentsReports.json + // this example is just showing the usage of "GuestConfigurationConnectedVMwarevSphereAssignmentsReports_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GuestConfigurationVMwarevSphereAssignmentResource created on azure + // for more information of creating GuestConfigurationVMwarevSphereAssignmentResource, please refer to the document of GuestConfigurationVMwarevSphereAssignmentResource + string subscriptionId = "mySubscriptionid"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myVMName"; + string guestConfigurationAssignmentName = "AuditSecureProtocol"; + ResourceIdentifier guestConfigurationVMwarevSphereAssignmentResourceId = GuestConfigurationVMwarevSphereAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + GuestConfigurationVMwarevSphereAssignmentResource guestConfigurationVMwarevSphereAssignment = client.GetGuestConfigurationVMwarevSphereAssignmentResource(guestConfigurationVMwarevSphereAssignmentResourceId); + + // invoke the operation and iterate over the result + await foreach (GuestConfigurationAssignmentReport item in guestConfigurationVMwarevSphereAssignment.GetGuestConfigurationConnectedVMwarevSphereAssignmentsReportsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Get a guest configuration assignment report by Id for a virtual machine + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetGuestConfigurationConnectedVMwarevSphereAssignmentsReport_GetAGuestConfigurationAssignmentReportByIdForAVirtualMachine() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationConnectedVMwarevSphereAssignmentReportById.json + // this example is just showing the usage of "GuestConfigurationConnectedVMwarevSphereAssignmentsReports_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GuestConfigurationVMwarevSphereAssignmentResource created on azure + // for more information of creating GuestConfigurationVMwarevSphereAssignmentResource, please refer to the document of GuestConfigurationVMwarevSphereAssignmentResource + string subscriptionId = "mySubscriptionid"; + string resourceGroupName = "myResourceGroupName"; + string vmName = "myvm"; + string guestConfigurationAssignmentName = "AuditSecureProtocol"; + ResourceIdentifier guestConfigurationVMwarevSphereAssignmentResourceId = GuestConfigurationVMwarevSphereAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + GuestConfigurationVMwarevSphereAssignmentResource guestConfigurationVMwarevSphereAssignment = client.GetGuestConfigurationVMwarevSphereAssignmentResource(guestConfigurationVMwarevSphereAssignmentResourceId); + + // invoke the operation + string reportId = "7367cbb8-ae99-47d0-a33b-a283564d2cb1"; + GuestConfigurationAssignmentReport result = await guestConfigurationVMwarevSphereAssignment.GetGuestConfigurationConnectedVMwarevSphereAssignmentsReportAsync(reportId); + + Console.WriteLine($"Succeeded: {result}"); + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentCollection.cs index a8981b0d45f9c..e0a2b6b9d247b 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentCollection.cs @@ -20,7 +20,7 @@ public partial class Sample_GuestConfigurationVmAssignmentCollection [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task CreateOrUpdate_CreateOrUpdateGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/createOrUpdateGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -47,9 +47,10 @@ public async Task CreateOrUpdate_CreateOrUpdateGuestConfigurationAssignment() GuestConfiguration = new GuestConfigurationNavigation() { Name = "NotInstalledApplicationForWindows", - Version = "1.*", + Version = "1.0.0.3", ContentUri = new Uri("https://thisisfake/pacakge"), ContentHash = "123contenthash", + ContentManagedIdentity = "test_identity", AssignmentType = GuestConfigurationAssignmentType.ApplyAndAutoCorrect, ConfigurationParameters = { @@ -80,7 +81,7 @@ public async Task CreateOrUpdate_CreateOrUpdateGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -114,7 +115,7 @@ public async Task Get_GetAGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -144,7 +145,7 @@ public async Task Exists_GetAGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -186,7 +187,7 @@ public async Task GetIfExists_GetAGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAllGuestConfigurationAssignmentsForAVirtualMachine() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listGuestConfigurationAssignments.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/listGuestConfigurationAssignments.json // this example is just showing the usage of "GuestConfigurationAssignments_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentResource.cs index 74201ec1a65ba..831ac5342fef6 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentResource.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmAssignmentResource.cs @@ -20,7 +20,7 @@ public partial class Sample_GuestConfigurationVmAssignmentResource [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Update_CreateOrUpdateGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/createOrUpdateGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/createOrUpdateGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignments_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -45,9 +45,10 @@ public async Task Update_CreateOrUpdateGuestConfigurationAssignment() GuestConfiguration = new GuestConfigurationNavigation() { Name = "NotInstalledApplicationForWindows", - Version = "1.*", + Version = "1.0.0.3", ContentUri = new Uri("https://thisisfake/pacakge"), ContentHash = "123contenthash", + ContentManagedIdentity = "test_identity", AssignmentType = GuestConfigurationAssignmentType.ApplyAndAutoCorrect, ConfigurationParameters = { @@ -78,7 +79,7 @@ public async Task Update_CreateOrUpdateGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignments_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -110,7 +111,7 @@ public async Task Get_GetAGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAnGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/deleteGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignments_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -138,7 +139,7 @@ public async Task Delete_DeleteAnGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReports_ListAllGuestConfigurationAssignmentsForAVirtualMachine() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllGuestConfigurationAssignmentReports.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/listAllGuestConfigurationAssignmentReports.json // this example is just showing the usage of "GuestConfigurationAssignmentReports_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -169,7 +170,7 @@ public async Task GetReports_ListAllGuestConfigurationAssignmentsForAVirtualMach [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReport_GetAGuestConfigurationAssignmentReportByIdForAVirtualMachine() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getGuestConfigurationAssignmentReportById.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getGuestConfigurationAssignmentReportById.json // this example is just showing the usage of "GuestConfigurationAssignmentReports_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentCollection.cs index 8828233aea84c..14a0ab252a9a7 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentCollection.cs @@ -9,17 +9,79 @@ using System.Threading.Tasks; using Azure.Core; using Azure.Identity; +using Azure.ResourceManager.GuestConfiguration.Models; namespace Azure.ResourceManager.GuestConfiguration.Samples { public partial class Sample_GuestConfigurationVmssAssignmentCollection { + // Create or update guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_CreateOrUpdateGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/createOrUpdateGuestConfigurationVMSSAssignment.json + // this example is just showing the usage of "GuestConfigurationAssignmentsVMSS_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ArmResource created on azure + // for more information of creating ArmResource, please refer to the document of ArmResource + + // get the collection of this GuestConfigurationVmssAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmssName = "myVMSSName"; + ResourceIdentifier scopeId = new ResourceIdentifier(string.Format("/subscriptions/{0}/resourceGroups/{1}/providers/Microsoft.Compute/virtualMachineScaleSets/{2}", subscriptionId, resourceGroupName, vmssName)); + GuestConfigurationVmssAssignmentCollection collection = client.GetGuestConfigurationVmssAssignments(scopeId); + + // invoke the operation + string name = "NotInstalledApplicationForWindows"; + GuestConfigurationAssignmentData data = new GuestConfigurationAssignmentData() + { + Properties = new GuestConfigurationAssignmentProperties() + { + GuestConfiguration = new GuestConfigurationNavigation() + { + Name = "NotInstalledApplicationForWindows", + Version = "1.0.0.3", + ContentUri = new Uri("https://thisisfake/pacakge"), + ContentHash = "123contenthash", + ContentManagedIdentity = "test_identity", + AssignmentType = GuestConfigurationAssignmentType.ApplyAndAutoCorrect, + ConfigurationParameters = +{ +new GuestConfigurationParameter() +{ +Name = "[InstalledApplication]NotInstalledApplicationResource1;Name", +Value = "NotePad,sql", +} +}, + }, + Context = "Azure policy", + }, + Name = "NotInstalledApplicationForWindows", + Location = new AzureLocation("westcentralus"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, name, data); + GuestConfigurationVmssAssignmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuestConfigurationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Get a VMSS guest configuration assignment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAVMSSGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getVMSSGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignmentsVMSS_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -53,7 +115,7 @@ public async Task Get_GetAVMSSGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Exists_GetAVMSSGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getVMSSGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignmentsVMSS_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -83,7 +145,7 @@ public async Task Exists_GetAVMSSGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetIfExists_GetAVMSSGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getVMSSGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignmentsVMSS_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -125,7 +187,7 @@ public async Task GetIfExists_GetAVMSSGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetAll_ListAllGuestConfigurationAssignmentsForVMSS() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listVMSSGuestConfigurationAssignments.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/listVMSSGuestConfigurationAssignments.json // this example is just showing the usage of "GuestConfigurationAssignmentsVMSS_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentResource.cs index 455f60d5aa444..b03706f6e4ee0 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentResource.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/samples/Generated/Samples/Sample_GuestConfigurationVmssAssignmentResource.cs @@ -15,12 +15,71 @@ namespace Azure.ResourceManager.GuestConfiguration.Samples { public partial class Sample_GuestConfigurationVmssAssignmentResource { + // Create or update guest configuration assignment + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_CreateOrUpdateGuestConfigurationAssignment() + { + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/createOrUpdateGuestConfigurationVMSSAssignment.json + // this example is just showing the usage of "GuestConfigurationAssignmentsVMSS_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this GuestConfigurationVmssAssignmentResource created on azure + // for more information of creating GuestConfigurationVmssAssignmentResource, please refer to the document of GuestConfigurationVmssAssignmentResource + string subscriptionId = "mySubscriptionId"; + string resourceGroupName = "myResourceGroupName"; + string vmssName = "myVMSSName"; + string name = "NotInstalledApplicationForWindows"; + ResourceIdentifier guestConfigurationVmssAssignmentResourceId = GuestConfigurationVmssAssignmentResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, vmssName, name); + GuestConfigurationVmssAssignmentResource guestConfigurationVmssAssignment = client.GetGuestConfigurationVmssAssignmentResource(guestConfigurationVmssAssignmentResourceId); + + // invoke the operation + GuestConfigurationAssignmentData data = new GuestConfigurationAssignmentData() + { + Properties = new GuestConfigurationAssignmentProperties() + { + GuestConfiguration = new GuestConfigurationNavigation() + { + Name = "NotInstalledApplicationForWindows", + Version = "1.0.0.3", + ContentUri = new Uri("https://thisisfake/pacakge"), + ContentHash = "123contenthash", + ContentManagedIdentity = "test_identity", + AssignmentType = GuestConfigurationAssignmentType.ApplyAndAutoCorrect, + ConfigurationParameters = +{ +new GuestConfigurationParameter() +{ +Name = "[InstalledApplication]NotInstalledApplicationResource1;Name", +Value = "NotePad,sql", +} +}, + }, + Context = "Azure policy", + }, + Name = "NotInstalledApplicationForWindows", + Location = new AzureLocation("westcentralus"), + }; + ArmOperation lro = await guestConfigurationVmssAssignment.UpdateAsync(WaitUntil.Completed, data); + GuestConfigurationVmssAssignmentResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + GuestConfigurationAssignmentData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + // Get a VMSS guest configuration assignment [NUnit.Framework.Test] [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Get_GetAVMSSGuestConfigurationAssignment() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getVMSSGuestConfigurationAssignment.json // this example is just showing the usage of "GuestConfigurationAssignmentsVMSS_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -52,7 +111,7 @@ public async Task Get_GetAVMSSGuestConfigurationAssignment() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task Delete_DeleteAnGuestConfigurationAssignmentForVMSS() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/deleteGuestConfigurationVMSSAssignment.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/deleteGuestConfigurationVMSSAssignment.json // this example is just showing the usage of "GuestConfigurationAssignmentsVMSS_Delete" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -85,7 +144,7 @@ public async Task Delete_DeleteAnGuestConfigurationAssignmentForVMSS() [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReports_ListAllReportsForTheVMSSGuestConfigurationAssignmentWithLatestReportFirst() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/listAllVMSSGuestConfigurationAssignmentReports.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/listAllVMSSGuestConfigurationAssignmentReports.json // this example is just showing the usage of "GuestConfigurationAssignmentReportsVMSS_List" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -116,7 +175,7 @@ public async Task GetReports_ListAllReportsForTheVMSSGuestConfigurationAssignmen [NUnit.Framework.Ignore("Only verifying that the sample builds")] public async Task GetReport_GetAGuestConfigurationAssignmentReportByIdForAVirtualMachineScaleSet() { - // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2022-01-25/examples/getVMSSGuestConfigurationAssignmentReportById.json + // Generated from example definition: specification/guestconfiguration/resource-manager/Microsoft.GuestConfiguration/stable/2024-04-05/examples/getVMSSGuestConfigurationAssignmentReportById.json // this example is just showing the usage of "GuestConfigurationAssignmentReportsVMSS_Get" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Azure.ResourceManager.GuestConfiguration.csproj b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Azure.ResourceManager.GuestConfiguration.csproj index 8230187e326b0..303e696e5d884 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Azure.ResourceManager.GuestConfiguration.csproj +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Azure.ResourceManager.GuestConfiguration.csproj @@ -1,6 +1,6 @@ - 1.2.0-beta.1 + 1.2.0 1.1.0 Azure.ResourceManager.GuestConfiguration diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/ArmGuestConfigurationModelFactory.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/ArmGuestConfigurationModelFactory.cs index 99da8494ca8d8..5eb97d4dbaf3f 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/ArmGuestConfigurationModelFactory.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/ArmGuestConfigurationModelFactory.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using Azure.Core; using Azure.ResourceManager.Models; @@ -76,6 +77,7 @@ public static GuestConfigurationAssignmentProperties GuestConfigurationAssignmen /// Version of the guest configuration. /// Uri of the storage where guest configuration package is uploaded. /// Combined hash of the guest configuration package and configuration parameters. + /// Managed identity with storage access of the guest configuration package and configuration parameters. /// Specifies the assignment type and execution of the configuration. Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor. /// Specifies the origin of the configuration. /// Specifies the content type of the configuration. Possible values could be Builtin or Custom. @@ -83,7 +85,7 @@ public static GuestConfigurationAssignmentProperties GuestConfigurationAssignmen /// The protected configuration parameters for the guest configuration. /// The configuration setting for the guest configuration. /// A new instance for mocking. - public static GuestConfigurationNavigation GuestConfigurationNavigation(GuestConfigurationKind? kind = null, string name = null, string version = null, Uri contentUri = null, string contentHash = null, GuestConfigurationAssignmentType? assignmentType = null, string assignmentSource = null, string contentType = null, IEnumerable configurationParameters = null, IEnumerable configurationProtectedParameters = null, LcmConfigurationSetting configurationSetting = null) + public static GuestConfigurationNavigation GuestConfigurationNavigation(GuestConfigurationKind? kind = null, string name = null, string version = null, Uri contentUri = null, string contentHash = null, string contentManagedIdentity = null, GuestConfigurationAssignmentType? assignmentType = null, string assignmentSource = null, string contentType = null, IEnumerable configurationParameters = null, IEnumerable configurationProtectedParameters = null, LcmConfigurationSetting configurationSetting = null) { configurationParameters ??= new List(); configurationProtectedParameters ??= new List(); @@ -94,6 +96,7 @@ public static GuestConfigurationNavigation GuestConfigurationNavigation(GuestCon version, contentUri, contentHash, + contentManagedIdentity, assignmentType, assignmentSource, contentType, @@ -291,5 +294,24 @@ public static GuestConfigurationAssignmentReportDetails GuestConfigurationAssign resources?.ToList(), serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// Kind of the guest configuration. For example:DSC. + /// Name of the guest configuration. + /// Version of the guest configuration. + /// Uri of the storage where guest configuration package is uploaded. + /// Combined hash of the guest configuration package and configuration parameters. + /// Specifies the assignment type and execution of the configuration. Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor. + /// Specifies the origin of the configuration. + /// Specifies the content type of the configuration. Possible values could be Builtin or Custom. + /// The configuration parameters for the guest configuration. + /// The protected configuration parameters for the guest configuration. + /// The configuration setting for the guest configuration. + /// A new instance for mocking. + [EditorBrowsable(EditorBrowsableState.Never)] + public static GuestConfigurationNavigation GuestConfigurationNavigation(GuestConfigurationKind? kind, string name, string version, Uri contentUri, string contentHash, GuestConfigurationAssignmentType? assignmentType, string assignmentSource, string contentType, IEnumerable configurationParameters, IEnumerable configurationProtectedParameters, LcmConfigurationSetting configurationSetting) + { + return GuestConfigurationNavigation(kind: kind, name: name, version: version, contentUri: contentUri, contentHash: contentHash, contentManagedIdentity: default, assignmentType: assignmentType, assignmentSource: assignmentSource, contentType: contentType, configurationParameters: configurationParameters, configurationProtectedParameters: configurationProtectedParameters, configurationSetting: configurationSetting); + } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/GuestConfigurationExtensions.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/GuestConfigurationExtensions.cs index f08435cb3d879..35a0e7d6a58d7 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/GuestConfigurationExtensions.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/GuestConfigurationExtensions.cs @@ -63,7 +63,7 @@ public static GuestConfigurationVmAssignmentCollection GetGuestConfigurationVmAs /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -102,7 +102,7 @@ public static async Task> GetGu /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -159,7 +159,7 @@ public static GuestConfigurationHcrpAssignmentCollection GetGuestConfigurationHc /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -198,7 +198,7 @@ public static async Task> Get /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -255,7 +255,7 @@ public static GuestConfigurationVmssAssignmentCollection GetGuestConfigurationVm /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -294,7 +294,7 @@ public static async Task> Get /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -320,6 +320,102 @@ public static Response GetGuestConfigu return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVmssAssignment(scope, name, cancellationToken); } + /// + /// Gets a collection of GuestConfigurationVMwarevSphereAssignmentResources in the ArmClient. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.ConnectedVMwarevSphere/virtualmachines. + /// is null. + /// An object representing collection of GuestConfigurationVMwarevSphereAssignmentResources and their operations over a GuestConfigurationVMwarevSphereAssignmentResource. + public static GuestConfigurationVMwarevSphereAssignmentCollection GetGuestConfigurationVMwarevSphereAssignments(this ArmClient client, ResourceIdentifier scope) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVMwarevSphereAssignments(scope); + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.ConnectedVMwarevSphere/virtualmachines. + /// The guest configuration assignment name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetGuestConfigurationVMwarevSphereAssignmentAsync(this ArmClient client, ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(client, nameof(client)); + + return await GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVMwarevSphereAssignmentAsync(scope, guestConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The scope that the resource will apply against. Expected resource type includes the following: Microsoft.ConnectedVMwarevSphere/virtualmachines. + /// The guest configuration assignment name. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetGuestConfigurationVMwarevSphereAssignment(this ArmClient client, ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVMwarevSphereAssignment(scope, guestConfigurationAssignmentName, cancellationToken); + } + /// /// 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. @@ -376,5 +472,24 @@ public static GuestConfigurationVmssAssignmentResource GetGuestConfigurationVmss return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVmssAssignmentResource(id); } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static GuestConfigurationVMwarevSphereAssignmentResource GetGuestConfigurationVMwarevSphereAssignmentResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableGuestConfigurationArmClient(client).GetGuestConfigurationVMwarevSphereAssignmentResource(id); + } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationArmClient.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationArmClient.cs index 17ea26b822810..a143b07978c27 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationArmClient.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Extensions/MockableGuestConfigurationArmClient.cs @@ -62,7 +62,7 @@ public virtual GuestConfigurationVmAssignmentCollection GetGuestConfigurationVmA /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -94,7 +94,7 @@ public virtual async Task> GetG /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -138,7 +138,7 @@ public virtual GuestConfigurationHcrpAssignmentCollection GetGuestConfigurationH /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -170,7 +170,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -214,7 +214,7 @@ public virtual GuestConfigurationVmssAssignmentCollection GetGuestConfigurationV /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -246,7 +246,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -265,6 +265,82 @@ public virtual Response GetGuestConfig return GetGuestConfigurationVmssAssignments(scope).Get(name, cancellationToken); } + /// Gets a collection of GuestConfigurationVMwarevSphereAssignmentResources in the ArmClient. + /// The scope that the resource will apply against. + /// An object representing collection of GuestConfigurationVMwarevSphereAssignmentResources and their operations over a GuestConfigurationVMwarevSphereAssignmentResource. + public virtual GuestConfigurationVMwarevSphereAssignmentCollection GetGuestConfigurationVMwarevSphereAssignments(ResourceIdentifier scope) + { + if (!scope.ResourceType.Equals("Microsoft.ConnectedVMwarevSphere/virtualmachines")) + { + throw new ArgumentException(string.Format("Invalid resource type {0}, expected Microsoft.ConnectedVMwarevSphere/virtualmachines", scope.ResourceType)); + } + return new GuestConfigurationVMwarevSphereAssignmentCollection(Client, scope); + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetGuestConfigurationVMwarevSphereAssignmentAsync(ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + return await GetGuestConfigurationVMwarevSphereAssignments(scope).GetAsync(guestConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The scope that the resource will apply against. + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetGuestConfigurationVMwarevSphereAssignment(ResourceIdentifier scope, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + return GetGuestConfigurationVMwarevSphereAssignments(scope).Get(guestConfigurationAssignmentName, cancellationToken); + } + /// /// 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. @@ -300,5 +376,17 @@ public virtual GuestConfigurationVmssAssignmentResource GetGuestConfigurationVms GuestConfigurationVmssAssignmentResource.ValidateResourceId(id); return new GuestConfigurationVmssAssignmentResource(Client, id); } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual GuestConfigurationVMwarevSphereAssignmentResource GetGuestConfigurationVMwarevSphereAssignmentResource(ResourceIdentifier id) + { + GuestConfigurationVMwarevSphereAssignmentResource.ValidateResourceId(id); + return new GuestConfigurationVMwarevSphereAssignmentResource(Client, id); + } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationAssignmentData.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationAssignmentData.Serialization.cs index 9ffcf2cfefb98..3001d3f8ad4b6 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationAssignmentData.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationAssignmentData.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; using Azure.ResourceManager.GuestConfiguration.Models; @@ -172,6 +173,104 @@ internal static GuestConfigurationAssignmentData DeserializeGuestConfigurationAs properties); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Location)) + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + BicepSerializationHelpers.AppendChildObject(builder, SystemData, options, 2, false, " systemData: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -180,6 +279,8 @@ BinaryData IPersistableModel.Write(ModelReader { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationAssignmentData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationAssignmentData.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationAssignmentData.cs index de0545b6f889e..a077ff24137e8 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationAssignmentData.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationAssignmentData.cs @@ -38,6 +38,7 @@ internal GuestConfigurationAssignmentData(ResourceIdentifier id, string name, Az } /// Properties of the Guest configuration assignment. + [WirePath("properties")] public GuestConfigurationAssignmentProperties Properties { get; set; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentCollection.cs index 6cca1cfce88c6..f25f6f735badc 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUp /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string gue /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -285,7 +285,7 @@ public virtual AsyncPageable GetAllAsy /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -314,7 +314,7 @@ public virtual Pageable GetAll(Cancell /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -357,7 +357,7 @@ public virtual async Task> ExistsAsync(string guestConfigurationA /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -400,7 +400,7 @@ public virtual Response Exists(string guestConfigurationAssignmentName, Ca /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -445,7 +445,7 @@ public virtual async Task /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentResource.cs index 7b198a98b9593..f217c0daa5ae0 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentResource.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationHcrpAssignmentResource.cs @@ -107,7 +107,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -147,7 +147,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -187,7 +187,7 @@ public virtual Response Get(Cancellati /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -231,7 +231,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -275,7 +275,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -323,7 +323,7 @@ public virtual async Task /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -371,7 +371,7 @@ public virtual ArmOperation Update(Wai /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// @@ -396,7 +396,7 @@ public virtual AsyncPageable GetReportsAsync /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// @@ -421,7 +421,7 @@ public virtual Pageable GetReports(Cancellat /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// @@ -460,7 +460,7 @@ public virtual async Task> GetRepor /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVMwarevSphereAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVMwarevSphereAssignmentCollection.cs new file mode 100644 index 0000000000000..351136ab95eb0 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVMwarevSphereAssignmentCollection.cs @@ -0,0 +1,495 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.GuestConfiguration +{ + /// + /// 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 GetGuestConfigurationVMwarevSphereAssignments method from an instance of . + /// + public partial class GuestConfigurationVMwarevSphereAssignmentCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics; + private readonly GuestConfigurationConnectedVMwarevSphereAssignmentsRestOperations _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient; + + /// Initializes a new instance of the class for mocking. + protected GuestConfigurationVMwarevSphereAssignmentCollection() + { + } + + /// 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 GuestConfigurationVMwarevSphereAssignmentCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.GuestConfiguration", GuestConfigurationVMwarevSphereAssignmentResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(GuestConfigurationVMwarevSphereAssignmentResource.ResourceType, out string guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsApiVersion); + _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient = new GuestConfigurationConnectedVMwarevSphereAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != "Microsoft.ConnectedVMwarevSphere/virtualmachines") + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, "Microsoft.ConnectedVMwarevSphere/virtualmachines"), nameof(id)); + } + + /// + /// Creates an association between a Connected VM Sphere machine and guest configuration + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the guest configuration assignment. + /// Parameters supplied to the create or update guest configuration assignment. + /// 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 guestConfigurationAssignmentName, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, data, cancellationToken).ConfigureAwait(false); + var uri = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new GuestConfigurationArmOperation(Response.FromValue(new GuestConfigurationVMwarevSphereAssignmentResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates an association between a Connected VM Sphere machine and guest configuration + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the guest configuration assignment. + /// Parameters supplied to the create or update guest configuration assignment. + /// 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 guestConfigurationAssignmentName, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, data, cancellationToken); + var uri = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new GuestConfigurationArmOperation(Response.FromValue(new GuestConfigurationVMwarevSphereAssignmentResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The guest 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 guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentCollection.Get"); + scope.Start(); + try + { + var response = await _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationVMwarevSphereAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The guest 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 guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentCollection.Get"); + scope.Start(); + try + { + var response = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationVMwarevSphereAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all guest configuration assignments for an ARC machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_List + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => new GuestConfigurationVMwarevSphereAssignmentResource(Client, GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(e)), _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics, Pipeline, "GuestConfigurationVMwarevSphereAssignmentCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// List all guest configuration assignments for an ARC machine. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_List + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => new GuestConfigurationVMwarevSphereAssignmentResource(Client, GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(e)), _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics, Pipeline, "GuestConfigurationVMwarevSphereAssignmentCollection.GetAll", "value", null, cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The guest 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 guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentCollection.Exists"); + scope.Start(); + try + { + var response = await _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, 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.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The guest 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 guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentCollection.Exists"); + scope.Start(); + try + { + var response = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The guest 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> GetIfExistsAsync(string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationVMwarevSphereAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The guest configuration assignment name. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentCollection.GetIfExists"); + scope.Start(); + try + { + var response = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, guestConfigurationAssignmentName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationVMwarevSphereAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVMwarevSphereAssignmentResource.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVMwarevSphereAssignmentResource.Serialization.cs new file mode 100644 index 0000000000000..4c0592578e68c --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVMwarevSphereAssignmentResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.GuestConfiguration +{ + public partial class GuestConfigurationVMwarevSphereAssignmentResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + GuestConfigurationAssignmentData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + GuestConfigurationAssignmentData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVMwarevSphereAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVMwarevSphereAssignmentResource.cs new file mode 100644 index 0000000000000..39c1bf151c0f0 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVMwarevSphereAssignmentResource.cs @@ -0,0 +1,489 @@ +// 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 Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.GuestConfiguration.Models; + +namespace Azure.ResourceManager.GuestConfiguration +{ + /// + /// A Class representing a GuestConfigurationVMwarevSphereAssignment 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 GetGuestConfigurationVMwarevSphereAssignmentResource method. + /// Otherwise you can get one from its parent resource using the GetGuestConfigurationVMwarevSphereAssignment method. + /// + public partial class GuestConfigurationVMwarevSphereAssignmentResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The resourceGroupName. + /// The vmName. + /// The guestConfigurationAssignmentName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics; + private readonly GuestConfigurationConnectedVMwarevSphereAssignmentsRestOperations _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient; + private readonly ClientDiagnostics _guestConfigurationConnectedVMwarevSphereAssignmentsReportsClientDiagnostics; + private readonly GuestConfigurationConnectedVMwarevSphereAssignmentsReportsRestOperations _guestConfigurationConnectedVMwarevSphereAssignmentsReportsRestClient; + private readonly GuestConfigurationAssignmentData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.GuestConfiguration/guestConfigurationAssignments"; + + /// Initializes a new instance of the class for mocking. + protected GuestConfigurationVMwarevSphereAssignmentResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal GuestConfigurationVMwarevSphereAssignmentResource(ArmClient client, GuestConfigurationAssignmentData 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 GuestConfigurationVMwarevSphereAssignmentResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.GuestConfiguration", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsApiVersion); + _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient = new GuestConfigurationConnectedVMwarevSphereAssignmentsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsApiVersion); + _guestConfigurationConnectedVMwarevSphereAssignmentsReportsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.GuestConfiguration", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _guestConfigurationConnectedVMwarevSphereAssignmentsReportsRestClient = new GuestConfigurationConnectedVMwarevSphereAssignmentsReportsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual GuestConfigurationAssignmentData 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 information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentResource.Get"); + scope.Start(); + try + { + var response = await _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationVMwarevSphereAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get information about a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentResource.Get"); + scope.Start(); + try + { + var response = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new GuestConfigurationVMwarevSphereAssignmentResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Delete + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentResource.Delete"); + scope.Start(); + try + { + var response = await _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new GuestConfigurationArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a guest configuration assignment + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_Delete + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentResource.Delete"); + scope.Start(); + try + { + var response = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new GuestConfigurationArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates an association between a Connected VM Sphere machine and guest configuration + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters supplied to the create or update guest configuration assignment. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentResource.Update"); + scope.Start(); + try + { + var response = await _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new GuestConfigurationArmOperation(Response.FromValue(new GuestConfigurationVMwarevSphereAssignmentResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates an association between a Connected VM Sphere machine and guest configuration + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignments_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters supplied to the create or update guest configuration assignment. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentResource.Update"); + scope.Start(); + try + { + var response = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _guestConfigurationVMwarevSphereAssignmentGuestConfigurationConnectedVMwarevSphereAssignmentsRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new GuestConfigurationArmOperation(Response.FromValue(new GuestConfigurationVMwarevSphereAssignmentResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all reports for the guest configuration assignment, latest report first. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignmentsReports_List + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetGuestConfigurationConnectedVMwarevSphereAssignmentsReportsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _guestConfigurationConnectedVMwarevSphereAssignmentsReportsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, e => GuestConfigurationAssignmentReport.DeserializeGuestConfigurationAssignmentReport(e), _guestConfigurationConnectedVMwarevSphereAssignmentsReportsClientDiagnostics, Pipeline, "GuestConfigurationVMwarevSphereAssignmentResource.GetGuestConfigurationConnectedVMwarevSphereAssignmentsReports", "value", null, cancellationToken); + } + + /// + /// List all reports for the guest configuration assignment, latest report first. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignmentsReports_List + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetGuestConfigurationConnectedVMwarevSphereAssignmentsReports(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _guestConfigurationConnectedVMwarevSphereAssignmentsReportsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, e => GuestConfigurationAssignmentReport.DeserializeGuestConfigurationAssignmentReport(e), _guestConfigurationConnectedVMwarevSphereAssignmentsReportsClientDiagnostics, Pipeline, "GuestConfigurationVMwarevSphereAssignmentResource.GetGuestConfigurationConnectedVMwarevSphereAssignmentsReports", "value", null, cancellationToken); + } + + /// + /// Get a report for the guest configuration assignment, by reportId. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignmentsReports_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// + /// The GUID for the guest configuration assignment report. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetGuestConfigurationConnectedVMwarevSphereAssignmentsReportAsync(string reportId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reportId, nameof(reportId)); + + using var scope = _guestConfigurationConnectedVMwarevSphereAssignmentsReportsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentResource.GetGuestConfigurationConnectedVMwarevSphereAssignmentsReport"); + scope.Start(); + try + { + var response = await _guestConfigurationConnectedVMwarevSphereAssignmentsReportsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, reportId, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a report for the guest configuration assignment, by reportId. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}/reports/{reportId} + /// + /// + /// Operation Id + /// GuestConfigurationConnectedVMwarevSphereAssignmentsReports_Get + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// + /// The GUID for the guest configuration assignment report. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response GetGuestConfigurationConnectedVMwarevSphereAssignmentsReport(string reportId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(reportId, nameof(reportId)); + + using var scope = _guestConfigurationConnectedVMwarevSphereAssignmentsReportsClientDiagnostics.CreateScope("GuestConfigurationVMwarevSphereAssignmentResource.GetGuestConfigurationConnectedVMwarevSphereAssignmentsReport"); + scope.Start(); + try + { + var response = _guestConfigurationConnectedVMwarevSphereAssignmentsReportsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, reportId, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentCollection.cs index 4a419683a7547..193ba21eb28c7 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentCollection.cs @@ -64,7 +64,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -115,7 +115,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -166,7 +166,7 @@ public virtual ArmOperation CreateOrUpda /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -211,7 +211,7 @@ public virtual async Task> GetA /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -256,7 +256,7 @@ public virtual Response Get(string guest /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -285,7 +285,7 @@ public virtual AsyncPageable GetAllAsync /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -314,7 +314,7 @@ public virtual Pageable GetAll(Cancellat /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -357,7 +357,7 @@ public virtual async Task> ExistsAsync(string guestConfigurationA /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -400,7 +400,7 @@ public virtual Response Exists(string guestConfigurationAssignmentName, Ca /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -445,7 +445,7 @@ public virtual async Task /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentResource.cs index 3d12cf199a3dc..1aab20d23fa0f 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentResource.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmAssignmentResource.cs @@ -107,7 +107,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -147,7 +147,7 @@ public virtual async Task> GetA /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -187,7 +187,7 @@ public virtual Response Get(Cancellation /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -231,7 +231,7 @@ public virtual async Task DeleteAsync(WaitUntil waitUntil, Cancell /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -275,7 +275,7 @@ public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancel /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -323,7 +323,7 @@ public virtual async Task> /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -371,7 +371,7 @@ public virtual ArmOperation Update(WaitU /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// @@ -396,7 +396,7 @@ public virtual AsyncPageable GetReportsAsync /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// @@ -421,7 +421,7 @@ public virtual Pageable GetReports(Cancellat /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// @@ -460,7 +460,7 @@ public virtual async Task> GetRepor /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentCollection.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentCollection.cs index 7bf2e9e7b367e..bed21598547f1 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentCollection.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentCollection.cs @@ -51,6 +51,108 @@ internal static void ValidateResourceId(ResourceIdentifier id) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, "Microsoft.Compute/virtualMachineScaleSets"), nameof(id)); } + /// + /// Creates an association between a VMSS and guest configuration + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name} + /// + /// + /// Operation Id + /// GuestConfigurationAssignmentsVMSS_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the guest configuration assignment. + /// Parameters supplied to the create or update guest configuration assignment. + /// 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 name, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSClientDiagnostics.CreateScope("GuestConfigurationVmssAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken).ConfigureAwait(false); + var uri = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new GuestConfigurationArmOperation(Response.FromValue(new GuestConfigurationVmssAssignmentResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates an association between a VMSS and guest configuration + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name} + /// + /// + /// Operation Id + /// GuestConfigurationAssignmentsVMSS_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the guest configuration assignment. + /// Parameters supplied to the create or update guest configuration assignment. + /// 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 name, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSClientDiagnostics.CreateScope("GuestConfigurationVmssAssignmentCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data, cancellationToken); + var uri = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new GuestConfigurationArmOperation(Response.FromValue(new GuestConfigurationVmssAssignmentResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// Get information about a guest configuration assignment for VMSS /// @@ -64,7 +166,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -109,7 +211,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -154,7 +256,7 @@ public virtual Response Get(string nam /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -183,7 +285,7 @@ public virtual AsyncPageable GetAllAsy /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -212,7 +314,7 @@ public virtual Pageable GetAll(Cancell /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -255,7 +357,7 @@ public virtual async Task> ExistsAsync(string name, CancellationT /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -298,7 +400,7 @@ public virtual Response Exists(string name, CancellationToken cancellation /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -343,7 +445,7 @@ public virtual async Task /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentResource.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentResource.cs index 34d0be527e6f1..74d7d9ddf78cb 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentResource.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/GuestConfigurationVmssAssignmentResource.cs @@ -107,7 +107,7 @@ internal static void ValidateResourceId(ResourceIdentifier id) /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -147,7 +147,7 @@ public virtual async Task> Ge /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -187,7 +187,7 @@ public virtual Response Get(Cancellati /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -231,7 +231,7 @@ public virtual async Task /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// Resource @@ -262,6 +262,102 @@ public virtual ArmOperation Delete(Wai } } + /// + /// Creates an association between a VMSS and guest configuration + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name} + /// + /// + /// Operation Id + /// GuestConfigurationAssignmentsVMSS_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters supplied to the create or update guest configuration assignment. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSClientDiagnostics.CreateScope("GuestConfigurationVmssAssignmentResource.Update"); + scope.Start(); + try + { + var response = await _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSRestClient.CreateOrUpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new GuestConfigurationArmOperation(Response.FromValue(new GuestConfigurationVmssAssignmentResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Creates an association between a VMSS and guest configuration + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name} + /// + /// + /// Operation Id + /// GuestConfigurationAssignmentsVMSS_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-04-05 + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Parameters supplied to the create or update guest configuration assignment. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSClientDiagnostics.CreateScope("GuestConfigurationVmssAssignmentResource.Update"); + scope.Start(); + try + { + var response = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSRestClient.CreateOrUpdate(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _guestConfigurationVmssAssignmentGuestConfigurationAssignmentsVmSSRestClient.CreateCreateOrUpdateRequestUri(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new GuestConfigurationArmOperation(Response.FromValue(new GuestConfigurationVmssAssignmentResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// List all reports for the VMSS guest configuration assignment, latest report first. /// @@ -275,7 +371,7 @@ public virtual ArmOperation Delete(Wai /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// @@ -300,7 +396,7 @@ public virtual AsyncPageable GetReportsAsync /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// @@ -325,7 +421,7 @@ public virtual Pageable GetReports(Cancellat /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// @@ -364,7 +460,7 @@ public virtual async Task> GetRepor /// /// /// Default Api Version - /// 2022-01-25 + /// 2024-04-05 /// /// /// diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Internal/BicepSerializationHelpers.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Internal/BicepSerializationHelpers.cs new file mode 100644 index 0000000000000..d9ad6c3d4b4e6 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Internal/BicepSerializationHelpers.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text; + +namespace Azure.ResourceManager.GuestConfiguration +{ + internal static class BicepSerializationHelpers + { + public static void AppendChildObject(StringBuilder stringBuilder, object childObject, ModelReaderWriterOptions options, int spaces, bool indentFirstLine, string formattedPropertyName) + { + string indent = new string(' ', spaces); + int emptyObjectLength = 2 + spaces + Environment.NewLine.Length + Environment.NewLine.Length; + int length = stringBuilder.Length; + bool inMultilineString = false; + + BinaryData data = ModelReaderWriter.Write(childObject, options); + string[] lines = data.ToString().Split(Environment.NewLine.ToCharArray(), StringSplitOptions.RemoveEmptyEntries); + for (int i = 0; i < lines.Length; i++) + { + string line = lines[i]; + if (inMultilineString) + { + if (line.Contains("'''")) + { + inMultilineString = false; + } + stringBuilder.AppendLine(line); + continue; + } + if (line.Contains("'''")) + { + inMultilineString = true; + stringBuilder.AppendLine($"{indent}{line}"); + continue; + } + if (i == 0 && !indentFirstLine) + { + stringBuilder.AppendLine($"{line}"); + } + else + { + stringBuilder.AppendLine($"{indent}{line}"); + } + } + if (stringBuilder.Length == length + emptyObjectLength) + { + stringBuilder.Length = stringBuilder.Length - emptyObjectLength - formattedPropertyName.Length; + } + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Internal/WirePathAttribute.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Internal/WirePathAttribute.cs new file mode 100644 index 0000000000000..8ff9b7738996e --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Internal/WirePathAttribute.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.GuestConfiguration +{ + [AttributeUsage(AttributeTargets.Property)] + internal class WirePathAttribute : Attribute + { + private string _wirePath; + + public WirePathAttribute(string wirePath) + { + _wirePath = wirePath; + } + + public override string ToString() + { + return _wirePath; + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceComplianceReason.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceComplianceReason.Serialization.cs index 76bccbefe17cd..73befb8cb8a9e 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceComplianceReason.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceComplianceReason.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -99,6 +100,67 @@ internal static AssignmentReportResourceComplianceReason DeserializeAssignmentRe return new AssignmentReportResourceComplianceReason(phrase, code, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Phrase), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" phrase: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Phrase)) + { + builder.Append(" phrase: "); + if (Phrase.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Phrase}'''"); + } + else + { + builder.AppendLine($"'{Phrase}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Code), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" code: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Code)) + { + builder.Append(" code: "); + if (Code.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Code}'''"); + } + else + { + builder.AppendLine($"'{Code}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -107,6 +169,8 @@ BinaryData IPersistableModel.Write(Mod { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(AssignmentReportResourceComplianceReason)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceComplianceReason.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceComplianceReason.cs index bd359d99313ce..5fbf64e085894 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceComplianceReason.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceComplianceReason.cs @@ -62,8 +62,10 @@ internal AssignmentReportResourceComplianceReason(string phrase, string code, ID } /// Reason for the compliance of the guest configuration assignment resource. + [WirePath("phrase")] public string Phrase { get; } /// Code for the compliance of the guest configuration assignment resource. + [WirePath("code")] public string Code { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceInfo.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceInfo.Serialization.cs index 28b2bd4748ba1..4df2f1e191d50 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceInfo.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceInfo.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -150,6 +152,97 @@ internal static AssignmentReportResourceInfo DeserializeAssignmentReportResource return new AssignmentReportResourceInfo(complianceStatus, resourceId, reasons ?? new ChangeTrackingList(), properties, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ComplianceStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" complianceStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ComplianceStatus)) + { + builder.Append(" complianceStatus: "); + builder.AppendLine($"'{ComplianceStatus.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AssignmentResourceSettingName), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AssignmentResourceSettingName)) + { + builder.Append(" resourceId: "); + if (AssignmentResourceSettingName.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AssignmentResourceSettingName}'''"); + } + else + { + builder.AppendLine($"'{AssignmentResourceSettingName}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Reasons), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" reasons: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Reasons)) + { + if (Reasons.Any()) + { + builder.Append(" reasons: "); + builder.AppendLine("["); + foreach (var item in Reasons) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " reasons: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + builder.AppendLine($"'{Properties.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -158,6 +251,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrit { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(AssignmentReportResourceInfo)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceInfo.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceInfo.cs index 86421f93f7c16..f82515acc53e7 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceInfo.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/AssignmentReportResourceInfo.cs @@ -67,10 +67,13 @@ internal AssignmentReportResourceInfo(AssignedGuestConfigurationMachineComplianc } /// A value indicating compliance status of the machine for the assigned guest configuration. + [WirePath("complianceStatus")] public AssignedGuestConfigurationMachineComplianceStatus? ComplianceStatus { get; } /// Name of the guest configuration assignment resource setting. + [WirePath("resourceId")] public string AssignmentResourceSettingName { get; } /// Compliance reason and reason code for a resource. + [WirePath("reasons")] public IList Reasons { get; } /// /// Properties of a guest configuration assignment resource. @@ -102,6 +105,7 @@ internal AssignmentReportResourceInfo(AssignedGuestConfigurationMachineComplianc /// /// /// + [WirePath("properties")] public BinaryData Properties { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentInfo.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentInfo.Serialization.cs index a0c707de21500..eb2f2fe8cc827 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentInfo.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentInfo.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -103,6 +104,59 @@ internal static GuestConfigurationAssignmentInfo DeserializeGuestConfigurationAs return new GuestConfigurationAssignmentInfo(name, configuration, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Configuration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" configuration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Configuration)) + { + builder.Append(" configuration: "); + BicepSerializationHelpers.AppendChildObject(builder, Configuration, options, 2, false, " configuration: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -111,6 +165,8 @@ BinaryData IPersistableModel.Write(ModelReader { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationAssignmentInfo)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentInfo.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentInfo.cs index 26f9d3188e768..6ecec722faa7d 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentInfo.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentInfo.cs @@ -62,8 +62,10 @@ internal GuestConfigurationAssignmentInfo(string name, GuestConfigurationInfo co } /// Name of the guest configuration assignment. + [WirePath("name")] public string Name { get; } /// Information about the configuration. + [WirePath("configuration")] public GuestConfigurationInfo Configuration { get; set; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentList.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentList.Serialization.cs index 7663045a1a78d..a652d6461e9b8 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentList.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentList.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -102,6 +104,44 @@ internal static GuestConfigurationAssignmentList DeserializeGuestConfigurationAs return new GuestConfigurationAssignmentList(value ?? new ChangeTrackingList(), serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -110,6 +150,8 @@ BinaryData IPersistableModel.Write(ModelReader { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationAssignmentList)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentProperties.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentProperties.Serialization.cs index 4f71be3d4141a..0c25f6b3c454d 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentProperties.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentProperties.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -340,6 +342,250 @@ internal static GuestConfigurationAssignmentProperties DeserializeGuestConfigura serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(TargetResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" targetResourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(TargetResourceId)) + { + builder.Append(" targetResourceId: "); + if (TargetResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{TargetResourceId}'''"); + } + else + { + builder.AppendLine($"'{TargetResourceId}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(GuestConfiguration), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" guestConfiguration: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(GuestConfiguration)) + { + builder.Append(" guestConfiguration: "); + BicepSerializationHelpers.AppendChildObject(builder, GuestConfiguration, options, 2, false, " guestConfiguration: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ComplianceStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" complianceStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ComplianceStatus)) + { + builder.Append(" complianceStatus: "); + builder.AppendLine($"'{ComplianceStatus.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastComplianceStatusCheckedOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastComplianceStatusChecked: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastComplianceStatusCheckedOn)) + { + builder.Append(" lastComplianceStatusChecked: "); + var formattedDateTimeString = TypeFormatters.ToString(LastComplianceStatusCheckedOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LatestReportId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" latestReportId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LatestReportId)) + { + builder.Append(" latestReportId: "); + builder.AppendLine($"'{LatestReportId.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ParameterHash), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" parameterHash: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ParameterHash)) + { + builder.Append(" parameterHash: "); + if (ParameterHash.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ParameterHash}'''"); + } + else + { + builder.AppendLine($"'{ParameterHash}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LatestAssignmentReport), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" latestAssignmentReport: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LatestAssignmentReport)) + { + builder.Append(" latestAssignmentReport: "); + BicepSerializationHelpers.AppendChildObject(builder, LatestAssignmentReport, options, 2, false, " latestAssignmentReport: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Context), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" context: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Context)) + { + builder.Append(" context: "); + if (Context.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Context}'''"); + } + else + { + builder.AppendLine($"'{Context}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AssignmentHash), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" assignmentHash: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AssignmentHash)) + { + builder.Append(" assignmentHash: "); + if (AssignmentHash.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AssignmentHash}'''"); + } + else + { + builder.AppendLine($"'{AssignmentHash}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ProvisioningState), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" provisioningState: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ProvisioningState)) + { + builder.Append(" provisioningState: "); + builder.AppendLine($"'{ProvisioningState.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ResourceType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resourceType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ResourceType)) + { + builder.Append(" resourceType: "); + if (ResourceType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ResourceType}'''"); + } + else + { + builder.AppendLine($"'{ResourceType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmssVmList), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmssVMList: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(VmssVmList)) + { + if (VmssVmList.Any()) + { + builder.Append(" vmssVMList: "); + builder.AppendLine("["); + foreach (var item in VmssVmList) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " vmssVMList: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -348,6 +594,8 @@ BinaryData IPersistableModel.Write(Model { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationAssignmentProperties)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentProperties.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentProperties.cs index 0c8272941a938..c97ea36a43083 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentProperties.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentProperties.cs @@ -84,28 +84,40 @@ internal GuestConfigurationAssignmentProperties(string targetResourceId, GuestCo } /// VM resource Id. + [WirePath("targetResourceId")] public string TargetResourceId { get; } /// The guest configuration to assign. + [WirePath("guestConfiguration")] public GuestConfigurationNavigation GuestConfiguration { get; set; } /// A value indicating compliance status of the machine for the assigned guest configuration. + [WirePath("complianceStatus")] public AssignedGuestConfigurationMachineComplianceStatus? ComplianceStatus { get; } /// Date and time when last compliance status was checked. + [WirePath("lastComplianceStatusChecked")] public DateTimeOffset? LastComplianceStatusCheckedOn { get; } /// Id of the latest report for the guest configuration assignment. + [WirePath("latestReportId")] public ResourceIdentifier LatestReportId { get; } /// parameter hash for the guest configuration assignment. + [WirePath("parameterHash")] public string ParameterHash { get; } /// Last reported guest configuration assignment report. + [WirePath("latestAssignmentReport")] public GuestConfigurationAssignmentReportInfo LatestAssignmentReport { get; set; } /// The source which initiated the guest configuration assignment. Ex: Azure Policy. + [WirePath("context")] public string Context { get; set; } /// Combined hash of the configuration package and parameters. + [WirePath("assignmentHash")] public string AssignmentHash { get; } /// The provisioning state, which only appears in the response. + [WirePath("provisioningState")] public GuestConfigurationProvisioningState? ProvisioningState { get; } /// Type of the resource - VMSS / VM. + [WirePath("resourceType")] public string ResourceType { get; } /// The list of VM Compliance data for VMSS. + [WirePath("vmssVMList")] public IList VmssVmList { get; set; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReport.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReport.Serialization.cs index da2e6c00cb37c..2a9bd7a8a2084 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReport.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReport.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -118,6 +119,74 @@ internal static GuestConfigurationAssignmentReport DeserializeGuestConfiguration return new GuestConfigurationAssignmentReport(id, name, properties, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Properties), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" properties: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Properties)) + { + builder.Append(" properties: "); + BicepSerializationHelpers.AppendChildObject(builder, Properties, options, 2, false, " properties: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -126,6 +195,8 @@ BinaryData IPersistableModel.Write(ModelRead { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationAssignmentReport)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReport.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReport.cs index 82cc6a5e3ca08..26f2dab5dc9e4 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReport.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReport.cs @@ -65,10 +65,13 @@ internal GuestConfigurationAssignmentReport(ResourceIdentifier id, string name, } /// ARM resource id of the report for the guest configuration assignment. + [WirePath("id")] public ResourceIdentifier Id { get; } /// GUID that identifies the guest configuration assignment report under a subscription, resource group. + [WirePath("name")] public string Name { get; } /// Properties of the guest configuration report. + [WirePath("properties")] public GuestConfigurationAssignmentReportProperties Properties { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportDetails.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportDetails.Serialization.cs index ac88a6146fc6c..adc6f5d5cf5ce 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportDetails.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportDetails.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -184,6 +186,121 @@ internal static GuestConfigurationAssignmentReportDetails DeserializeGuestConfig serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ComplianceStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" complianceStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ComplianceStatus)) + { + builder.Append(" complianceStatus: "); + builder.AppendLine($"'{ComplianceStatus.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartOn)) + { + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndOn)) + { + builder.Append(" endTime: "); + var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(JobId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" jobId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(JobId)) + { + builder.Append(" jobId: "); + builder.AppendLine($"'{JobId.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OperationType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" operationType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(OperationType)) + { + builder.Append(" operationType: "); + builder.AppendLine($"'{OperationType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Resources), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resources: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Resources)) + { + if (Resources.Any()) + { + builder.Append(" resources: "); + builder.AppendLine("["); + foreach (var item in Resources) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " resources: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -192,6 +309,8 @@ BinaryData IPersistableModel.Write(Mo { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationAssignmentReportDetails)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportDetails.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportDetails.cs index 0a9ca7e20bc4a..395570a406c6b 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportDetails.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportDetails.cs @@ -71,16 +71,22 @@ internal GuestConfigurationAssignmentReportDetails(AssignedGuestConfigurationMac } /// A value indicating compliance status of the machine for the assigned guest configuration. + [WirePath("complianceStatus")] public AssignedGuestConfigurationMachineComplianceStatus? ComplianceStatus { get; } /// Start date and time of the guest configuration assignment compliance status check. + [WirePath("startTime")] public DateTimeOffset? StartOn { get; } /// End date and time of the guest configuration assignment compliance status check. + [WirePath("endTime")] public DateTimeOffset? EndOn { get; } /// GUID of the report. + [WirePath("jobId")] public Guid? JobId { get; } /// Type of report, Consistency or Initial. + [WirePath("operationType")] public GuestConfigurationAssignmentReportType? OperationType { get; } /// The list of resources for which guest configuration assignment compliance is checked. + [WirePath("resources")] public IReadOnlyList Resources { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportInfo.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportInfo.Serialization.cs index 09a4202ca9186..b7411e3cc7306 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportInfo.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportInfo.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -232,6 +234,166 @@ internal static GuestConfigurationAssignmentReportInfo DeserializeGuestConfigura serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReportId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" reportId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ReportId)) + { + builder.Append(" reportId: "); + builder.AppendLine($"'{ReportId.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Assignment), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" assignment: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Assignment)) + { + builder.Append(" assignment: "); + BicepSerializationHelpers.AppendChildObject(builder, Assignment, options, 2, false, " assignment: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Vm), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vm: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Vm)) + { + builder.Append(" vm: "); + BicepSerializationHelpers.AppendChildObject(builder, Vm, options, 2, false, " vm: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartOn)) + { + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndOn)) + { + builder.Append(" endTime: "); + var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ComplianceStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" complianceStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ComplianceStatus)) + { + builder.Append(" complianceStatus: "); + builder.AppendLine($"'{ComplianceStatus.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(OperationType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" operationType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(OperationType)) + { + builder.Append(" operationType: "); + builder.AppendLine($"'{OperationType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Resources), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" resources: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Resources)) + { + if (Resources.Any()) + { + builder.Append(" resources: "); + builder.AppendLine("["); + foreach (var item in Resources) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " resources: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -240,6 +402,8 @@ BinaryData IPersistableModel.Write(Model { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationAssignmentReportInfo)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportInfo.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportInfo.cs index 1cfbdedd8cffe..10059f20f1578 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportInfo.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportInfo.cs @@ -78,22 +78,31 @@ internal GuestConfigurationAssignmentReportInfo(ResourceIdentifier id, Guid? rep } /// ARM resource id of the report for the guest configuration assignment. + [WirePath("id")] public ResourceIdentifier Id { get; } /// GUID that identifies the guest configuration assignment report under a subscription, resource group. + [WirePath("reportId")] public Guid? ReportId { get; } /// Configuration details of the guest configuration assignment. + [WirePath("assignment")] public GuestConfigurationAssignmentInfo Assignment { get; set; } /// Information about the VM. + [WirePath("vm")] public GuestConfigurationVmInfo Vm { get; set; } /// Start date and time of the guest configuration assignment compliance status check. + [WirePath("startTime")] public DateTimeOffset? StartOn { get; } /// End date and time of the guest configuration assignment compliance status check. + [WirePath("endTime")] public DateTimeOffset? EndOn { get; } /// A value indicating compliance status of the machine for the assigned guest configuration. + [WirePath("complianceStatus")] public AssignedGuestConfigurationMachineComplianceStatus? ComplianceStatus { get; } /// Type of report, Consistency or Initial. + [WirePath("operationType")] public GuestConfigurationAssignmentReportType? OperationType { get; } /// The list of resources for which guest configuration assignment compliance is checked. + [WirePath("resources")] public IList Resources { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportList.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportList.Serialization.cs index 4ce60f36b1fc5..dc2266108a663 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportList.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportList.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -102,6 +104,44 @@ internal static GuestConfigurationAssignmentReportList DeserializeGuestConfigura return new GuestConfigurationAssignmentReportList(value ?? new ChangeTrackingList(), serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(Value)) + { + if (Value.Any()) + { + builder.Append(" value: "); + builder.AppendLine("["); + foreach (var item in Value) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " value: "); + } + builder.AppendLine(" ]"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -110,6 +150,8 @@ BinaryData IPersistableModel.Write(Model { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationAssignmentReportList)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportList.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportList.cs index 07034cdaeada4..bfd93a7d39f68 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportList.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportList.cs @@ -61,6 +61,7 @@ internal GuestConfigurationAssignmentReportList(IReadOnlyList List of reports for the guest configuration. Report contains information such as compliance status, reason and more. + [WirePath("value")] public IReadOnlyList Value { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportProperties.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportProperties.Serialization.cs index 2d81de48bd084..62e8192bf2e74 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportProperties.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportProperties.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -210,6 +211,151 @@ internal static GuestConfigurationAssignmentReportProperties DeserializeGuestCon serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ComplianceStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" complianceStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ComplianceStatus)) + { + builder.Append(" complianceStatus: "); + builder.AppendLine($"'{ComplianceStatus.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ReportId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" reportId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ReportId)) + { + builder.Append(" reportId: "); + builder.AppendLine($"'{ReportId.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Assignment), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" assignment: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Assignment)) + { + builder.Append(" assignment: "); + BicepSerializationHelpers.AppendChildObject(builder, Assignment, options, 2, false, " assignment: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Vm), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vm: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Vm)) + { + builder.Append(" vm: "); + BicepSerializationHelpers.AppendChildObject(builder, Vm, options, 2, false, " vm: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(StartOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" startTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(StartOn)) + { + builder.Append(" startTime: "); + var formattedDateTimeString = TypeFormatters.ToString(StartOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(EndOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" endTime: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(EndOn)) + { + builder.Append(" endTime: "); + var formattedDateTimeString = TypeFormatters.ToString(EndOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Details), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" details: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Details)) + { + builder.Append(" details: "); + BicepSerializationHelpers.AppendChildObject(builder, Details, options, 2, false, " details: "); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmssResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmssResourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmssResourceId)) + { + builder.Append(" vmssResourceId: "); + if (VmssResourceId.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{VmssResourceId}'''"); + } + else + { + builder.AppendLine($"'{VmssResourceId}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -218,6 +364,8 @@ BinaryData IPersistableModel.Write { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationAssignmentReportProperties)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportProperties.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportProperties.cs index 0504781d5ce04..5d20fa2c4108a 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportProperties.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationAssignmentReportProperties.cs @@ -74,20 +74,28 @@ internal GuestConfigurationAssignmentReportProperties(AssignedGuestConfiguration } /// A value indicating compliance status of the machine for the assigned guest configuration. + [WirePath("complianceStatus")] public AssignedGuestConfigurationMachineComplianceStatus? ComplianceStatus { get; } /// GUID that identifies the guest configuration assignment report under a subscription, resource group. + [WirePath("reportId")] public Guid? ReportId { get; } /// Configuration details of the guest configuration assignment. + [WirePath("assignment")] public GuestConfigurationAssignmentInfo Assignment { get; } /// Information about the VM. + [WirePath("vm")] public GuestConfigurationVmInfo Vm { get; } /// Start date and time of the guest configuration assignment compliance status check. + [WirePath("startTime")] public DateTimeOffset? StartOn { get; } /// End date and time of the guest configuration assignment compliance status check. + [WirePath("endTime")] public DateTimeOffset? EndOn { get; } /// Details of the assignment report. + [WirePath("details")] public GuestConfigurationAssignmentReportDetails Details { get; } /// Azure resource Id of the VMSS. + [WirePath("vmssResourceId")] public string VmssResourceId { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationInfo.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationInfo.Serialization.cs index 5a4d2db1438b0..8589a93eb41ef 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationInfo.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationInfo.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -99,6 +100,67 @@ internal static GuestConfigurationInfo DeserializeGuestConfigurationInfo(JsonEle return new GuestConfigurationInfo(name, version, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + if (Version.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Version}'''"); + } + else + { + builder.AppendLine($"'{Version}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -107,6 +169,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpti { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationInfo)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationInfo.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationInfo.cs index 1aaa1e882e362..de2508e37be33 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationInfo.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationInfo.cs @@ -62,8 +62,10 @@ internal GuestConfigurationInfo(string name, string version, IDictionary Name of the configuration. + [WirePath("name")] public string Name { get; } /// Version of the configuration. + [WirePath("version")] public string Version { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationNavigation.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationNavigation.Serialization.cs index 0798f8ce28f4d..a54afc96521ec 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationNavigation.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationNavigation.Serialization.cs @@ -8,6 +8,8 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Linq; +using System.Text; using System.Text.Json; using Azure.Core; @@ -58,6 +60,11 @@ void IJsonModel.Write(Utf8JsonWriter writer, Model writer.WritePropertyName("contentHash"u8); writer.WriteStringValue(ContentHash); } + if (Optional.IsDefined(ContentManagedIdentity)) + { + writer.WritePropertyName("contentManagedIdentity"u8); + writer.WriteStringValue(ContentManagedIdentity); + } if (Optional.IsDefined(AssignmentType)) { if (AssignmentType != null) @@ -169,6 +176,7 @@ internal static GuestConfigurationNavigation DeserializeGuestConfigurationNaviga string version = default; Uri contentUri = default; string contentHash = default; + string contentManagedIdentity = default; GuestConfigurationAssignmentType? assignmentType = default; string assignmentSource = default; string contentType = default; @@ -213,6 +221,11 @@ internal static GuestConfigurationNavigation DeserializeGuestConfigurationNaviga contentHash = property.Value.GetString(); continue; } + if (property.NameEquals("contentManagedIdentity"u8)) + { + contentManagedIdentity = property.Value.GetString(); + continue; + } if (property.NameEquals("assignmentType"u8)) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -293,6 +306,7 @@ internal static GuestConfigurationNavigation DeserializeGuestConfigurationNaviga version, contentUri, contentHash, + contentManagedIdentity, assignmentType, assignmentSource, contentType, @@ -302,6 +316,265 @@ internal static GuestConfigurationNavigation DeserializeGuestConfigurationNaviga serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Kind), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" kind: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Kind)) + { + builder.Append(" kind: "); + builder.AppendLine($"'{Kind.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Version), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" version: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Version)) + { + builder.Append(" version: "); + if (Version.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Version}'''"); + } + else + { + builder.AppendLine($"'{Version}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentUri), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contentUri: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContentUri)) + { + builder.Append(" contentUri: "); + builder.AppendLine($"'{ContentUri.AbsoluteUri}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentHash), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contentHash: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContentHash)) + { + builder.Append(" contentHash: "); + if (ContentHash.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ContentHash}'''"); + } + else + { + builder.AppendLine($"'{ContentHash}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentManagedIdentity), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contentManagedIdentity: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContentManagedIdentity)) + { + builder.Append(" contentManagedIdentity: "); + if (ContentManagedIdentity.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ContentManagedIdentity}'''"); + } + else + { + builder.AppendLine($"'{ContentManagedIdentity}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AssignmentType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" assignmentType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AssignmentType)) + { + builder.Append(" assignmentType: "); + builder.AppendLine($"'{AssignmentType.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(AssignmentSource), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" assignmentSource: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(AssignmentSource)) + { + builder.Append(" assignmentSource: "); + if (AssignmentSource.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{AssignmentSource}'''"); + } + else + { + builder.AppendLine($"'{AssignmentSource}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ContentType), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" contentType: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ContentType)) + { + builder.Append(" contentType: "); + if (ContentType.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{ContentType}'''"); + } + else + { + builder.AppendLine($"'{ContentType}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConfigurationParameters), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" configurationParameter: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ConfigurationParameters)) + { + if (ConfigurationParameters.Any()) + { + builder.Append(" configurationParameter: "); + builder.AppendLine("["); + foreach (var item in ConfigurationParameters) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " configurationParameter: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConfigurationProtectedParameters), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" configurationProtectedParameter: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsCollectionDefined(ConfigurationProtectedParameters)) + { + if (ConfigurationProtectedParameters.Any()) + { + builder.Append(" configurationProtectedParameter: "); + builder.AppendLine("["); + foreach (var item in ConfigurationProtectedParameters) + { + BicepSerializationHelpers.AppendChildObject(builder, item, options, 4, true, " configurationProtectedParameter: "); + } + builder.AppendLine(" ]"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConfigurationSetting), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" configurationSetting: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ConfigurationSetting)) + { + builder.Append(" configurationSetting: "); + BicepSerializationHelpers.AppendChildObject(builder, ConfigurationSetting, options, 2, false, " configurationSetting: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -310,6 +583,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrit { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationNavigation)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationNavigation.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationNavigation.cs index a12e41b991e50..faa6d04ef5391 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationNavigation.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationNavigation.cs @@ -58,6 +58,7 @@ public GuestConfigurationNavigation() /// Version of the guest configuration. /// Uri of the storage where guest configuration package is uploaded. /// Combined hash of the guest configuration package and configuration parameters. + /// Managed identity with storage access of the guest configuration package and configuration parameters. /// Specifies the assignment type and execution of the configuration. Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor. /// Specifies the origin of the configuration. /// Specifies the content type of the configuration. Possible values could be Builtin or Custom. @@ -65,13 +66,14 @@ public GuestConfigurationNavigation() /// The protected configuration parameters for the guest configuration. /// The configuration setting for the guest configuration. /// Keeps track of any properties unknown to the library. - internal GuestConfigurationNavigation(GuestConfigurationKind? kind, string name, string version, Uri contentUri, string contentHash, GuestConfigurationAssignmentType? assignmentType, string assignmentSource, string contentType, IList configurationParameters, IList configurationProtectedParameters, LcmConfigurationSetting configurationSetting, IDictionary serializedAdditionalRawData) + internal GuestConfigurationNavigation(GuestConfigurationKind? kind, string name, string version, Uri contentUri, string contentHash, string contentManagedIdentity, GuestConfigurationAssignmentType? assignmentType, string assignmentSource, string contentType, IList configurationParameters, IList configurationProtectedParameters, LcmConfigurationSetting configurationSetting, IDictionary serializedAdditionalRawData) { Kind = kind; Name = name; Version = version; ContentUri = contentUri; ContentHash = contentHash; + ContentManagedIdentity = contentManagedIdentity; AssignmentType = assignmentType; AssignmentSource = assignmentSource; ContentType = contentType; @@ -82,26 +84,40 @@ internal GuestConfigurationNavigation(GuestConfigurationKind? kind, string name, } /// Kind of the guest configuration. For example:DSC. + [WirePath("kind")] public GuestConfigurationKind? Kind { get; set; } /// Name of the guest configuration. + [WirePath("name")] public string Name { get; set; } /// Version of the guest configuration. + [WirePath("version")] public string Version { get; set; } /// Uri of the storage where guest configuration package is uploaded. + [WirePath("contentUri")] public Uri ContentUri { get; set; } /// Combined hash of the guest configuration package and configuration parameters. + [WirePath("contentHash")] public string ContentHash { get; set; } + /// Managed identity with storage access of the guest configuration package and configuration parameters. + [WirePath("contentManagedIdentity")] + public string ContentManagedIdentity { get; set; } /// Specifies the assignment type and execution of the configuration. Possible values are Audit, DeployAndAutoCorrect, ApplyAndAutoCorrect and ApplyAndMonitor. + [WirePath("assignmentType")] public GuestConfigurationAssignmentType? AssignmentType { get; set; } /// Specifies the origin of the configuration. + [WirePath("assignmentSource")] public string AssignmentSource { get; } /// Specifies the content type of the configuration. Possible values could be Builtin or Custom. + [WirePath("contentType")] public string ContentType { get; } /// The configuration parameters for the guest configuration. + [WirePath("configurationParameter")] public IList ConfigurationParameters { get; } /// The protected configuration parameters for the guest configuration. + [WirePath("configurationProtectedParameter")] public IList ConfigurationProtectedParameters { get; } /// The configuration setting for the guest configuration. + [WirePath("configurationSetting")] public LcmConfigurationSetting ConfigurationSetting { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationParameter.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationParameter.Serialization.cs index 033cb40ae98b8..47b8b5ea96603 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationParameter.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationParameter.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -99,6 +100,67 @@ internal static GuestConfigurationParameter DeserializeGuestConfigurationParamet return new GuestConfigurationParameter(name, value, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Value), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" value: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Value)) + { + builder.Append(" value: "); + if (Value.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Value}'''"); + } + else + { + builder.AppendLine($"'{Value}'"); + } + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -107,6 +169,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrite { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationParameter)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationParameter.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationParameter.cs index 73d169c1b6d3b..1316414db2f2f 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationParameter.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationParameter.cs @@ -62,8 +62,10 @@ internal GuestConfigurationParameter(string name, string value, IDictionary Name of the configuration parameter. + [WirePath("name")] public string Name { get; set; } /// Value of the configuration parameter. + [WirePath("value")] public string Value { get; set; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationResourceData.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationResourceData.Serialization.cs index 7a11088db8912..ba650f9577a2a 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationResourceData.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationResourceData.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; using Azure.ResourceManager.Models; @@ -155,6 +156,89 @@ internal static GuestConfigurationResourceData DeserializeGuestConfigurationReso serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Name), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" name: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Name)) + { + builder.Append(" name: "); + if (Name.Contains(Environment.NewLine)) + { + builder.AppendLine("'''"); + builder.AppendLine($"{Name}'''"); + } + else + { + builder.AppendLine($"'{Name}'"); + } + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Location), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" location: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Location)) + { + builder.Append(" location: "); + builder.AppendLine($"'{Location.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(SystemData), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" systemData: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(SystemData)) + { + builder.Append(" systemData: "); + BicepSerializationHelpers.AppendChildObject(builder, SystemData, options, 2, false, " systemData: "); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -163,6 +247,8 @@ BinaryData IPersistableModel.Write(ModelReaderWr { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationResourceData)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationResourceData.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationResourceData.cs index 5878af21edf51..4e9e9fb2a6f19 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationResourceData.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationResourceData.cs @@ -70,14 +70,19 @@ internal GuestConfigurationResourceData(ResourceIdentifier id, string name, Azur } /// ARM resource id of the guest configuration assignment. + [WirePath("id")] public ResourceIdentifier Id { get; } /// Name of the guest configuration assignment. + [WirePath("name")] public string Name { get; set; } /// Region where the VM is located. + [WirePath("location")] public AzureLocation? Location { get; set; } /// The type of the resource. + [WirePath("type")] public ResourceType? ResourceType { get; } /// Azure Resource Manager metadata containing createdBy and modifiedBy information. + [WirePath("systemData")] public SystemData SystemData { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmInfo.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmInfo.Serialization.cs index 61e017e83a931..b1c7cbde15aa4 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmInfo.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmInfo.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -107,6 +108,51 @@ internal static GuestConfigurationVmInfo DeserializeGuestConfigurationVmInfo(Jso return new GuestConfigurationVmInfo(id, uuid, serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Id), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" id: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Id)) + { + builder.Append(" id: "); + builder.AppendLine($"'{Id.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(Uuid), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" uuid: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(Uuid)) + { + builder.Append(" uuid: "); + builder.AppendLine($"'{Uuid.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -115,6 +161,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOp { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationVmInfo)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmInfo.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmInfo.cs index fd76783272001..622dd91cceed7 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmInfo.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmInfo.cs @@ -63,8 +63,10 @@ internal GuestConfigurationVmInfo(ResourceIdentifier id, Guid? uuid, IDictionary } /// Azure resource Id of the VM. + [WirePath("id")] public ResourceIdentifier Id { get; } /// UUID(Universally Unique Identifier) of the VM. + [WirePath("uuid")] public Guid? Uuid { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmssVmInfo.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmssVmInfo.Serialization.cs index 42ec04c5b5f25..671e300527270 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmssVmInfo.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmssVmInfo.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -174,6 +175,97 @@ internal static GuestConfigurationVmssVmInfo DeserializeGuestConfigurationVmssVm serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmId)) + { + builder.Append(" vmId: "); + builder.AppendLine($"'{VmId.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(VmResourceId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" vmResourceId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(VmResourceId)) + { + builder.Append(" vmResourceId: "); + builder.AppendLine($"'{VmResourceId.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ComplianceStatus), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" complianceStatus: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ComplianceStatus)) + { + builder.Append(" complianceStatus: "); + builder.AppendLine($"'{ComplianceStatus.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LatestReportId), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" latestReportId: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LatestReportId)) + { + builder.Append(" latestReportId: "); + builder.AppendLine($"'{LatestReportId.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(LastComplianceCheckedOn), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" lastComplianceChecked: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(LastComplianceCheckedOn)) + { + builder.Append(" lastComplianceChecked: "); + var formattedDateTimeString = TypeFormatters.ToString(LastComplianceCheckedOn.Value, "o"); + builder.AppendLine($"'{formattedDateTimeString}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -182,6 +274,8 @@ BinaryData IPersistableModel.Write(ModelReaderWrit { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(GuestConfigurationVmssVmInfo)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmssVmInfo.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmssVmInfo.cs index 92236b0e9c556..6ee01f863ed6a 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmssVmInfo.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/GuestConfigurationVmssVmInfo.cs @@ -69,14 +69,19 @@ internal GuestConfigurationVmssVmInfo(Guid? vmId, ResourceIdentifier vmResourceI } /// UUID of the VM. + [WirePath("vmId")] public Guid? VmId { get; } /// Azure resource Id of the VM. + [WirePath("vmResourceId")] public ResourceIdentifier VmResourceId { get; } /// A value indicating compliance status of the machine for the assigned guest configuration. + [WirePath("complianceStatus")] public AssignedGuestConfigurationMachineComplianceStatus? ComplianceStatus { get; } /// Id of the latest report for the guest configuration assignment. + [WirePath("latestReportId")] public Guid? LatestReportId { get; } /// Date and time when last compliance status was checked. + [WirePath("lastComplianceChecked")] public DateTimeOffset? LastComplianceCheckedOn { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/LcmConfigurationSetting.Serialization.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/LcmConfigurationSetting.Serialization.cs index b5a7e6e9569d3..db55919db183c 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/LcmConfigurationSetting.Serialization.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/LcmConfigurationSetting.Serialization.cs @@ -8,6 +8,7 @@ using System; using System.ClientModel.Primitives; using System.Collections.Generic; +using System.Text; using System.Text.Json; using Azure.Core; @@ -174,6 +175,113 @@ internal static LcmConfigurationSetting DeserializeLcmConfigurationSetting(JsonE serializedAdditionalRawData); } + private BinaryData SerializeBicep(ModelReaderWriterOptions options) + { + StringBuilder builder = new StringBuilder(); + BicepModelReaderWriterOptions bicepOptions = options as BicepModelReaderWriterOptions; + IDictionary propertyOverrides = null; + bool hasObjectOverride = bicepOptions != null && bicepOptions.PropertyOverrides.TryGetValue(this, out propertyOverrides); + bool hasPropertyOverride = false; + string propertyOverride = null; + + builder.AppendLine("{"); + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConfigurationMode), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" configurationMode: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ConfigurationMode)) + { + builder.Append(" configurationMode: "); + builder.AppendLine($"'{ConfigurationMode.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(IsModuleOverwriteAllowed), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" allowModuleOverwrite: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(IsModuleOverwriteAllowed)) + { + builder.Append(" allowModuleOverwrite: "); + var boolValue = IsModuleOverwriteAllowed.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ActionAfterReboot), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" actionAfterReboot: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ActionAfterReboot)) + { + builder.Append(" actionAfterReboot: "); + builder.AppendLine($"'{ActionAfterReboot.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RefreshFrequencyInMins), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" refreshFrequencyMins: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RefreshFrequencyInMins)) + { + builder.Append(" refreshFrequencyMins: "); + builder.AppendLine($"'{RefreshFrequencyInMins.Value.ToString()}'"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(RebootIfNeeded), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" rebootIfNeeded: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(RebootIfNeeded)) + { + builder.Append(" rebootIfNeeded: "); + var boolValue = RebootIfNeeded.Value == true ? "true" : "false"; + builder.AppendLine($"{boolValue}"); + } + } + + hasPropertyOverride = hasObjectOverride && propertyOverrides.TryGetValue(nameof(ConfigurationModeFrequencyInMins), out propertyOverride); + if (hasPropertyOverride) + { + builder.Append(" configurationModeFrequencyMins: "); + builder.AppendLine(propertyOverride); + } + else + { + if (Optional.IsDefined(ConfigurationModeFrequencyInMins)) + { + builder.Append(" configurationModeFrequencyMins: "); + builder.AppendLine($"'{ConfigurationModeFrequencyInMins.Value.ToString()}'"); + } + } + + builder.AppendLine("}"); + return BinaryData.FromString(builder.ToString()); + } + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; @@ -182,6 +290,8 @@ BinaryData IPersistableModel.Write(ModelReaderWriterOpt { case "J": return ModelReaderWriter.Write(this, options); + case "bicep": + return SerializeBicep(options); default: throw new FormatException($"The model {nameof(LcmConfigurationSetting)} does not support writing '{options.Format}' format."); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/LcmConfigurationSetting.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/LcmConfigurationSetting.cs index 735e23c19c013..e0ef1b01f68e9 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/LcmConfigurationSetting.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/Models/LcmConfigurationSetting.cs @@ -70,16 +70,22 @@ internal LcmConfigurationSetting(LcmConfigurationMode? configurationMode, bool? } /// Specifies how the LCM(Local Configuration Manager) actually applies the configuration to the target nodes. Possible values are ApplyOnly, ApplyAndMonitor, and ApplyAndAutoCorrect. + [WirePath("configurationMode")] public LcmConfigurationMode? ConfigurationMode { get; } /// If true - new configurations downloaded from the pull service are allowed to overwrite the old ones on the target node. Otherwise, false. + [WirePath("allowModuleOverwrite")] public bool? IsModuleOverwriteAllowed { get; } /// Specifies what happens after a reboot during the application of a configuration. The possible values are ContinueConfiguration and StopConfiguration. + [WirePath("actionAfterReboot")] public ActionAfterReboot? ActionAfterReboot { get; } /// The time interval, in minutes, at which the LCM checks a pull service to get updated configurations. This value is ignored if the LCM is not configured in pull mode. The default value is 30. + [WirePath("refreshFrequencyMins")] public float? RefreshFrequencyInMins { get; } /// Set this to true to automatically reboot the node after a configuration that requires reboot is applied. Otherwise, you will have to manually reboot the node for any configuration that requires it. The default value is false. To use this setting when a reboot condition is enacted by something other than DSC (such as Windows Installer), combine this setting with the xPendingReboot module. + [WirePath("rebootIfNeeded")] public bool? RebootIfNeeded { get; } /// How often, in minutes, the current configuration is checked and applied. This property is ignored if the ConfigurationMode property is set to ApplyOnly. The default value is 15. + [WirePath("configurationModeFrequencyMins")] public float? ConfigurationModeFrequencyInMins { get; } } } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentReportsRestOperations.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentReportsRestOperations.cs index d926121d3e139..affb54826b751 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentReportsRestOperations.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentReportsRestOperations.cs @@ -32,7 +32,7 @@ public GuestConfigurationAssignmentReportsRestOperations(HttpPipeline pipeline, { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-01-25"; + _apiVersion = apiVersion ?? "2024-04-05"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentReportsVmssRestOperations.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentReportsVmssRestOperations.cs index 509ec42a6aa5b..54f514e2aebd6 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentReportsVmssRestOperations.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentReportsVmssRestOperations.cs @@ -32,7 +32,7 @@ public GuestConfigurationAssignmentReportsVmssRestOperations(HttpPipeline pipeli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-01-25"; + _apiVersion = apiVersion ?? "2024-04-05"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentsRestOperations.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentsRestOperations.cs index 21ea29cfd5f03..0c27f64ff8620 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentsRestOperations.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentsRestOperations.cs @@ -32,7 +32,7 @@ public GuestConfigurationAssignmentsRestOperations(HttpPipeline pipeline, string { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-01-25"; + _apiVersion = apiVersion ?? "2024-04-05"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentsVmssRestOperations.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentsVmssRestOperations.cs index 3d344f879a8bd..89c999b6f4382 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentsVmssRestOperations.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationAssignmentsVmssRestOperations.cs @@ -32,10 +32,120 @@ public GuestConfigurationAssignmentsVmssRestOperations(HttpPipeline pipeline, st { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-01-25"; + _apiVersion = apiVersion ?? "2024-04-05"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string vmssName, string name, GuestConfigurationAssignmentData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Compute/virtualMachineScaleSets/", false); + uri.AppendPath(vmssName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string vmssName, string name, GuestConfigurationAssignmentData 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.Compute/virtualMachineScaleSets/", false); + uri.AppendPath(vmssName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(name, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates an association between a VMSS and guest configuration. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine scale set. + /// Name of the guest configuration assignment. + /// Parameters supplied to the create or update guest configuration assignment. + /// 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 vmssName, string name, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmssName, nameof(vmssName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vmssName, name, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + GuestConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates an association between a VMSS and guest configuration. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine scale set. + /// Name of the guest configuration assignment. + /// Parameters supplied to the create or update guest configuration assignment. + /// 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 vmssName, string name, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmssName, nameof(vmssName)); + Argument.AssertNotNullOrEmpty(name, nameof(name)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vmssName, name, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + GuestConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string vmssName, string name) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationConnectedVMwarevSphereAssignmentsReportsRestOperations.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationConnectedVMwarevSphereAssignmentsReportsRestOperations.cs new file mode 100644 index 0000000000000..4c62782b49ce6 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationConnectedVMwarevSphereAssignmentsReportsRestOperations.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.GuestConfiguration.Models; + +namespace Azure.ResourceManager.GuestConfiguration +{ + internal partial class GuestConfigurationConnectedVMwarevSphereAssignmentsReportsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GuestConfigurationConnectedVMwarevSphereAssignmentsReportsRestOperations. + /// 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 GuestConfigurationConnectedVMwarevSphereAssignmentsReportsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-04-05"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName) + { + 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(guestConfigurationAssignmentName, true); + uri.AppendPath("/reports", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName) + { + 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(guestConfigurationAssignmentName, true); + uri.AppendPath("/reports", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all reports for the guest configuration assignment, latest report first. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// The guest 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> ListAsync(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GuestConfigurationAssignmentReportList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GuestConfigurationAssignmentReportList.DeserializeGuestConfigurationAssignmentReportList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all reports for the guest configuration assignment, latest report first. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// The guest 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 List(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GuestConfigurationAssignmentReportList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GuestConfigurationAssignmentReportList.DeserializeGuestConfigurationAssignmentReportList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName, string reportId) + { + 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(guestConfigurationAssignmentName, true); + uri.AppendPath("/reports/", false); + uri.AppendPath(reportId, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName, string reportId) + { + 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(guestConfigurationAssignmentName, true); + uri.AppendPath("/reports/", false); + uri.AppendPath(reportId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a report for the guest configuration assignment, by reportId. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// The guest configuration assignment name. + /// The GUID for the guest configuration assignment report. + /// 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 vmName, string guestConfigurationAssignmentName, string reportId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + Argument.AssertNotNullOrEmpty(reportId, nameof(reportId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName, reportId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GuestConfigurationAssignmentReport value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GuestConfigurationAssignmentReport.DeserializeGuestConfigurationAssignmentReport(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a report for the guest configuration assignment, by reportId. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// The guest configuration assignment name. + /// The GUID for the guest configuration assignment report. + /// 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 vmName, string guestConfigurationAssignmentName, string reportId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + Argument.AssertNotNullOrEmpty(reportId, nameof(reportId)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName, reportId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GuestConfigurationAssignmentReport value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GuestConfigurationAssignmentReport.DeserializeGuestConfigurationAssignmentReport(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationConnectedVMwarevSphereAssignmentsRestOperations.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationConnectedVMwarevSphereAssignmentsRestOperations.cs new file mode 100644 index 0000000000000..283ecb1f0d5f2 --- /dev/null +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationConnectedVMwarevSphereAssignmentsRestOperations.cs @@ -0,0 +1,439 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.GuestConfiguration.Models; + +namespace Azure.ResourceManager.GuestConfiguration +{ + internal partial class GuestConfigurationConnectedVMwarevSphereAssignmentsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GuestConfigurationConnectedVMwarevSphereAssignmentsRestOperations. + /// 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 GuestConfigurationConnectedVMwarevSphereAssignmentsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-04-05"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName, GuestConfigurationAssignmentData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(guestConfigurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName, GuestConfigurationAssignmentData 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(guestConfigurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Creates an association between a Connected VM Sphere machine and guest configuration. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// Name of the guest configuration assignment. + /// Parameters supplied to the create or update guest configuration assignment. + /// 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 vmName, string guestConfigurationAssignmentName, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + GuestConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Creates an association between a Connected VM Sphere machine and guest configuration. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// Name of the guest configuration assignment. + /// Parameters supplied to the create or update guest configuration assignment. + /// 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 vmName, string guestConfigurationAssignmentName, GuestConfigurationAssignmentData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + GuestConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName) + { + 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(guestConfigurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName) + { + 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(guestConfigurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get information about a guest configuration assignment. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// The guest 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 vmName, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GuestConfigurationAssignmentData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GuestConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get information about a guest configuration assignment. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// The guest 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 vmName, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GuestConfigurationAssignmentData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GuestConfigurationAssignmentData.DeserializeGuestConfigurationAssignmentData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((GuestConfigurationAssignmentData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName) + { + 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(guestConfigurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string vmName, string guestConfigurationAssignmentName) + { + 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/", false); + uri.AppendPath(guestConfigurationAssignmentName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a guest configuration assignment. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// Name of the guest configuration assignment. + /// 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 vmName, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a guest configuration assignment. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// Name of the guest configuration assignment. + /// 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 vmName, string guestConfigurationAssignmentName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + Argument.AssertNotNullOrEmpty(guestConfigurationAssignmentName, nameof(guestConfigurationAssignmentName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, vmName, guestConfigurationAssignmentName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string resourceGroupName, string vmName) + { + 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string vmName) + { + 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.ConnectedVMwarevSphere/virtualmachines/", false); + uri.AppendPath(vmName, true); + uri.AppendPath("/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all guest configuration assignments for an ARC machine. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string vmName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vmName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GuestConfigurationAssignmentList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GuestConfigurationAssignmentList.DeserializeGuestConfigurationAssignmentList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all guest configuration assignments for an ARC machine. + /// Subscription ID which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call. + /// The resource group name. + /// The name of the virtual machine. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string vmName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(vmName, nameof(vmName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, vmName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GuestConfigurationAssignmentList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GuestConfigurationAssignmentList.DeserializeGuestConfigurationAssignmentList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationHcrpAssignmentReportsRestOperations.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationHcrpAssignmentReportsRestOperations.cs index 0a211353196bf..73c34e0a7be80 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationHcrpAssignmentReportsRestOperations.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationHcrpAssignmentReportsRestOperations.cs @@ -32,7 +32,7 @@ public GuestConfigurationHcrpAssignmentReportsRestOperations(HttpPipeline pipeli { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-01-25"; + _apiVersion = apiVersion ?? "2024-04-05"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationHcrpAssignmentsRestOperations.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationHcrpAssignmentsRestOperations.cs index 2bb5a6960da56..01f96bf86ee32 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationHcrpAssignmentsRestOperations.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/Generated/RestOperations/GuestConfigurationHcrpAssignmentsRestOperations.cs @@ -32,7 +32,7 @@ public GuestConfigurationHcrpAssignmentsRestOperations(HttpPipeline pipeline, st { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-01-25"; + _apiVersion = apiVersion ?? "2024-04-05"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/autorest.md b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/autorest.md index 03446b3505937..1f3c67933922c 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/autorest.md +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/src/autorest.md @@ -8,7 +8,8 @@ azure-arm: true csharp: true library-name: GuestConfiguration namespace: Azure.ResourceManager.GuestConfiguration -require: https://github.com/Azure/azure-rest-api-specs/blob/58a1320584b1d26bf7dab969a2593cd22b39caec/specification/guestconfiguration/resource-manager/readme.md +require: https://github.com/Azure/azure-rest-api-specs/blob/6dd7b1f0b4e62d1c2d78e1fa6ab3addd032d9920/specification/guestconfiguration/resource-manager/readme.md +#tag: package-2024-04-05 output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: @@ -22,17 +23,23 @@ modelerfour: flatten-payloads: false deserialize-null-collection-as-null-value: true use-model-reader-writer: true +enable-bicep-serialization: true + +#mgmt-debug: +# show-serialized-names: true request-path-to-resource-name: /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}: GuestConfigurationVmAssignment /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}: GuestConfigurationHcrpAssignment /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{name}: GuestConfigurationVmssAssignment - + /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName}/providers/Microsoft.GuestConfiguration/guestConfigurationAssignments/{guestConfigurationAssignmentName}: GuestConfigurationVMwarevSphereAssignment + parameterized-scopes: - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachines/{vmName} - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.HybridCompute/machines/{machineName} - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/virtualMachineScaleSets/{vmssName} - +- /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ConnectedVMwarevSphere/virtualmachines/{vmName} + override-operation-name: GuestConfigurationAssignments_SubscriptionList: GetGuestConfigurationAssignments GuestConfigurationAssignments_RGList: GetGuestConfigurationAssignments diff --git a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/tests/GuestConfigurationManagementTestBase.cs b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/tests/GuestConfigurationManagementTestBase.cs index c7a14c7ee4f82..d6c49ffee340d 100644 --- a/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/tests/GuestConfigurationManagementTestBase.cs +++ b/sdk/guestconfiguration/Azure.ResourceManager.GuestConfiguration/tests/GuestConfigurationManagementTestBase.cs @@ -81,9 +81,20 @@ protected static GuestConfigurationAssignmentProperties GetDefaultGuestConfigura var configurationParameter = new GuestConfigurationParameter(); var configurationParameterList = new List() { configurationParameter }; - GuestConfigurationNavigation guestConfigurationNavigation = new(GuestConfigurationManagementUtilities.DefaultKind, GuestConfigurationManagementUtilities.DefaultAssignmentName, - GuestConfigurationManagementUtilities.DefaultAssignmentVersion, null, null, GuestConfigurationManagementUtilities.DefaultAssignmentType, - null, GuestConfigurationManagementUtilities.Builtin, configurationParameterList, configurationParameterList, null, null); + GuestConfigurationNavigation guestConfigurationNavigation = new GuestConfigurationNavigation( + GuestConfigurationManagementUtilities.DefaultKind, + GuestConfigurationManagementUtilities.DefaultAssignmentName, + GuestConfigurationManagementUtilities.DefaultAssignmentVersion, + null, + null, + null, + GuestConfigurationManagementUtilities.DefaultAssignmentType, + null, + GuestConfigurationManagementUtilities.Builtin, + configurationParameterList, + configurationParameterList, + null, + null); return new GuestConfigurationAssignmentProperties() {