|
| 1 | +import "@azure-tools/typespec-azure-core"; |
| 2 | +import "@azure-tools/typespec-azure-resource-manager"; |
| 3 | +import "@azure-tools/typespec-client-generator-core"; |
| 4 | +import "@typespec/openapi"; |
| 5 | +import "@typespec/rest"; |
| 6 | +import "./models.tsp"; |
| 7 | +import "./Connection.tsp"; |
| 8 | + |
| 9 | +using TypeSpec.Rest; |
| 10 | +using Azure.ClientGenerator.Core; |
| 11 | +using Azure.ResourceManager; |
| 12 | +using TypeSpec.Http; |
| 13 | +using TypeSpec.OpenAPI; |
| 14 | + |
| 15 | +namespace Microsoft.AzureDataTransfer; |
| 16 | +/** |
| 17 | + * The flow resource definition. |
| 18 | + */ |
| 19 | +@parentResource(Connection) |
| 20 | +model Flow is Azure.ResourceManager.TrackedResource<FlowProperties> { |
| 21 | + ...ResourceNameParameter< |
| 22 | + Resource = Flow, |
| 23 | + KeyName = "flowName", |
| 24 | + SegmentName = "flows", |
| 25 | + NamePattern = "^[a-zA-Z0-9-]{3,64}$" |
| 26 | + >; |
| 27 | + ...Azure.ResourceManager.ResourcePlanProperty; |
| 28 | + ...Azure.ResourceManager.ManagedServiceIdentityProperty; |
| 29 | +} |
| 30 | + |
| 31 | +@armResourceOperations |
| 32 | +interface Flows { |
| 33 | + /** |
| 34 | + * Gets flow resource. |
| 35 | + */ |
| 36 | + get is ArmResourceRead<Flow>; |
| 37 | + |
| 38 | + /** |
| 39 | + * Creates or updates the flow resource. |
| 40 | + */ |
| 41 | + createOrUpdate is ArmResourceCreateOrReplaceAsync<Flow>; |
| 42 | + |
| 43 | + /** |
| 44 | + * Updates the flow resource. |
| 45 | + */ |
| 46 | + #suppress "@azure-tools/typespec-azure-resource-manager/no-response-body" "Prior OpenAPI2 Json spec provides the resource back in the LRO response." |
| 47 | + @patch(#{ implicitOptionality: false }) |
| 48 | + update is ArmCustomPatchAsync< |
| 49 | + Flow, |
| 50 | + PatchModel = FlowsPatch, |
| 51 | + Response = ArmResponse<Flow> | (ArmAcceptedLroResponse & { |
| 52 | + @bodyRoot |
| 53 | + _: Flow; |
| 54 | + }) |
| 55 | + >; |
| 56 | + |
| 57 | + /** |
| 58 | + * Deletes the flow resource. |
| 59 | + */ |
| 60 | + delete is ArmResourceDeleteWithoutOkAsync<Flow>; |
| 61 | + |
| 62 | + /** |
| 63 | + * Gets flows in a connection. |
| 64 | + */ |
| 65 | + listByConnection is ArmResourceListByParent<Flow>; |
| 66 | + |
| 67 | + /** |
| 68 | + * Disables the specified flow |
| 69 | + */ |
| 70 | + disable is ArmResourceActionAsync<Flow, void, ArmResponse<Flow>>; |
| 71 | + |
| 72 | + /** |
| 73 | + * Enables the specified flow. |
| 74 | + */ |
| 75 | + enable is ArmResourceActionAsync<Flow, void, ArmResponse<Flow>>; |
| 76 | + |
| 77 | + /** |
| 78 | + * Generate a compliant passphrase for the specified flow. |
| 79 | + */ |
| 80 | + generatePassphrase is ArmResourceActionAsync<Flow, void, ArmResponse<Flow>>; |
| 81 | + |
| 82 | + /** |
| 83 | + * Get the destination endpoint ports for the specified flow. |
| 84 | + */ |
| 85 | + getDestinationEndpointPorts is ArmResourceActionSync< |
| 86 | + Flow, |
| 87 | + void, |
| 88 | + ArmResponse<GetDestinationEndpointPortsResult> |
| 89 | + >; |
| 90 | + |
| 91 | + /** |
| 92 | + * Get the destination endpoints for the specified flow. |
| 93 | + */ |
| 94 | + getDestinationEndpoints is ArmResourceActionSync< |
| 95 | + Flow, |
| 96 | + void, |
| 97 | + ArmResponse<GetDestinationEndpointsResult> |
| 98 | + >; |
| 99 | + |
| 100 | + /** |
| 101 | + * Get the source addresses for the specified flow. |
| 102 | + */ |
| 103 | + getSourceAddresses is ArmResourceActionSync< |
| 104 | + Flow, |
| 105 | + void, |
| 106 | + ArmResponse<StreamSourceAddresses> |
| 107 | + >; |
| 108 | + |
| 109 | + /** |
| 110 | + * Get the connection string for the specified flow. |
| 111 | + */ |
| 112 | + getStreamConnectionString is ArmResourceActionSync< |
| 113 | + Flow, |
| 114 | + void, |
| 115 | + ArmResponse<GetStreamConnectionStringResult> |
| 116 | + >; |
| 117 | + |
| 118 | + /** |
| 119 | + * Links the specified flow. |
| 120 | + */ |
| 121 | + link is ArmResourceActionAsync<Flow, ResourceBody, ArmResponse<Flow>>; |
| 122 | + |
| 123 | + /** |
| 124 | + * Set the destination endpoint ports for the specified flow. |
| 125 | + */ |
| 126 | + setDestinationEndpointPorts is ArmResourceActionAsync< |
| 127 | + Flow, |
| 128 | + SetDestinationEndpointPorts, |
| 129 | + ArmResponse<Flow> |
| 130 | + >; |
| 131 | + |
| 132 | + /** |
| 133 | + * Set the destination endpoints for the specified flow. |
| 134 | + */ |
| 135 | + setDestinationEndpoints is ArmResourceActionAsync< |
| 136 | + Flow, |
| 137 | + SetDestinationEndpoints, |
| 138 | + ArmResponse<Flow> |
| 139 | + >; |
| 140 | + |
| 141 | + /** |
| 142 | + * Sets the passphrase of the specified flow. |
| 143 | + */ |
| 144 | + setPassphrase is ArmResourceActionAsync< |
| 145 | + Flow, |
| 146 | + SetStreamPassphrase, |
| 147 | + ArmResponse<Flow> |
| 148 | + >; |
| 149 | + |
| 150 | + /** |
| 151 | + * Set the source addresses for the specified flow. |
| 152 | + */ |
| 153 | + setSourceAddresses is ArmResourceActionAsync< |
| 154 | + Flow, |
| 155 | + SetSourceAddresses, |
| 156 | + ArmResponse<Flow> |
| 157 | + >; |
| 158 | +} |
| 159 | + |
| 160 | +@@maxLength(Flow.name, 64); |
| 161 | +@@minLength(Flow.name, 3); |
| 162 | +@@doc(Flow.name, "The name for the flow to perform the operation on."); |
| 163 | +@@doc(Flow.properties, "Properties of flow"); |
| 164 | +@@doc(Flows.createOrUpdate::parameters.resource, "Flow body"); |
| 165 | +@@doc(Flows.update::parameters.properties, "Flow body"); |
| 166 | +@@doc(Flows.link::parameters.body, "Flow body"); |
| 167 | +@@doc(Flows.setDestinationEndpointPorts::parameters.body, |
| 168 | + "The destination endpoint ports wanted" |
| 169 | +); |
| 170 | +@@doc(Flows.setDestinationEndpoints::parameters.body, |
| 171 | + "Destination endpoints wanted." |
| 172 | +); |
| 173 | +@@doc(Flows.setPassphrase::parameters.body, "Passphrase to set"); |
| 174 | +@@doc(Flows.setSourceAddresses::parameters.body, "Source addresses wanted"); |
| 175 | +@@clientName(Flows.createOrUpdate::parameters.resource, "flow"); |
| 176 | +@@clientName(Flows.update::parameters.properties, "flow"); |
| 177 | +@@clientName(Flows.link::parameters.body, "flow"); |
| 178 | +@@clientName(Flows.setDestinationEndpointPorts::parameters.body, |
| 179 | + "streamDestinationEndpointPorts" |
| 180 | +); |
| 181 | +@@clientName(Flows.setDestinationEndpoints::parameters.body, |
| 182 | + "streamDestinationEndpoints" |
| 183 | +); |
| 184 | +@@clientName(Flows.setPassphrase::parameters.body, "passphrase"); |
| 185 | +@@clientName(Flows.setSourceAddresses::parameters.body, "sourceAddresses"); |
0 commit comments