|
| 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.HardwareSecurityModules; |
| 13 | +/** |
| 14 | + * Resource information with extended details. |
| 15 | + */ |
| 16 | +#suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-invalid-envelope-property" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 17 | +model CloudHsmCluster |
| 18 | + is Azure.ResourceManager.TrackedResource<CloudHsmClusterProperties> { |
| 19 | + ...ResourceNameParameter< |
| 20 | + Resource = CloudHsmCluster, |
| 21 | + KeyName = "cloudHsmClusterName", |
| 22 | + SegmentName = "cloudHsmClusters", |
| 23 | + NamePattern = "^[a-zA-Z0-9-]{3,23}$" |
| 24 | + >; |
| 25 | + |
| 26 | + /** |
| 27 | + * Managed service identity (system assigned and/or user assigned identities) |
| 28 | + */ |
| 29 | + identity?: Azure.ResourceManager.CommonTypes.ManagedServiceIdentity; |
| 30 | + |
| 31 | + /** |
| 32 | + * SKU details |
| 33 | + */ |
| 34 | + @visibility(Lifecycle.Read, Lifecycle.Create) |
| 35 | + sku?: CloudHsmClusterSku; |
| 36 | +} |
| 37 | + |
| 38 | +@armResourceOperations |
| 39 | +interface CloudHsmClusters { |
| 40 | + /** |
| 41 | + * Gets the specified Cloud HSM Cluster |
| 42 | + */ |
| 43 | + get is ArmResourceRead<CloudHsmCluster>; |
| 44 | + |
| 45 | + /** |
| 46 | + * Create or Update a Cloud HSM Cluster in the specified subscription. |
| 47 | + */ |
| 48 | + @Azure.Core.useFinalStateVia("original-uri") |
| 49 | + createOrUpdate is ArmResourceCreateOrReplaceAsync<CloudHsmCluster>; |
| 50 | + |
| 51 | + /** |
| 52 | + * Update a Cloud HSM Cluster in the specified subscription. |
| 53 | + */ |
| 54 | + @patch(#{ implicitOptionality: false }) |
| 55 | + update is ArmCustomPatchAsync< |
| 56 | + CloudHsmCluster, |
| 57 | + PatchModel = CloudHsmClusterPatchParameters |
| 58 | + >; |
| 59 | + |
| 60 | + /** |
| 61 | + * Deletes the specified Cloud HSM Cluster |
| 62 | + */ |
| 63 | + delete is ArmResourceDeleteWithoutOkAsync<CloudHsmCluster>; |
| 64 | + |
| 65 | + /** |
| 66 | + * The List operation gets information about the Cloud HSM Clusters associated with the subscription and within the specified resource group. |
| 67 | + */ |
| 68 | + listByResourceGroup is ArmResourceListByParent< |
| 69 | + CloudHsmCluster, |
| 70 | + Parameters = { |
| 71 | + /** |
| 72 | + * The page-continuation token to use with a paged version of this API |
| 73 | + */ |
| 74 | + @query("$skiptoken") |
| 75 | + $skiptoken?: string; |
| 76 | + } |
| 77 | + >; |
| 78 | + |
| 79 | + /** |
| 80 | + * The List operation gets information about the Cloud HSM Clusters associated with the subscription. |
| 81 | + */ |
| 82 | + listBySubscription is ArmListBySubscription< |
| 83 | + CloudHsmCluster, |
| 84 | + Parameters = { |
| 85 | + /** |
| 86 | + * The page-continuation token to use with a paged version of this API |
| 87 | + */ |
| 88 | + @query("$skiptoken") |
| 89 | + $skiptoken?: string; |
| 90 | + } |
| 91 | + >; |
| 92 | + |
| 93 | + /** |
| 94 | + * Pre Backup operation to validate whether the customer can perform a backup on the Cloud HSM Cluster resource in the specified subscription. |
| 95 | + */ |
| 96 | + #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 97 | + validateBackupProperties is ArmResourceActionAsync< |
| 98 | + CloudHsmCluster, |
| 99 | + BackupRequestProperties, |
| 100 | + ArmResponse<BackupResult> & Azure.Core.RequestIdResponseHeader, |
| 101 | + LroHeaders = ArmAsyncOperationHeader<FinalResult = BackupResult> & |
| 102 | + ArmLroLocationHeader & |
| 103 | + Azure.Core.Foundations.RetryAfterHeader & |
| 104 | + Azure.Core.RequestIdResponseHeader, |
| 105 | + OptionalRequestBody = true |
| 106 | + >; |
| 107 | + |
| 108 | + /** |
| 109 | + * Create a backup of the Cloud HSM Cluster in the specified subscription |
| 110 | + */ |
| 111 | + #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 112 | + backup is ArmResourceActionAsync< |
| 113 | + CloudHsmCluster, |
| 114 | + BackupRequestProperties, |
| 115 | + ArmResponse<BackupResult> & Azure.Core.RequestIdResponseHeader, |
| 116 | + LroHeaders = ArmAsyncOperationHeader<FinalResult = BackupResult> & |
| 117 | + ArmLroLocationHeader & |
| 118 | + Azure.Core.Foundations.RetryAfterHeader & |
| 119 | + Azure.Core.RequestIdResponseHeader, |
| 120 | + OptionalRequestBody = true |
| 121 | + >; |
| 122 | + |
| 123 | + /** |
| 124 | + * Queued validating pre restore operation |
| 125 | + */ |
| 126 | + #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 127 | + validateRestoreProperties is ArmResourceActionAsync< |
| 128 | + CloudHsmCluster, |
| 129 | + RestoreRequestProperties, |
| 130 | + ArmResponse<RestoreResult> & Azure.Core.RequestIdResponseHeader, |
| 131 | + LroHeaders = ArmAsyncOperationHeader<FinalResult = RestoreResult> & |
| 132 | + ArmLroLocationHeader & |
| 133 | + Azure.Core.Foundations.RetryAfterHeader & |
| 134 | + Azure.Core.RequestIdResponseHeader, |
| 135 | + OptionalRequestBody = true |
| 136 | + >; |
| 137 | + |
| 138 | + /** |
| 139 | + * Restores all key materials of a specified Cloud HSM Cluster |
| 140 | + */ |
| 141 | + #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 142 | + restore is ArmResourceActionAsync< |
| 143 | + CloudHsmCluster, |
| 144 | + RestoreRequestProperties, |
| 145 | + ArmResponse<RestoreResult> & Azure.Core.RequestIdResponseHeader, |
| 146 | + LroHeaders = ArmAsyncOperationHeader<FinalResult = RestoreResult> & |
| 147 | + ArmLroLocationHeader & |
| 148 | + Azure.Core.Foundations.RetryAfterHeader & |
| 149 | + Azure.Core.RequestIdResponseHeader |
| 150 | + >; |
| 151 | + |
| 152 | + /** |
| 153 | + * Gets the private link resources supported for the Cloud Hsm Cluster. |
| 154 | + */ |
| 155 | + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 156 | + @get |
| 157 | + @action("privateLinkResources") |
| 158 | + @list |
| 159 | + listByCloudHsmCluster is ArmResourceActionSync< |
| 160 | + CloudHsmCluster, |
| 161 | + void, |
| 162 | + CommonTypes.PrivateLinkResourceListResult |
| 163 | + >; |
| 164 | + |
| 165 | + /** |
| 166 | + * Gets the backup operation status of the specified Cloud HSM Cluster |
| 167 | + */ |
| 168 | + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 169 | + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 170 | + #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 171 | + @get |
| 172 | + cloudHsmClusterBackupStatusGet( |
| 173 | + ...ResourceInstanceParameters< |
| 174 | + Resource, |
| 175 | + Azure.ResourceManager.Foundations.DefaultBaseParameters<CloudHsmCluster> |
| 176 | + >, |
| 177 | + |
| 178 | + #suppress "@azure-tools/typespec-azure-core/documentation-required" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 179 | + @path |
| 180 | + @segment("cloudHsmClusters") |
| 181 | + @minLength(3) |
| 182 | + @maxLength(23) |
| 183 | + @pattern("^[a-zA-Z0-9-]{3,23}$") |
| 184 | + cloudHsmClusterName: string, |
| 185 | + |
| 186 | + /** |
| 187 | + * Identifier for the backup operation |
| 188 | + */ |
| 189 | + @path |
| 190 | + @segment("backupOperationStatus") |
| 191 | + jobId: string, |
| 192 | + ): (BackupResult & |
| 193 | + Azure.Core.RequestIdResponseHeader) | ArmAcceptedResponse<ExtraHeaders = { |
| 194 | + @header("Location") |
| 195 | + @doc("The Location header contains the URL where the status of the long running operation can be checked.") |
| 196 | + location?: string; |
| 197 | + } & Azure.Core.RequestIdResponseHeader> | ErrorResponse; |
| 198 | + /** |
| 199 | + * Gets the restore operation status of the specified Cloud HSM Cluster |
| 200 | + */ |
| 201 | + #suppress "@azure-tools/typespec-azure-core/no-openapi" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 202 | + #suppress "@azure-tools/typespec-azure-resource-manager/arm-resource-operation" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 203 | + #suppress "@azure-tools/typespec-azure-resource-manager/lro-location-header" "FIXME: Update justification, follow aka.ms/tsp/conversion-fix for details" |
| 204 | + @get |
| 205 | + cloudHsmClusterRestoreStatusGet( |
| 206 | + ...ResourceInstanceParameters< |
| 207 | + Resource, |
| 208 | + Azure.ResourceManager.Foundations.DefaultBaseParameters<CloudHsmCluster> |
| 209 | + >, |
| 210 | + |
| 211 | + /** |
| 212 | + * Name of the Cloud HSM Cluster |
| 213 | + */ |
| 214 | + @path |
| 215 | + @segment("cloudHsmClusters") |
| 216 | + @minLength(3) |
| 217 | + @maxLength(23) |
| 218 | + @pattern("^[a-zA-Z0-9-]{3,23}$") |
| 219 | + cloudHsmClusterName: string, |
| 220 | + |
| 221 | + /** |
| 222 | + * Identifier for the restore operation |
| 223 | + */ |
| 224 | + @path |
| 225 | + @segment("restoreOperationStatus") |
| 226 | + jobId: string, |
| 227 | + ): (RestoreResult & |
| 228 | + Azure.Core.RequestIdResponseHeader) | ArmAcceptedResponse<ExtraHeaders = { |
| 229 | + @header("Location") |
| 230 | + @doc("The Location header contains the URL where the status of the long running operation can be checked.") |
| 231 | + location?: string; |
| 232 | + } & Azure.Core.RequestIdResponseHeader> | ErrorResponse; |
| 233 | +} |
| 234 | + |
| 235 | +@@maxLength(CloudHsmCluster.name, 23); |
| 236 | +@@minLength(CloudHsmCluster.name, 3); |
| 237 | +@@doc(CloudHsmCluster.name, |
| 238 | + "The name of the Cloud HSM Cluster within the specified resource group. Cloud HSM Cluster names must be between 3 and 23 characters in length." |
| 239 | +); |
| 240 | +@@doc(CloudHsmCluster.properties, "Properties of the Cloud HSM Cluster"); |
| 241 | +@@doc(CloudHsmClusters.createOrUpdate::parameters.resource, |
| 242 | + "Parameters to create Cloud HSM Cluster" |
| 243 | +); |
| 244 | +@@doc(CloudHsmClusters.update::parameters.properties, |
| 245 | + "Parameters to create Cloud HSM Cluster" |
| 246 | +); |
| 247 | +@@doc(CloudHsmClusters.restore::parameters.body, |
| 248 | + "Restore Operation Required properties" |
| 249 | +); |
| 250 | +@@doc(CloudHsmClusters.validateRestoreProperties::parameters.body, |
| 251 | + "Optional Parameters to validate prior performing a restore operation." |
| 252 | +); |
| 253 | +@@doc(CloudHsmClusters.backup::parameters.body, "Azure storage Resource Uri"); |
| 254 | +@@doc(CloudHsmClusters.validateBackupProperties::parameters.body, |
| 255 | + "Backup Operation Required properties" |
| 256 | +); |
0 commit comments