From 4b38129766c7f1b33c0485d77d2d450c0ddb83e5 Mon Sep 17 00:00:00 2001 From: Ashen Gunaratne Date: Wed, 22 Nov 2023 12:46:42 +0000 Subject: [PATCH] [azurerm_data_factory_flowlet_data_flow] Optional source and sink properties --- .../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 d4818e90c7181..e581fbd23e0fb 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: resourceSouceAndSink(), + } +} - "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: resourceSouceAndSink(), } } @@ -485,3 +358,142 @@ func flattenDataFactoryDataFlowReference(input *datafactory.DataFlowReference) [ }, } } + +func resourceSouceAndSink() *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 23262672f63b5..48b8b3e9b20b0 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 b44f850a1972a..8a95daa655839 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.