|
| 1 | +import "@azure-tools/typespec-azure-core"; |
| 2 | +import "@azure-tools/typespec-azure-resource-manager"; |
| 3 | +import "@typespec/openapi"; |
| 4 | +import "@typespec/rest"; |
| 5 | +import "./models.tsp"; |
| 6 | + |
| 7 | +using TypeSpec.Rest; |
| 8 | +using Azure.ResourceManager; |
| 9 | +using TypeSpec.Http; |
| 10 | +using TypeSpec.OpenAPI; |
| 11 | + |
| 12 | +namespace Microsoft.StorageActions; |
| 13 | +/** |
| 14 | + * Represents Storage Task. |
| 15 | + */ |
| 16 | +#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 17 | +#suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 18 | +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 19 | +@Azure.ResourceManager.Private.armResourceInternal(StorageTaskProperties) |
| 20 | +@Http.Private.includeInapplicableMetadataInPayload(false) |
| 21 | +model StorageTask extends Foundations.TrackedResource { |
| 22 | + ...ResourceNameParameter< |
| 23 | + Resource = StorageTask, |
| 24 | + KeyName = "storageTaskName", |
| 25 | + SegmentName = "storageTasks", |
| 26 | + NamePattern = "^[a-z0-9]{3,18}$" |
| 27 | + >; |
| 28 | + |
| 29 | + /** |
| 30 | + * The managed service identity of the resource. |
| 31 | + */ |
| 32 | + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 33 | + identity: Azure.ResourceManager.Foundations.ManagedServiceIdentity; |
| 34 | + |
| 35 | + #suppress "@azure-tools/typespec-azure-core/no-private-usage" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 36 | + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 37 | + @doc("The resource-specific properties for this resource.") |
| 38 | + @Azure.ResourceManager.Private.armResourcePropertiesOptionality(false) |
| 39 | + properties?: StorageTaskProperties; |
| 40 | +} |
| 41 | + |
| 42 | +@armResourceOperations |
| 43 | +interface StorageTasks { |
| 44 | + /** |
| 45 | + * Get the storage task properties |
| 46 | + */ |
| 47 | + get is ArmResourceRead<StorageTask>; |
| 48 | + |
| 49 | + /** |
| 50 | + * 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. |
| 51 | + */ |
| 52 | + #suppress "@azure-tools/typespec-azure-resource-manager/arm-put-operation-response-codes" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 53 | + #suppress "@azure-tools/typespec-azure-core/invalid-final-state" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 54 | + @Azure.Core.useFinalStateVia("azure-async-operation") |
| 55 | + create is ArmResourceCreateOrReplaceAsync< |
| 56 | + StorageTask, |
| 57 | + Response = ArmResourceUpdatedResponse<StorageTask> | ArmResourceCreatedResponse< |
| 58 | + StorageTask, |
| 59 | + ArmLroLocationHeader<FinalResult = StorageTask> & |
| 60 | + Azure.Core.Foundations.RetryAfterHeader |
| 61 | + > | ArmAcceptedLroResponse |
| 62 | + >; |
| 63 | + |
| 64 | + /** |
| 65 | + * Update storage task properties |
| 66 | + */ |
| 67 | + @patch(#{ implicitOptionality: false }) |
| 68 | + update is ArmCustomPatchAsync< |
| 69 | + StorageTask, |
| 70 | + PatchModel = StorageTaskUpdateParameters, |
| 71 | + Response = ArmResourceUpdatedResponse<StorageTask> | ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader<FinalResult = StorageTask> & |
| 72 | + ArmLroLocationHeader<FinalResult = StorageTask> & |
| 73 | + Azure.Core.Foundations.RetryAfterHeader> |
| 74 | + >; |
| 75 | + |
| 76 | + /** |
| 77 | + * Delete the storage task resource. |
| 78 | + */ |
| 79 | + delete is ArmResourceDeleteWithoutOkAsync< |
| 80 | + StorageTask, |
| 81 | + Response = ArmAcceptedLroResponse<LroHeaders = ArmAsyncOperationHeader<FinalResult = StorageTask> & |
| 82 | + ArmLroLocationHeader<FinalResult = StorageTask> & |
| 83 | + Azure.Core.Foundations.RetryAfterHeader> | ArmDeletedNoContentResponse |
| 84 | + >; |
| 85 | + |
| 86 | + /** |
| 87 | + * Lists all the storage tasks available under the given resource group. |
| 88 | + */ |
| 89 | + listByResourceGroup is ArmResourceListByParent< |
| 90 | + StorageTask, |
| 91 | + Response = StorageTasksListResult |
| 92 | + >; |
| 93 | + |
| 94 | + /** |
| 95 | + * Lists all the storage tasks available under the subscription. |
| 96 | + */ |
| 97 | + listBySubscription is ArmListBySubscription< |
| 98 | + StorageTask, |
| 99 | + Response = StorageTasksListResult |
| 100 | + >; |
| 101 | + |
| 102 | + /** |
| 103 | + * Fetch the storage tasks run report summary for each assignment. |
| 104 | + */ |
| 105 | + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 106 | + @get |
| 107 | + @action("reports") |
| 108 | + @operationId("StorageTasksReport_List") |
| 109 | + list is ArmResourceActionSync< |
| 110 | + StorageTask, |
| 111 | + void, |
| 112 | + ArmResponse<StorageTaskReportSummary>, |
| 113 | + Parameters = { |
| 114 | + /** |
| 115 | + * Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. |
| 116 | + */ |
| 117 | + @query("$maxpagesize") |
| 118 | + $maxpagesize?: int32; |
| 119 | + |
| 120 | + /** |
| 121 | + * Optional. When specified, it can be used to query using reporting properties. |
| 122 | + */ |
| 123 | + @query("$filter") |
| 124 | + $filter?: string; |
| 125 | + } |
| 126 | + >; |
| 127 | + |
| 128 | + /** |
| 129 | + * Lists Resource IDs of the Storage Task Assignments associated with this Storage Task. |
| 130 | + */ |
| 131 | + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 132 | + @get |
| 133 | + @action("storageTaskAssignments") |
| 134 | + @operationId("StorageTaskAssignment_List") |
| 135 | + storageTaskAssignmentList is ArmResourceActionSync< |
| 136 | + StorageTask, |
| 137 | + void, |
| 138 | + ArmResponse<StorageTaskAssignmentsListResult>, |
| 139 | + Parameters = { |
| 140 | + /** |
| 141 | + * Optional, specifies the maximum number of Storage Task Assignment Resource IDs to be included in the list response. |
| 142 | + */ |
| 143 | + @query("$maxpagesize") |
| 144 | + $maxpagesize?: int32; |
| 145 | + } |
| 146 | + >; |
| 147 | +} |
| 148 | + |
| 149 | +@@maxLength(StorageTask.name, 18); |
| 150 | +@@minLength(StorageTask.name, 3); |
| 151 | +@@doc(StorageTask.name, |
| 152 | + "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." |
| 153 | +); |
| 154 | +@@doc(StorageTask.properties, "Properties of the storage task."); |
| 155 | +@@doc(StorageTasks.create::parameters.resource, |
| 156 | + "The parameters to create a Storage Task." |
| 157 | +); |
| 158 | +@@doc(StorageTasks.update::parameters.properties, |
| 159 | + "The parameters to provide to update the storage task resource." |
| 160 | +); |
0 commit comments