From 8e2742b270fdebdc0a97fde556227adf81bdbe95 Mon Sep 17 00:00:00 2001 From: Ashen Gunaratne Date: Wed, 29 Nov 2023 19:45:55 +0530 Subject: [PATCH] [azurerm_data_factory_flowlet_data_flow] Optional source and sink properties (#23987) --- .../datafactory/data_factory_data_flow.go | 282 +++++++++--------- ...data_factory_flowlet_data_flow_resource.go | 4 +- ...ta_factory_flowlet_data_flow.html.markdown | 4 +- 3 files changed, 151 insertions(+), 139 deletions(-) diff --git a/internal/services/datafactory/data_factory_data_flow.go b/internal/services/datafactory/data_factory_data_flow.go index d4818e90c718..29b12dbc1de9 100644 --- a/internal/services/datafactory/data_factory_data_flow.go +++ b/internal/services/datafactory/data_factory_data_flow.go @@ -14,142 +14,15 @@ func SchemaForDataFlowSourceAndSink() *pluginsdk.Schema { return &pluginsdk.Schema{ Type: pluginsdk.TypeList, Required: true, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "description": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "dataset": { - Type: pluginsdk.TypeList, - Optional: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "parameters": { - Type: pluginsdk.TypeMap, - Optional: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - }, - }, - }, - - "flowlet": { - Type: pluginsdk.TypeList, - Optional: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "parameters": { - Type: pluginsdk.TypeMap, - Optional: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - - "dataset_parameters": { - Type: pluginsdk.TypeString, - Optional: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - }, - }, - }, - - "linked_service": { - Type: pluginsdk.TypeList, - Optional: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "parameters": { - Type: pluginsdk.TypeMap, - Optional: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - }, - }, - }, - - "rejected_linked_service": { - Type: pluginsdk.TypeList, - Optional: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsNotEmpty, - }, - - "parameters": { - Type: pluginsdk.TypeMap, - Optional: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - }, - }, - }, - - "schema_linked_service": { - Type: pluginsdk.TypeList, - Optional: true, - MaxItems: 1, - Elem: &pluginsdk.Resource{ - Schema: map[string]*pluginsdk.Schema{ - "name": { - Type: pluginsdk.TypeString, - Required: true, - ValidateFunc: validation.StringIsNotEmpty, - }, + Elem: resourceSourceAndSink(), + } +} - "parameters": { - Type: pluginsdk.TypeMap, - Optional: true, - Elem: &pluginsdk.Schema{ - Type: pluginsdk.TypeString, - }, - }, - }, - }, - }, - }, - }, +func SchemaForDataFlowletSourceAndSink() *pluginsdk.Schema { + return &pluginsdk.Schema{ + Type: pluginsdk.TypeList, + Optional: true, + Elem: resourceSourceAndSink(), } } @@ -485,3 +358,142 @@ func flattenDataFactoryDataFlowReference(input *datafactory.DataFlowReference) [ }, } } + +func resourceSourceAndSink() *pluginsdk.Resource { + return &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "description": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "dataset": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "parameters": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + }, + }, + }, + + "flowlet": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "parameters": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + + "dataset_parameters": { + Type: pluginsdk.TypeString, + Optional: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + }, + }, + }, + + "linked_service": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "parameters": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + }, + }, + }, + + "rejected_linked_service": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "parameters": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + }, + }, + }, + + "schema_linked_service": { + Type: pluginsdk.TypeList, + Optional: true, + MaxItems: 1, + Elem: &pluginsdk.Resource{ + Schema: map[string]*pluginsdk.Schema{ + "name": { + Type: pluginsdk.TypeString, + Required: true, + ValidateFunc: validation.StringIsNotEmpty, + }, + + "parameters": { + Type: pluginsdk.TypeMap, + Optional: true, + Elem: &pluginsdk.Schema{ + Type: pluginsdk.TypeString, + }, + }, + }, + }, + }, + }, + } +} diff --git a/internal/services/datafactory/data_factory_flowlet_data_flow_resource.go b/internal/services/datafactory/data_factory_flowlet_data_flow_resource.go index 23262672f63b..48b8b3e9b20b 100644 --- a/internal/services/datafactory/data_factory_flowlet_data_flow_resource.go +++ b/internal/services/datafactory/data_factory_flowlet_data_flow_resource.go @@ -68,9 +68,9 @@ func resourceDataFactoryFlowletDataFlow() *pluginsdk.Resource { }, }, - "source": SchemaForDataFlowSourceAndSink(), + "source": SchemaForDataFlowletSourceAndSink(), - "sink": SchemaForDataFlowSourceAndSink(), + "sink": SchemaForDataFlowletSourceAndSink(), "transformation": SchemaForDataFlowSourceTransformation(), diff --git a/website/docs/r/data_factory_flowlet_data_flow.html.markdown b/website/docs/r/data_factory_flowlet_data_flow.html.markdown index b44f850a1972..8a95daa65583 100644 --- a/website/docs/r/data_factory_flowlet_data_flow.html.markdown +++ b/website/docs/r/data_factory_flowlet_data_flow.html.markdown @@ -199,9 +199,9 @@ The following arguments are supported: * `folder` - (Optional) The folder that this Data Flow is in. If not specified, the Data Flow will appear at the root level. -* `source` - (Required) One or more `source` blocks as defined below. +* `source` - (Optional) One or more `source` blocks as defined below. -* `sink` - (Required) One or more `sink` blocks as defined below. +* `sink` - (Optional) One or more `sink` blocks as defined below. * `script` - (Optional) The script for the Data Factory Flowlet Data Flow.