From e9b78ca9852f96f9ec99fa5adc0418694f003cf3 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Tue, 13 May 2025 05:28:38 +0000 Subject: [PATCH] CodeGen from PR 34524 in Azure/azure-rest-api-specs Merge 720e8cea4a8874759689c1d4d45b481a5527710a into c269b7b78cac2808d7acc55124a9653b2e904e4b --- sdk/storage/ci.yml | 2 + ...e.ResourceManager.StorageActions.net8.0.cs | 19 +- ...ceManager.StorageActions.netstandard2.0.cs | 19 +- .../Samples/Sample_StorageTaskResource.cs | 27 +- .../Sample_SubscriptionResourceExtensions.cs | 62 +-- .../ArmStorageActionsModelFactory.cs | 64 ++- ...kableStorageActionsSubscriptionResource.cs | 116 ++--- .../Extensions/StorageActionsExtensions.cs | 68 +-- ...TaskAssignmentsListResult.Serialization.cs | 18 +- .../StorageTaskAssignmentsListResult.cs | 19 +- .../Models/StorageTaskPatch.Serialization.cs | 4 +- .../src/Generated/Models/StorageTaskPatch.cs | 4 +- .../StorageTaskReportSummary.Serialization.cs | 18 +- .../Models/StorageTaskReportSummary.cs | 19 +- ...orageTaskUpdateProperties.Serialization.cs | 211 +++++++++ .../Models/StorageTaskUpdateProperties.cs | 85 ++++ .../StorageTasksListResult.Serialization.cs | 18 +- .../Models/StorageTasksListResult.cs | 19 +- .../StorageTaskAssignmentRestOperations.cs | 4 +- .../StorageTasksReportRestOperations.cs | 4 +- .../StorageTasksRestOperations.cs | 446 +++++++++--------- .../src/Generated/StorageTaskResource.cs | 76 +-- .../src/autorest.md | 2 +- 23 files changed, 850 insertions(+), 474 deletions(-) create mode 100644 sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskUpdateProperties.Serialization.cs create mode 100644 sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskUpdateProperties.cs diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/ diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/api/Azure.ResourceManager.StorageActions.net8.0.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/api/Azure.ResourceManager.StorageActions.net8.0.cs index b7f0f4a25c61..3f43c81d27b5 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/api/Azure.ResourceManager.StorageActions.net8.0.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/api/Azure.ResourceManager.StorageActions.net8.0.cs @@ -108,6 +108,7 @@ public static partial class ArmStorageActionsModelFactory public static Azure.ResourceManager.StorageActions.Models.StorageTaskProperties StorageTaskProperties(long? taskVersion = default(long?), bool isEnabled = false, string description = null, Azure.ResourceManager.StorageActions.Models.StorageTaskAction action = null, Azure.ResourceManager.StorageActions.Models.StorageTaskProvisioningState? provisioningState = default(Azure.ResourceManager.StorageActions.Models.StorageTaskProvisioningState?), System.DateTimeOffset? creationTimeInUtc = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.StorageActions.Models.StorageTaskReportInstance StorageTaskReportInstance(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.StorageActions.Models.StorageTaskReportProperties properties = null) { throw null; } public static Azure.ResourceManager.StorageActions.Models.StorageTaskReportProperties StorageTaskReportProperties(Azure.Core.ResourceIdentifier taskAssignmentId = null, Azure.Core.ResourceIdentifier storageAccountId = null, string startTime = null, string finishTime = null, string objectsTargetedCount = null, string objectsOperatedOnCount = null, string objectFailedCount = null, string objectsSucceededCount = null, string runStatusError = null, Azure.ResourceManager.StorageActions.Models.StorageTaskRunStatus? runStatusEnum = default(Azure.ResourceManager.StorageActions.Models.StorageTaskRunStatus?), string summaryReportPath = null, Azure.Core.ResourceIdentifier taskId = null, string taskVersion = null, Azure.ResourceManager.StorageActions.Models.StorageTaskRunResult? runResult = default(Azure.ResourceManager.StorageActions.Models.StorageTaskRunResult?)) { throw null; } + public static Azure.ResourceManager.StorageActions.Models.StorageTaskUpdateProperties StorageTaskUpdateProperties(long? taskVersion = default(long?), bool? enabled = default(bool?), string description = null, Azure.ResourceManager.StorageActions.Models.StorageTaskAction action = null, Azure.ResourceManager.StorageActions.Models.StorageTaskProvisioningState? provisioningState = default(Azure.ResourceManager.StorageActions.Models.StorageTaskProvisioningState?), System.DateTimeOffset? creationTimeInUtc = default(System.DateTimeOffset?)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MatchedBlockName : System.IEquatable @@ -227,7 +228,7 @@ public partial class StorageTaskPatch : System.ClientModel.Primitives.IJsonModel { public StorageTaskPatch() { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } - public Azure.ResourceManager.StorageActions.Models.StorageTaskProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.StorageActions.Models.StorageTaskUpdateProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.StorageActions.Models.StorageTaskPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -433,4 +434,20 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.StorageActions.Models.StorageTaskRunStatus left, Azure.ResourceManager.StorageActions.Models.StorageTaskRunStatus right) { throw null; } public override string ToString() { throw null; } } + public partial class StorageTaskUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public StorageTaskUpdateProperties() { } + public Azure.ResourceManager.StorageActions.Models.StorageTaskAction Action { get { throw null; } set { } } + public System.DateTimeOffset? CreationTimeInUtc { get { throw null; } } + public string Description { get { throw null; } set { } } + public bool? Enabled { get { throw null; } set { } } + public Azure.ResourceManager.StorageActions.Models.StorageTaskProvisioningState? ProvisioningState { get { throw null; } } + public long? TaskVersion { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.StorageActions.Models.StorageTaskUpdateProperties 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.StorageActions.Models.StorageTaskUpdateProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/api/Azure.ResourceManager.StorageActions.netstandard2.0.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/api/Azure.ResourceManager.StorageActions.netstandard2.0.cs index b7f0f4a25c61..3f43c81d27b5 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/api/Azure.ResourceManager.StorageActions.netstandard2.0.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/api/Azure.ResourceManager.StorageActions.netstandard2.0.cs @@ -108,6 +108,7 @@ public static partial class ArmStorageActionsModelFactory public static Azure.ResourceManager.StorageActions.Models.StorageTaskProperties StorageTaskProperties(long? taskVersion = default(long?), bool isEnabled = false, string description = null, Azure.ResourceManager.StorageActions.Models.StorageTaskAction action = null, Azure.ResourceManager.StorageActions.Models.StorageTaskProvisioningState? provisioningState = default(Azure.ResourceManager.StorageActions.Models.StorageTaskProvisioningState?), System.DateTimeOffset? creationTimeInUtc = default(System.DateTimeOffset?)) { throw null; } public static Azure.ResourceManager.StorageActions.Models.StorageTaskReportInstance StorageTaskReportInstance(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.StorageActions.Models.StorageTaskReportProperties properties = null) { throw null; } public static Azure.ResourceManager.StorageActions.Models.StorageTaskReportProperties StorageTaskReportProperties(Azure.Core.ResourceIdentifier taskAssignmentId = null, Azure.Core.ResourceIdentifier storageAccountId = null, string startTime = null, string finishTime = null, string objectsTargetedCount = null, string objectsOperatedOnCount = null, string objectFailedCount = null, string objectsSucceededCount = null, string runStatusError = null, Azure.ResourceManager.StorageActions.Models.StorageTaskRunStatus? runStatusEnum = default(Azure.ResourceManager.StorageActions.Models.StorageTaskRunStatus?), string summaryReportPath = null, Azure.Core.ResourceIdentifier taskId = null, string taskVersion = null, Azure.ResourceManager.StorageActions.Models.StorageTaskRunResult? runResult = default(Azure.ResourceManager.StorageActions.Models.StorageTaskRunResult?)) { throw null; } + public static Azure.ResourceManager.StorageActions.Models.StorageTaskUpdateProperties StorageTaskUpdateProperties(long? taskVersion = default(long?), bool? enabled = default(bool?), string description = null, Azure.ResourceManager.StorageActions.Models.StorageTaskAction action = null, Azure.ResourceManager.StorageActions.Models.StorageTaskProvisioningState? provisioningState = default(Azure.ResourceManager.StorageActions.Models.StorageTaskProvisioningState?), System.DateTimeOffset? creationTimeInUtc = default(System.DateTimeOffset?)) { throw null; } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct MatchedBlockName : System.IEquatable @@ -227,7 +228,7 @@ public partial class StorageTaskPatch : System.ClientModel.Primitives.IJsonModel { public StorageTaskPatch() { } public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } - public Azure.ResourceManager.StorageActions.Models.StorageTaskProperties Properties { get { throw null; } set { } } + public Azure.ResourceManager.StorageActions.Models.StorageTaskUpdateProperties Properties { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.ResourceManager.StorageActions.Models.StorageTaskPatch System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -433,4 +434,20 @@ protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer public static bool operator !=(Azure.ResourceManager.StorageActions.Models.StorageTaskRunStatus left, Azure.ResourceManager.StorageActions.Models.StorageTaskRunStatus right) { throw null; } public override string ToString() { throw null; } } + public partial class StorageTaskUpdateProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public StorageTaskUpdateProperties() { } + public Azure.ResourceManager.StorageActions.Models.StorageTaskAction Action { get { throw null; } set { } } + public System.DateTimeOffset? CreationTimeInUtc { get { throw null; } } + public string Description { get { throw null; } set { } } + public bool? Enabled { get { throw null; } set { } } + public Azure.ResourceManager.StorageActions.Models.StorageTaskProvisioningState? ProvisioningState { get { throw null; } } + public long? TaskVersion { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.StorageActions.Models.StorageTaskUpdateProperties 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.StorageActions.Models.StorageTaskUpdateProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/samples/Generated/Samples/Sample_StorageTaskResource.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/samples/Generated/Samples/Sample_StorageTaskResource.cs index cd3d55f75e82..ab942681aa2d 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/samples/Generated/Samples/Sample_StorageTaskResource.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/samples/Generated/Samples/Sample_StorageTaskResource.cs @@ -104,7 +104,9 @@ public async Task Update_PatchStorageTask() [new ResourceIdentifier("/subscriptions/1f31ba14-ce16-4281-b9b4-3e78da6e1616/resourceGroups/res4228/providers/Microsoft.ManagedIdentity/userAssignedIdentities/myUserAssignedIdentity")] = new UserAssignedIdentity() }, }, - Properties = new StorageTaskProperties(true, "My Storage task", new StorageTaskAction(new StorageTaskIfCondition("[[equals(AccessTier, 'Cool')]]", new StorageTaskOperationInfo[] + Properties = new StorageTaskUpdateProperties + { + Action = new StorageTaskAction(new StorageTaskIfCondition("[[equals(AccessTier, 'Cool')]]", new StorageTaskOperationInfo[] { new StorageTaskOperationInfo(StorageTaskOperationName.SetBlobTier) { @@ -116,13 +118,14 @@ public async Task Update_PatchStorageTask() OnFailure = OnFailureAction.Break, } })) - { - ElseOperations = {new StorageTaskOperationInfo(StorageTaskOperationName.DeleteBlob) + { + ElseOperations = {new StorageTaskOperationInfo(StorageTaskOperationName.DeleteBlob) { OnSuccess = OnSuccessAction.Continue, OnFailure = OnFailureAction.Break, }}, - }), + }, + }, }; ArmOperation lro = await storageTask.UpdateAsync(WaitUntil.Completed, patch); StorageTaskResource result = lro.Value; @@ -136,10 +139,10 @@ public async Task Update_PatchStorageTask() [Test] [Ignore("Only validating compilation of examples")] - public async Task GetStorageTaskAssignments_ListStorageTaskAssignmentsByResourceGroup() + public async Task GetStorageTasksReports_ListStorageTasksByResourceGroup() { - // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTaskAssignmentIds.json - // this example is just showing the usage of "StorageTaskAssignment_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksRunReportSummary.json + // this example is just showing the usage of "StorageTasksReport_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(); @@ -155,7 +158,7 @@ public async Task GetStorageTaskAssignments_ListStorageTaskAssignmentsByResource StorageTaskResource storageTask = client.GetStorageTaskResource(storageTaskResourceId); // invoke the operation and iterate over the result - await foreach (SubResource item in storageTask.GetStorageTaskAssignmentsAsync()) + await foreach (StorageTaskReportInstance item in storageTask.GetStorageTasksReportsAsync()) { Console.WriteLine($"Succeeded: {item}"); } @@ -165,10 +168,10 @@ public async Task GetStorageTaskAssignments_ListStorageTaskAssignmentsByResource [Test] [Ignore("Only validating compilation of examples")] - public async Task GetStorageTasksReports_ListStorageTasksByResourceGroup() + public async Task GetStorageTaskAssignments_ListStorageTaskAssignmentsByResourceGroup() { - // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksRunReportSummary.json - // this example is just showing the usage of "StorageTasksReport_List" operation, for the dependent resources, they will have to be created separately. + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTaskAssignmentIds.json + // this example is just showing the usage of "StorageTaskAssignment_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(); @@ -184,7 +187,7 @@ public async Task GetStorageTasksReports_ListStorageTasksByResourceGroup() StorageTaskResource storageTask = client.GetStorageTaskResource(storageTaskResourceId); // invoke the operation and iterate over the result - await foreach (StorageTaskReportInstance item in storageTask.GetStorageTasksReportsAsync()) + await foreach (SubResource item in storageTask.GetStorageTaskAssignmentsAsync()) { Console.WriteLine($"Succeeded: {item}"); } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index 90cc66db3db2..71a4f39364bc 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -17,37 +17,6 @@ namespace Azure.ResourceManager.StorageActions.Samples { public partial class Sample_SubscriptionResourceExtensions { - [Test] - [Ignore("Only validating compilation of examples")] - public async Task GetStorageTasks_ListStorageTasksBySubscription() - { - // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksBySubscription.json - // this example is just showing the usage of "StorageTasks_ListBySubscription" operation, for the dependent resources, they will have to be created separately. - - // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line - TokenCredential cred = new DefaultAzureCredential(); - // authenticate your client - ArmClient client = new ArmClient(cred); - - // this example assumes you already have this SubscriptionResource created on azure - // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; - ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); - SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); - - // invoke the operation and iterate over the result - await foreach (StorageTaskResource item in subscriptionResource.GetStorageTasksAsync()) - { - // 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 - StorageTaskData resourceData = item.Data; - // for demo we just print out the id - Console.WriteLine($"Succeeded on id: {resourceData.Id}"); - } - - Console.WriteLine("Succeeded"); - } - [Test] [Ignore("Only validating compilation of examples")] public async Task PreviewActions_PerformStorageTaskActionsPreview() @@ -200,5 +169,36 @@ public async Task PreviewActions_PerformStorageTaskActionsPreview() Console.WriteLine($"Succeeded: {result}"); } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetStorageTasks_ListStorageTasksBySubscription() + { + // Generated from example definition: specification/storageactions/resource-manager/Microsoft.StorageActions/stable/2023-01-01/examples/storageTasksList/ListStorageTasksBySubscription.json + // this example is just showing the usage of "StorageTasks_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "1f31ba14-ce16-4281-b9b4-3e78da6e1616"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation and iterate over the result + await foreach (StorageTaskResource item in subscriptionResource.GetStorageTasksAsync()) + { + // 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 + StorageTaskData 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/storageactions/Azure.ResourceManager.StorageActions/src/Generated/ArmStorageActionsModelFactory.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/ArmStorageActionsModelFactory.cs index 9c4f63cd75be..7d0da94defaf 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/ArmStorageActionsModelFactory.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/ArmStorageActionsModelFactory.cs @@ -16,6 +16,28 @@ namespace Azure.ResourceManager.StorageActions.Models /// Model factory for models. public static partial class ArmStorageActionsModelFactory { + /// Initializes a new instance of . + /// Name of test blob. + /// properties key value pairs to be tested for a match against the provided condition. + /// metadata key value pairs to be tested for a match against the provided condition. + /// tags key value pairs to be tested for a match against the provided condition. + /// Represents the condition block name that matched blob properties. + /// A new instance for mocking. + public static StorageTaskPreviewBlobProperties StorageTaskPreviewBlobProperties(string name = null, IEnumerable properties = null, IEnumerable metadata = null, IEnumerable tags = null, MatchedBlockName? matchedBlock = null) + { + properties ??= new List(); + metadata ??= new List(); + tags ??= new List(); + + return new StorageTaskPreviewBlobProperties( + name, + properties?.ToList(), + metadata?.ToList(), + tags?.ToList(), + matchedBlock, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -62,6 +84,26 @@ public static StorageTaskProperties StorageTaskProperties(long? taskVersion = nu serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// Storage task version. + /// Storage Task is enabled when set to true and disabled when set to false. + /// Text that describes the purpose of the storage task. + /// The storage task action that is executed. + /// Represents the provisioning state of the storage task. + /// The creation date and time of the storage task in UTC. + /// A new instance for mocking. + public static StorageTaskUpdateProperties StorageTaskUpdateProperties(long? taskVersion = null, bool? enabled = null, string description = null, StorageTaskAction action = null, StorageTaskProvisioningState? provisioningState = null, DateTimeOffset? creationTimeInUtc = null) + { + return new StorageTaskUpdateProperties( + taskVersion, + enabled, + description, + action, + provisioningState, + creationTimeInUtc, + serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The id. /// The name. @@ -115,27 +157,5 @@ public static StorageTaskReportProperties StorageTaskReportProperties(ResourceId runResult, serializedAdditionalRawData: null); } - - /// Initializes a new instance of . - /// Name of test blob. - /// properties key value pairs to be tested for a match against the provided condition. - /// metadata key value pairs to be tested for a match against the provided condition. - /// tags key value pairs to be tested for a match against the provided condition. - /// Represents the condition block name that matched blob properties. - /// A new instance for mocking. - public static StorageTaskPreviewBlobProperties StorageTaskPreviewBlobProperties(string name = null, IEnumerable properties = null, IEnumerable metadata = null, IEnumerable tags = null, MatchedBlockName? matchedBlock = null) - { - properties ??= new List(); - metadata ??= new List(); - tags ??= new List(); - - return new StorageTaskPreviewBlobProperties( - name, - properties?.ToList(), - metadata?.ToList(), - tags?.ToList(), - matchedBlock, - serializedAdditionalRawData: null); - } } } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Extensions/MockableStorageActionsSubscriptionResource.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Extensions/MockableStorageActionsSubscriptionResource.cs index b0dcbf9ccb2f..1e6564f012c9 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Extensions/MockableStorageActionsSubscriptionResource.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Extensions/MockableStorageActionsSubscriptionResource.cs @@ -43,15 +43,15 @@ private string GetApiVersionOrNull(ResourceType resourceType) } /// - /// Lists all the storage tasks available under the subscription. + /// Runs the input conditions against input object metadata properties and designates matched objects in response. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions /// /// /// Operation Id - /// StorageTasks_ListBySubscription + /// StorageTasks_PreviewActions /// /// /// Default Api Version @@ -63,25 +63,38 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// + /// The to use. + /// The parameters to preview action condition. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageTasksAsync(CancellationToken cancellationToken = default) + /// is null. + public virtual async Task> PreviewActionsAsync(AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageTaskRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageTaskRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageTaskResource(Client, StorageTaskData.DeserializeStorageTaskData(e)), StorageTaskClientDiagnostics, Pipeline, "MockableStorageActionsSubscriptionResource.GetStorageTasks", "value", "nextLink", cancellationToken); + Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); + + using var scope = StorageTaskClientDiagnostics.CreateScope("MockableStorageActionsSubscriptionResource.PreviewActions"); + scope.Start(); + try + { + var response = await StorageTaskRestClient.PreviewActionsAsync(Id.SubscriptionId, location, storageTaskPreviewAction, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Lists all the storage tasks available under the subscription. + /// Runs the input conditions against input object metadata properties and designates matched objects in response. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions /// /// /// Operation Id - /// StorageTasks_ListBySubscription + /// StorageTasks_PreviewActions /// /// /// Default Api Version @@ -93,25 +106,38 @@ public virtual AsyncPageable GetStorageTasksAsync(Cancellat /// /// /// + /// The to use. + /// The parameters to preview action condition. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageTasks(CancellationToken cancellationToken = default) + /// is null. + public virtual Response PreviewActions(AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => StorageTaskRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageTaskRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageTaskResource(Client, StorageTaskData.DeserializeStorageTaskData(e)), StorageTaskClientDiagnostics, Pipeline, "MockableStorageActionsSubscriptionResource.GetStorageTasks", "value", "nextLink", cancellationToken); + Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); + + using var scope = StorageTaskClientDiagnostics.CreateScope("MockableStorageActionsSubscriptionResource.PreviewActions"); + scope.Start(); + try + { + var response = StorageTaskRestClient.PreviewActions(Id.SubscriptionId, location, storageTaskPreviewAction, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } } /// - /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// Lists all the storage tasks available under the subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks /// /// /// Operation Id - /// StorageTasks_PreviewActions + /// StorageTasks_ListBySubscription /// /// /// Default Api Version @@ -123,38 +149,25 @@ public virtual Pageable GetStorageTasks(CancellationToken c /// /// /// - /// The location to perform preview of the actions. - /// The parameters to preview action condition. /// The cancellation token to use. - /// is null. - public virtual async Task> PreviewActionsAsync(AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageTasksAsync(CancellationToken cancellationToken = default) { - Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); - - using var scope = StorageTaskClientDiagnostics.CreateScope("MockableStorageActionsSubscriptionResource.PreviewActions"); - scope.Start(); - try - { - var response = await StorageTaskRestClient.PreviewActionsAsync(Id.SubscriptionId, location, storageTaskPreviewAction, cancellationToken).ConfigureAwait(false); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageTaskRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageTaskRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new StorageTaskResource(Client, StorageTaskData.DeserializeStorageTaskData(e)), StorageTaskClientDiagnostics, Pipeline, "MockableStorageActionsSubscriptionResource.GetStorageTasks", "value", "nextLink", cancellationToken); } /// - /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// Lists all the storage tasks available under the subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks /// /// /// Operation Id - /// StorageTasks_PreviewActions + /// StorageTasks_ListBySubscription /// /// /// Default Api Version @@ -166,26 +179,13 @@ public virtual async Task> PreviewActionsAsyn /// /// /// - /// The location to perform preview of the actions. - /// The parameters to preview action condition. /// The cancellation token to use. - /// is null. - public virtual Response PreviewActions(AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageTasks(CancellationToken cancellationToken = default) { - Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); - - using var scope = StorageTaskClientDiagnostics.CreateScope("MockableStorageActionsSubscriptionResource.PreviewActions"); - scope.Start(); - try - { - var response = StorageTaskRestClient.PreviewActions(Id.SubscriptionId, location, storageTaskPreviewAction, cancellationToken); - return response; - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => StorageTaskRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => StorageTaskRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new StorageTaskResource(Client, StorageTaskData.DeserializeStorageTaskData(e)), StorageTaskClientDiagnostics, Pipeline, "MockableStorageActionsSubscriptionResource.GetStorageTasks", "value", "nextLink", cancellationToken); } } } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Extensions/StorageActionsExtensions.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Extensions/StorageActionsExtensions.cs index 0ee458efbbe2..93dacbf87d29 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Extensions/StorageActionsExtensions.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Extensions/StorageActionsExtensions.cs @@ -146,15 +146,15 @@ public static Response GetStorageTask(this ResourceGroupRes } /// - /// Lists all the storage tasks available under the subscription. + /// Runs the input conditions against input object metadata properties and designates matched objects in response. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions /// /// /// Operation Id - /// StorageTasks_ListBySubscription + /// StorageTasks_PreviewActions /// /// /// Default Api Version @@ -167,30 +167,31 @@ public static Response GetStorageTask(this ResourceGroupRes /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// The to use. + /// The parameters to preview action condition. /// The cancellation token to use. - /// is null. - /// An async collection of that may take multiple service requests to iterate over. - public static AsyncPageable GetStorageTasksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// or is null. + public static async Task> PreviewActionsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableStorageActionsSubscriptionResource(subscriptionResource).GetStorageTasksAsync(cancellationToken); + return await GetMockableStorageActionsSubscriptionResource(subscriptionResource).PreviewActionsAsync(location, storageTaskPreviewAction, cancellationToken).ConfigureAwait(false); } /// - /// Lists all the storage tasks available under the subscription. + /// Runs the input conditions against input object metadata properties and designates matched objects in response. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions /// /// /// Operation Id - /// StorageTasks_ListBySubscription + /// StorageTasks_PreviewActions /// /// /// Default Api Version @@ -203,30 +204,31 @@ public static AsyncPageable GetStorageTasksAsync(this Subsc /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. + /// The to use. + /// The parameters to preview action condition. /// The cancellation token to use. - /// is null. - /// A collection of that may take multiple service requests to iterate over. - public static Pageable GetStorageTasks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + /// or is null. + public static Response PreviewActions(this SubscriptionResource subscriptionResource, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableStorageActionsSubscriptionResource(subscriptionResource).GetStorageTasks(cancellationToken); + return GetMockableStorageActionsSubscriptionResource(subscriptionResource).PreviewActions(location, storageTaskPreviewAction, cancellationToken); } /// - /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// Lists all the storage tasks available under the subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks /// /// /// Operation Id - /// StorageTasks_PreviewActions + /// StorageTasks_ListBySubscription /// /// /// Default Api Version @@ -239,31 +241,30 @@ public static Pageable GetStorageTasks(this SubscriptionRes /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location to perform preview of the actions. - /// The parameters to preview action condition. /// The cancellation token to use. - /// or is null. - public static async Task> PreviewActionsAsync(this SubscriptionResource subscriptionResource, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + /// is null. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetStorageTasksAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return await GetMockableStorageActionsSubscriptionResource(subscriptionResource).PreviewActionsAsync(location, storageTaskPreviewAction, cancellationToken).ConfigureAwait(false); + return GetMockableStorageActionsSubscriptionResource(subscriptionResource).GetStorageTasksAsync(cancellationToken); } /// - /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// Lists all the storage tasks available under the subscription. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/locations/{location}/previewActions + /// /subscriptions/{subscriptionId}/providers/Microsoft.StorageActions/storageTasks /// /// /// Operation Id - /// StorageTasks_PreviewActions + /// StorageTasks_ListBySubscription /// /// /// Default Api Version @@ -276,19 +277,18 @@ public static async Task> PreviewActionsAsync /// /// /// Mocking - /// To mock this method, please mock instead. + /// To mock this method, please mock instead. /// /// /// The instance the method will execute against. - /// The location to perform preview of the actions. - /// The parameters to preview action condition. /// The cancellation token to use. - /// or is null. - public static Response PreviewActions(this SubscriptionResource subscriptionResource, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + /// is null. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetStorageTasks(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) { Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); - return GetMockableStorageActionsSubscriptionResource(subscriptionResource).PreviewActions(location, storageTaskPreviewAction, cancellationToken); + return GetMockableStorageActionsSubscriptionResource(subscriptionResource).GetStorageTasks(cancellationToken); } } } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskAssignmentsListResult.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskAssignmentsListResult.Serialization.cs index b2876ef9fc72..e9efd45e929d 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskAssignmentsListResult.Serialization.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskAssignmentsListResult.Serialization.cs @@ -35,7 +35,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(StorageTaskAssignmentsListResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -48,7 +48,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -88,17 +88,13 @@ internal static StorageTaskAssignmentsListResult DeserializeStorageTaskAssignmen return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -109,7 +105,11 @@ internal static StorageTaskAssignmentsListResult DeserializeStorageTaskAssignmen } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -118,7 +118,7 @@ internal static StorageTaskAssignmentsListResult DeserializeStorageTaskAssignmen } } serializedAdditionalRawData = rawDataDictionary; - return new StorageTaskAssignmentsListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new StorageTaskAssignmentsListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskAssignmentsListResult.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskAssignmentsListResult.cs index 19e1be903a3f..35f72c2ba4e6 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskAssignmentsListResult.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskAssignmentsListResult.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.StorageActions.Models @@ -47,25 +48,31 @@ internal partial class StorageTaskAssignmentsListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal StorageTaskAssignmentsListResult() + /// List of Storage Task Assignment Resource IDs associated with this Storage Task. + internal StorageTaskAssignmentsListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . /// List of Storage Task Assignment Resource IDs associated with this Storage Task. - /// Request URL that can be used to query next page of Resource IDs. Returned when total number of requested Resource IDs exceed maximum page size. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal StorageTaskAssignmentsListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal StorageTaskAssignmentsListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Initializes a new instance of for deserialization. + internal StorageTaskAssignmentsListResult() + { + } + /// List of Storage Task Assignment Resource IDs associated with this Storage Task. public IReadOnlyList Value { get; } - /// Request URL that can be used to query next page of Resource IDs. Returned when total number of requested Resource IDs exceed maximum page size. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskPatch.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskPatch.Serialization.cs index b64d5c59c9ad..cbf53ac2df3d 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskPatch.Serialization.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskPatch.Serialization.cs @@ -96,7 +96,7 @@ internal static StorageTaskPatch DeserializeStorageTaskPatch(JsonElement element } ManagedServiceIdentity identity = default; IDictionary tags = default; - StorageTaskProperties properties = default; + StorageTaskUpdateProperties properties = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -131,7 +131,7 @@ internal static StorageTaskPatch DeserializeStorageTaskPatch(JsonElement element { continue; } - properties = StorageTaskProperties.DeserializeStorageTaskProperties(property.Value, options); + properties = StorageTaskUpdateProperties.DeserializeStorageTaskUpdateProperties(property.Value, options); continue; } if (options.Format != "W") diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskPatch.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskPatch.cs index 0e23ddec4990..de4a11f11bd7 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskPatch.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskPatch.cs @@ -57,7 +57,7 @@ public StorageTaskPatch() /// Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. /// Properties of the storage task. /// Keeps track of any properties unknown to the library. - internal StorageTaskPatch(ManagedServiceIdentity identity, IDictionary tags, StorageTaskProperties properties, IDictionary serializedAdditionalRawData) + internal StorageTaskPatch(ManagedServiceIdentity identity, IDictionary tags, StorageTaskUpdateProperties properties, IDictionary serializedAdditionalRawData) { Identity = identity; Tags = tags; @@ -70,6 +70,6 @@ internal StorageTaskPatch(ManagedServiceIdentity identity, IDictionary Gets or sets a list of key value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). A maximum of 15 tags can be provided for a resource. Each tag must have a key no greater in length than 128 characters and a value no greater in length than 256 characters. public IDictionary Tags { get; } /// Properties of the storage task. - public StorageTaskProperties Properties { get; set; } + public StorageTaskUpdateProperties Properties { get; set; } } } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskReportSummary.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskReportSummary.Serialization.cs index e18adc84d2f9..02fac16bfd0e 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskReportSummary.Serialization.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskReportSummary.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(StorageTaskReportSummary)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -47,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,17 +87,13 @@ internal static StorageTaskReportSummary DeserializeStorageTaskReportSummary(Jso return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +104,11 @@ internal static StorageTaskReportSummary DeserializeStorageTaskReportSummary(Jso } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static StorageTaskReportSummary DeserializeStorageTaskReportSummary(Jso } } serializedAdditionalRawData = rawDataDictionary; - return new StorageTaskReportSummary(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new StorageTaskReportSummary(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskReportSummary.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskReportSummary.cs index 1178abb5d99c..dd1662e7b698 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskReportSummary.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskReportSummary.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.StorageActions.Models { @@ -46,25 +47,31 @@ internal partial class StorageTaskReportSummary private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal StorageTaskReportSummary() + /// Gets storage tasks run result summary. + internal StorageTaskReportSummary(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . /// Gets storage tasks run result summary. - /// Request URL that can be used to query next page of storage task run results summary. Returned when the number of run instances and summary reports exceed maximum page size. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal StorageTaskReportSummary(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal StorageTaskReportSummary(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Initializes a new instance of for deserialization. + internal StorageTaskReportSummary() + { + } + /// Gets storage tasks run result summary. public IReadOnlyList Value { get; } - /// Request URL that can be used to query next page of storage task run results summary. Returned when the number of run instances and summary reports exceed maximum page size. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskUpdateProperties.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskUpdateProperties.Serialization.cs new file mode 100644 index 000000000000..5c3141994df0 --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskUpdateProperties.Serialization.cs @@ -0,0 +1,211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.StorageActions.Models +{ + public partial class StorageTaskUpdateProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskUpdateProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(TaskVersion)) + { + writer.WritePropertyName("taskVersion"u8); + writer.WriteNumberValue(TaskVersion.Value); + } + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Action)) + { + writer.WritePropertyName("action"u8); + writer.WriteObjectValue(Action, options); + } + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W" && Optional.IsDefined(CreationTimeInUtc)) + { + writer.WritePropertyName("creationTimeInUtc"u8); + writer.WriteStringValue(CreationTimeInUtc.Value, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + StorageTaskUpdateProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(StorageTaskUpdateProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeStorageTaskUpdateProperties(document.RootElement, options); + } + + internal static StorageTaskUpdateProperties DeserializeStorageTaskUpdateProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long? taskVersion = default; + bool? enabled = default; + string description = default; + StorageTaskAction action = default; + StorageTaskProvisioningState? provisioningState = default; + DateTimeOffset? creationTimeInUtc = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("taskVersion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + taskVersion = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("action"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + action = StorageTaskAction.DeserializeStorageTaskAction(property.Value, options); + continue; + } + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new StorageTaskProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("creationTimeInUtc"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + creationTimeInUtc = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new StorageTaskUpdateProperties( + taskVersion, + enabled, + description, + action, + provisioningState, + creationTimeInUtc, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerStorageActionsContext.Default); + default: + throw new FormatException($"The model {nameof(StorageTaskUpdateProperties)} does not support writing '{options.Format}' format."); + } + } + + StorageTaskUpdateProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeStorageTaskUpdateProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(StorageTaskUpdateProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskUpdateProperties.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskUpdateProperties.cs new file mode 100644 index 000000000000..e043b958016b --- /dev/null +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTaskUpdateProperties.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.StorageActions.Models +{ + /// Properties of the storage task. + public partial class StorageTaskUpdateProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public StorageTaskUpdateProperties() + { + } + + /// Initializes a new instance of . + /// Storage task version. + /// Storage Task is enabled when set to true and disabled when set to false. + /// Text that describes the purpose of the storage task. + /// The storage task action that is executed. + /// Represents the provisioning state of the storage task. + /// The creation date and time of the storage task in UTC. + /// Keeps track of any properties unknown to the library. + internal StorageTaskUpdateProperties(long? taskVersion, bool? enabled, string description, StorageTaskAction action, StorageTaskProvisioningState? provisioningState, DateTimeOffset? creationTimeInUtc, IDictionary serializedAdditionalRawData) + { + TaskVersion = taskVersion; + Enabled = enabled; + Description = description; + Action = action; + ProvisioningState = provisioningState; + CreationTimeInUtc = creationTimeInUtc; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Storage task version. + public long? TaskVersion { get; } + /// Storage Task is enabled when set to true and disabled when set to false. + public bool? Enabled { get; set; } + /// Text that describes the purpose of the storage task. + public string Description { get; set; } + /// The storage task action that is executed. + public StorageTaskAction Action { get; set; } + /// Represents the provisioning state of the storage task. + public StorageTaskProvisioningState? ProvisioningState { get; } + /// The creation date and time of the storage task in UTC. + public DateTimeOffset? CreationTimeInUtc { get; } + } +} diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTasksListResult.Serialization.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTasksListResult.Serialization.cs index 16590b02784f..d047513885ff 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTasksListResult.Serialization.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTasksListResult.Serialization.cs @@ -34,7 +34,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit throw new FormatException($"The model {nameof(StorageTasksListResult)} does not support writing '{format}' format."); } - if (options.Format != "W" && Optional.IsCollectionDefined(Value)) + if (options.Format != "W") { writer.WritePropertyName("value"u8); writer.WriteStartArray(); @@ -47,7 +47,7 @@ protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWrit if (options.Format != "W" && Optional.IsDefined(NextLink)) { writer.WritePropertyName("nextLink"u8); - writer.WriteStringValue(NextLink); + writer.WriteStringValue(NextLink.AbsoluteUri); } if (options.Format != "W" && _serializedAdditionalRawData != null) { @@ -87,17 +87,13 @@ internal static StorageTasksListResult DeserializeStorageTasksListResult(JsonEle return null; } IReadOnlyList value = default; - string nextLink = default; + Uri nextLink = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } List array = new List(); foreach (var item in property.Value.EnumerateArray()) { @@ -108,7 +104,11 @@ internal static StorageTasksListResult DeserializeStorageTasksListResult(JsonEle } if (property.NameEquals("nextLink"u8)) { - nextLink = property.Value.GetString(); + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); continue; } if (options.Format != "W") @@ -117,7 +117,7 @@ internal static StorageTasksListResult DeserializeStorageTasksListResult(JsonEle } } serializedAdditionalRawData = rawDataDictionary; - return new StorageTasksListResult(value ?? new ChangeTrackingList(), nextLink, serializedAdditionalRawData); + return new StorageTasksListResult(value, nextLink, serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTasksListResult.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTasksListResult.cs index 7c2703a29464..2d5b31665a71 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTasksListResult.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/Models/StorageTasksListResult.cs @@ -7,6 +7,7 @@ using System; using System.Collections.Generic; +using System.Linq; namespace Azure.ResourceManager.StorageActions.Models { @@ -46,25 +47,31 @@ internal partial class StorageTasksListResult private IDictionary _serializedAdditionalRawData; /// Initializes a new instance of . - internal StorageTasksListResult() + /// Gets the list of storage tasks and their properties. + internal StorageTasksListResult(IEnumerable value) { - Value = new ChangeTrackingList(); + Value = value.ToList(); } /// Initializes a new instance of . /// Gets the list of storage tasks and their properties. - /// Request URL that can be used to query next page of storage tasks. Returned when total number of requested storage tasks exceed maximum page size. + /// The link to the next page of items. /// Keeps track of any properties unknown to the library. - internal StorageTasksListResult(IReadOnlyList value, string nextLink, IDictionary serializedAdditionalRawData) + internal StorageTasksListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) { Value = value; NextLink = nextLink; _serializedAdditionalRawData = serializedAdditionalRawData; } + /// Initializes a new instance of for deserialization. + internal StorageTasksListResult() + { + } + /// Gets the list of storage tasks and their properties. public IReadOnlyList Value { get; } - /// Request URL that can be used to query next page of storage tasks. Returned when total number of requested storage tasks exceed maximum page size. - public string NextLink { get; } + /// The link to the next page of items. + public Uri NextLink { get; } } } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTaskAssignmentRestOperations.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTaskAssignmentRestOperations.cs index fcf0dd60f326..9ad47c3ea18e 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTaskAssignmentRestOperations.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTaskAssignmentRestOperations.cs @@ -47,11 +47,11 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); uri.AppendPath(storageTaskName, true); uri.AppendPath("/storageTaskAssignments", false); + uri.AppendQuery("api-version", _apiVersion, true); if (maxpagesize != null) { uri.AppendQuery("$maxpagesize", maxpagesize.Value, true); } - uri.AppendQuery("api-version", _apiVersion, true); return uri; } @@ -69,11 +69,11 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); uri.AppendPath(storageTaskName, true); uri.AppendPath("/storageTaskAssignments", false); + uri.AppendQuery("api-version", _apiVersion, true); if (maxpagesize != null) { uri.AppendQuery("$maxpagesize", maxpagesize.Value, true); } - uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTasksReportRestOperations.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTasksReportRestOperations.cs index 3476ce108595..6cfa0c3ab73a 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTasksReportRestOperations.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTasksReportRestOperations.cs @@ -47,6 +47,7 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); uri.AppendPath(storageTaskName, true); uri.AppendPath("/reports", false); + uri.AppendQuery("api-version", _apiVersion, true); if (maxpagesize != null) { uri.AppendQuery("$maxpagesize", maxpagesize.Value, true); @@ -55,7 +56,6 @@ internal RequestUriBuilder CreateListRequestUri(string subscriptionId, string re { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", _apiVersion, true); return uri; } @@ -73,6 +73,7 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); uri.AppendPath(storageTaskName, true); uri.AppendPath("/reports", false); + uri.AppendQuery("api-version", _apiVersion, true); if (maxpagesize != null) { uri.AppendQuery("$maxpagesize", maxpagesize.Value, true); @@ -81,7 +82,6 @@ internal HttpMessage CreateListRequest(string subscriptionId, string resourceGro { uri.AppendQuery("$filter", filter, true); } - uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); _userAgent.Apply(message); diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTasksRestOperations.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTasksRestOperations.cs index f3369c6b8251..c23dda64e900 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTasksRestOperations.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/RestOperations/StorageTasksRestOperations.cs @@ -36,127 +36,119 @@ public StorageTasksRestOperations(HttpPipeline pipeline, string applicationId, U _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } - internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data) + internal RequestUriBuilder CreatePreviewActionsRequestUri(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction) { 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.StorageActions/storageTasks/", false); - uri.AppendPath(storageTaskName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/previewActions", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data) + internal HttpMessage CreatePreviewActionsRequest(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/resourceGroups/", false); - uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); - uri.AppendPath(storageTaskName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/locations/", false); + uri.AppendPath(location, true); + uri.AppendPath("/previewActions", false); 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); + content.JsonWriter.WriteObjectValue(storageTaskPreviewAction, ModelSerializationExtensions.WireOptions); request.Content = content; _userAgent.Apply(message); return message; } - /// Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + /// Runs the input conditions against input object metadata properties and designates matched objects in response. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. - /// The parameters to create a Storage Task. + /// The to use. + /// The parameters to preview action condition. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public async Task CreateAsync(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> PreviewActionsAsync(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, storageTaskName, data); + using var message = CreatePreviewActionsRequest(subscriptionId, location, storageTaskPreviewAction); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 201: - case 202: - return message.Response; + { + StorageTaskPreviewAction value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = StorageTaskPreviewAction.DeserializeStorageTaskPreviewAction(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. + /// Runs the input conditions against input object metadata properties and designates matched objects in response. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. - /// The parameters to create a Storage Task. + /// The to use. + /// The parameters to preview action condition. /// The cancellation token to use. - /// , , or is null. - /// , or is an empty string, and was expected to be non-empty. - public Response Create(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response PreviewActions(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); - Argument.AssertNotNull(data, nameof(data)); + Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); - using var message = CreateCreateRequest(subscriptionId, resourceGroupName, storageTaskName, data); + using var message = CreatePreviewActionsRequest(subscriptionId, location, storageTaskPreviewAction); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 201: - case 202: - return message.Response; + { + StorageTaskPreviewAction value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = StorageTaskPreviewAction.DeserializeStorageTaskPreviewAction(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName) + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) { 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.StorageActions/storageTasks/", false); - uri.AppendPath(storageTaskName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string storageTaskName) + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + 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.StorageActions/storageTasks/", false); - uri.AppendPath(storageTaskName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -164,57 +156,57 @@ internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceG return message; } - /// Delete the storage task resource. + /// Lists all the storage tasks available under the subscription. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. /// 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 storageTaskName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, storageTaskName); + using var message = CreateListBySubscriptionRequest(subscriptionId); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 202: - case 204: - return message.Response; + case 200: + { + StorageTasksListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - /// Delete the storage task resource. + /// Lists all the storage tasks available under the subscription. /// The ID of the target subscription. The value must be an UUID. - /// The name of the resource group. The name is case insensitive. - /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. /// 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 storageTaskName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); - using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, storageTaskName); + using var message = CreateListBySubscriptionRequest(subscriptionId); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 202: - case 204: - return message.Response; + case 200: + { + StorageTasksListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName) + internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -222,13 +214,12 @@ internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string res uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); - uri.AppendPath(storageTaskName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string storageTaskName) + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) { var message = _pipeline.CreateMessage(); var request = message.Request; @@ -239,8 +230,7 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); - uri.AppendPath(storageTaskName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); @@ -248,69 +238,61 @@ internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGrou return message; } - /// Get the storage task properties. + /// Lists all the storage tasks available under the given resource group. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. /// 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 storageTaskName, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, storageTaskName); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: { - StorageTaskData value = default; + StorageTasksListResult value = default; using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StorageTaskData.DeserializeStorageTaskData(document.RootElement); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((StorageTaskData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Get the storage task properties. + /// Lists all the storage tasks available under the given resource group. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. - /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. /// 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 storageTaskName, CancellationToken cancellationToken = default) + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); - Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); - using var message = CreateGetRequest(subscriptionId, resourceGroupName, storageTaskName); + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: { - StorageTaskData value = default; + StorageTasksListResult value = default; using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StorageTaskData.DeserializeStorageTaskData(document.RootElement); + value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); return Response.FromValue(value, message.Response); } - case 404: - return Response.FromValue((StorageTaskData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch) + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -324,11 +306,11 @@ internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string return uri; } - internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch) + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string storageTaskName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Patch; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); @@ -340,147 +322,167 @@ internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceG uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Update storage task properties. + /// Get the storage task properties. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. - /// The parameters to provide to update the storage task resource. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch, CancellationToken cancellationToken = default) + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string storageTaskName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); - Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, storageTaskName, patch); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, storageTaskName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + StorageTaskData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = StorageTaskData.DeserializeStorageTaskData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((StorageTaskData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - /// Update storage task properties. + /// Get the storage task properties. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. - /// The parameters to provide to update the storage task resource. /// The cancellation token to use. - /// , , or is null. + /// , or is null. /// , or is an empty string, and was expected to be non-empty. - public Response Update(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch, CancellationToken cancellationToken = default) + public Response Get(string subscriptionId, string resourceGroupName, string storageTaskName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); - Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, storageTaskName, patch); + using var message = CreateGetRequest(subscriptionId, resourceGroupName, storageTaskName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - case 202: - return message.Response; + { + StorageTaskData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = StorageTaskData.DeserializeStorageTaskData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((StorageTaskData)null, message.Response); default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, 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; } - /// Lists all the storage tasks available under the subscription. + /// Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The parameters to create a Storage Task. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateListBySubscriptionRequest(subscriptionId); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, storageTaskName, data); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - StorageTasksListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 201: + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Lists all the storage tasks available under the subscription. + /// Asynchronously creates a new storage task resource with the specified parameters. If a storage task is already created and a subsequent create request is issued with different properties, the storage task properties will be updated. If a storage task is already created and a subsequent create or update request is issued with the exact same set of properties, the request will succeed. /// The ID of the target subscription. The value must be an UUID. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The parameters to create a Storage Task. /// The cancellation token to use. - /// is null. - /// is an empty string, and was expected to be non-empty. - public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskData data, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + Argument.AssertNotNull(data, nameof(data)); - using var message = CreateListBySubscriptionRequest(subscriptionId); + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, storageTaskName, data); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - StorageTasksListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 201: + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscriptionId, string resourceGroupName) + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); @@ -488,171 +490,169 @@ internal RequestUriBuilder CreateListByResourceGroupRequestUri(string subscripti uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); uri.AppendPath("/resourceGroups/", false); uri.AppendPath(resourceGroupName, true); - uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks", false); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch, ModelSerializationExtensions.WireOptions); + request.Content = content; _userAgent.Apply(message); return message; } - /// Lists all the storage tasks available under the given resource group. + /// Update storage task properties. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The parameters to provide to update the storage task resource. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, storageTaskName, patch); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { case 200: - { - StorageTasksListResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Lists all the storage tasks available under the given resource group. + /// Update storage task properties. /// The ID of the target subscription. The value must be an UUID. /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. + /// The parameters to provide to update the storage task resource. /// The cancellation token to use. - /// or is null. - /// or is an empty string, and was expected to be non-empty. - public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string storageTaskName, StorageTaskPatch patch, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); + Argument.AssertNotNull(patch, nameof(patch)); - using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, storageTaskName, patch); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { case 200: - { - StorageTasksListResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StorageTasksListResult.DeserializeStorageTasksListResult(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + return message.Response; default: throw new RequestFailedException(message.Response); } } - internal RequestUriBuilder CreatePreviewActionsRequestUri(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction) + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string resourceGroupName, string storageTaskName) { var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.StorageActions/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/previewActions", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, true); uri.AppendQuery("api-version", _apiVersion, true); return uri; } - internal HttpMessage CreatePreviewActionsRequest(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction) + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string storageTaskName) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Post; + request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); uri.AppendPath("/subscriptions/", false); uri.AppendPath(subscriptionId, true); - uri.AppendPath("/providers/Microsoft.StorageActions/locations/", false); - uri.AppendPath(location, true); - uri.AppendPath("/previewActions", false); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.StorageActions/storageTasks/", false); + uri.AppendPath(storageTaskName, 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(storageTaskPreviewAction, ModelSerializationExtensions.WireOptions); - request.Content = content; _userAgent.Apply(message); return message; } - /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// Delete the storage task resource. /// The ID of the target subscription. The value must be an UUID. - /// The location to perform preview of the actions. - /// The parameters to preview action condition. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public async Task> PreviewActionsAsync(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string storageTaskName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); - using var message = CreatePreviewActionsRequest(subscriptionId, location, storageTaskPreviewAction); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, storageTaskName); await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); switch (message.Response.Status) { - case 200: - { - StorageTaskPreviewAction value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); - value = StorageTaskPreviewAction.DeserializeStorageTaskPreviewAction(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } } - /// Runs the input conditions against input object metadata properties and designates matched objects in response. + /// Delete the storage task resource. /// The ID of the target subscription. The value must be an UUID. - /// The location to perform preview of the actions. - /// The parameters to preview action condition. + /// The name of the resource group. The name is case insensitive. + /// The name of the storage task within the specified resource group. Storage task names must be between 3 and 18 characters in length and use numbers and lower-case letters only. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - public Response PreviewActions(string subscriptionId, AzureLocation location, StorageTaskPreviewAction storageTaskPreviewAction, CancellationToken cancellationToken = default) + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string storageTaskName, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); - Argument.AssertNotNull(storageTaskPreviewAction, nameof(storageTaskPreviewAction)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(storageTaskName, nameof(storageTaskName)); - using var message = CreatePreviewActionsRequest(subscriptionId, location, storageTaskPreviewAction); + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, storageTaskName); _pipeline.Send(message, cancellationToken); switch (message.Response.Status) { - case 200: - { - StorageTaskPreviewAction value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); - value = StorageTaskPreviewAction.DeserializeStorageTaskPreviewAction(document.RootElement); - return Response.FromValue(value, message.Response); - } + case 202: + case 204: + return message.Response; default: throw new RequestFailedException(message.Response); } diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/StorageTaskResource.cs b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/StorageTaskResource.cs index 75eb0394280a..d6308aa43d05 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/StorageTaskResource.cs +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/Generated/StorageTaskResource.cs @@ -40,10 +40,10 @@ public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, private readonly ClientDiagnostics _storageTaskClientDiagnostics; private readonly StorageTasksRestOperations _storageTaskRestClient; - private readonly ClientDiagnostics _storageTaskAssignmentClientDiagnostics; - private readonly StorageTaskAssignmentRestOperations _storageTaskAssignmentRestClient; private readonly ClientDiagnostics _storageTasksReportClientDiagnostics; private readonly StorageTasksReportRestOperations _storageTasksReportRestClient; + private readonly ClientDiagnostics _storageTaskAssignmentClientDiagnostics; + private readonly StorageTaskAssignmentRestOperations _storageTaskAssignmentRestClient; private readonly StorageTaskData _data; /// Gets the resource type for the operations. @@ -71,10 +71,10 @@ internal StorageTaskResource(ArmClient client, ResourceIdentifier id) : base(cli _storageTaskClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StorageActions", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string storageTaskApiVersion); _storageTaskRestClient = new StorageTasksRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, storageTaskApiVersion); - _storageTaskAssignmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StorageActions", ProviderConstants.DefaultProviderNamespace, Diagnostics); - _storageTaskAssignmentRestClient = new StorageTaskAssignmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); _storageTasksReportClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StorageActions", ProviderConstants.DefaultProviderNamespace, Diagnostics); _storageTasksReportRestClient = new StorageTasksReportRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _storageTaskAssignmentClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.StorageActions", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _storageTaskAssignmentRestClient = new StorageTaskAssignmentRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -358,15 +358,15 @@ public virtual ArmOperation Update(WaitUntil waitUntil, Sto } /// - /// Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. + /// Fetch the storage tasks run report summary for each assignment. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports /// /// /// Operation Id - /// StorageTaskAssignment_List + /// StorageTasksReport_List /// /// /// Default Api Version @@ -375,25 +375,26 @@ public virtual ArmOperation Update(WaitUntil waitUntil, Sto /// /// /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// Optional. When specified, it can be used to query using reporting properties. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageTaskAssignmentsAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageTasksReportsAsync(int? maxpagesize = null, string filter = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTaskAssignmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTaskAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), _storageTaskAssignmentClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTaskAssignments", "value", "nextLink", maxpagesize, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTasksReportRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTasksReportRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, filter); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => StorageTaskReportInstance.DeserializeStorageTaskReportInstance(e), _storageTasksReportClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTasksReports", "value", "nextLink", maxpagesize, cancellationToken); } /// - /// Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. + /// Fetch the storage tasks run report summary for each assignment. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports /// /// /// Operation Id - /// StorageTaskAssignment_List + /// StorageTasksReport_List /// /// /// Default Api Version @@ -402,25 +403,26 @@ public virtual AsyncPageable GetStorageTaskAssignmentsAsync(int? ma /// /// /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. + /// Optional. When specified, it can be used to query using reporting properties. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageTaskAssignments(int? maxpagesize = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageTasksReports(int? maxpagesize = null, string filter = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTaskAssignmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTaskAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), _storageTaskAssignmentClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTaskAssignments", "value", "nextLink", maxpagesize, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTasksReportRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, filter); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTasksReportRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, filter); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => StorageTaskReportInstance.DeserializeStorageTaskReportInstance(e), _storageTasksReportClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTasksReports", "value", "nextLink", maxpagesize, cancellationToken); } /// - /// Fetch the storage tasks run report summary for each assignment. + /// Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments /// /// /// Operation Id - /// StorageTasksReport_List + /// StorageTaskAssignment_List /// /// /// Default Api Version @@ -429,26 +431,25 @@ public virtual Pageable GetStorageTaskAssignments(int? maxpagesize /// /// /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. - /// Optional. When specified, it can be used to query using reporting properties. /// The cancellation token to use. - /// An async collection of that may take multiple service requests to iterate over. - public virtual AsyncPageable GetStorageTasksReportsAsync(int? maxpagesize = null, string filter = null, CancellationToken cancellationToken = default) + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetStorageTaskAssignmentsAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTasksReportRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTasksReportRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, filter); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => StorageTaskReportInstance.DeserializeStorageTaskReportInstance(e), _storageTasksReportClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTasksReports", "value", "nextLink", maxpagesize, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTaskAssignmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTaskAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), _storageTaskAssignmentClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTaskAssignments", "value", "nextLink", maxpagesize, cancellationToken); } /// - /// Fetch the storage tasks run report summary for each assignment. + /// Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. /// /// /// Request Path - /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/reports + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageActions/storageTasks/{storageTaskName}/storageTaskAssignments /// /// /// Operation Id - /// StorageTasksReport_List + /// StorageTaskAssignment_List /// /// /// Default Api Version @@ -457,14 +458,13 @@ public virtual AsyncPageable GetStorageTasksReportsAs /// /// /// Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. - /// Optional. When specified, it can be used to query using reporting properties. /// The cancellation token to use. - /// A collection of that may take multiple service requests to iterate over. - public virtual Pageable GetStorageTasksReports(int? maxpagesize = null, string filter = null, CancellationToken cancellationToken = default) + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetStorageTaskAssignments(int? maxpagesize = null, CancellationToken cancellationToken = default) { - HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTasksReportRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, filter); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTasksReportRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint, filter); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => StorageTaskReportInstance.DeserializeStorageTaskReportInstance(e), _storageTasksReportClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTasksReports", "value", "nextLink", maxpagesize, cancellationToken); + HttpMessage FirstPageRequest(int? pageSizeHint) => _storageTaskAssignmentRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _storageTaskAssignmentRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name, pageSizeHint); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => JsonSerializer.Deserialize(e.GetRawText()), _storageTaskAssignmentClientDiagnostics, Pipeline, "StorageTaskResource.GetStorageTaskAssignments", "value", "nextLink", maxpagesize, cancellationToken); } /// diff --git a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/autorest.md b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/autorest.md index 8b43b578109c..196e6cacd943 100644 --- a/sdk/storageactions/Azure.ResourceManager.StorageActions/src/autorest.md +++ b/sdk/storageactions/Azure.ResourceManager.StorageActions/src/autorest.md @@ -7,7 +7,7 @@ azure-arm: true csharp: true library-name: StorageActions namespace: Azure.ResourceManager.StorageActions -require: https://github.com/Azure/azure-rest-api-specs/blob/c3a3fd40087fde8e462a210bc086f26877aa1a78/specification/storageactions/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/storageactions/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: