Skip to content

Commit

Permalink
Merge pull request #38932 from mahadzaryab1/new-appflow-properties
Browse files Browse the repository at this point in the history
feat(appflow): add support for pagination and parallelism properties for `aws_appflow_flow `
  • Loading branch information
johnsonaj authored Oct 15, 2024
2 parents 3af9727 + 57ed003 commit e604986
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/38932.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
resource/aws_appflow_flow: Add `source_flow_config.source_connector_properties.sapo_data.pagination_config` and `source_flow_config.source_connector_properties.sapo_data.parallelism_config` attributes
```
100 changes: 100 additions & 0 deletions internal/service/appflow/flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -962,6 +962,34 @@ func resourceFlow() *schema.Resource {
Required: true,
ValidateFunc: validation.All(validation.StringMatch(regexache.MustCompile(`\S+`), "must not contain any whitespace characters"), validation.StringLenBetween(1, 512)),
},
"pagination_config": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"max_page_size": {
Type: schema.TypeInt,
Required: true,
ValidateFunc: validation.IntBetween(1, 10000),
},
},
},
},
"parallelism_config": {
Type: schema.TypeList,
Optional: true,
MaxItems: 1,
Elem: &schema.Resource{
Schema: map[string]*schema.Schema{
"max_page_size": {
Type: schema.TypeInt,
Required: true,
ValidateFunc: validation.IntBetween(1, 10),
},
},
},
},
},
},
},
Expand Down Expand Up @@ -2345,6 +2373,34 @@ func expandSalesforceSourceProperties(tfMap map[string]interface{}) *types.Sales
return a
}

func expandSAPODataPaginationConfigProperties(tfMap map[string]interface{}) *types.SAPODataPaginationConfig {
if tfMap == nil {
return nil
}

a := &types.SAPODataPaginationConfig{}

if v, ok := tfMap["max_page_size"].(int); ok && v != 0 {
a.MaxPageSize = aws.Int32(int32(v))
}

return a
}

func expandSAPODataParallelismConfigProperties(tfMap map[string]interface{}) *types.SAPODataParallelismConfig {
if tfMap == nil {
return nil
}

a := &types.SAPODataParallelismConfig{}

if v, ok := tfMap["max_parallelism"].(int); ok && v != 0 {
a.MaxParallelism = aws.Int32(int32(v))
}

return a
}

func expandSAPODataSourceProperties(tfMap map[string]interface{}) *types.SAPODataSourceProperties {
if tfMap == nil {
return nil
Expand All @@ -2356,6 +2412,14 @@ func expandSAPODataSourceProperties(tfMap map[string]interface{}) *types.SAPODat
a.ObjectPath = aws.String(v)
}

if v, ok := tfMap["pagination_config"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
a.PaginationConfig = expandSAPODataPaginationConfigProperties(v[0].(map[string]interface{}))
}

if v, ok := tfMap["parallelism_config"].([]interface{}); ok && len(v) > 0 && v[0] != nil {
a.ParallelismConfig = expandSAPODataParallelismConfigProperties(v[0].(map[string]interface{}))
}

return a
}

Expand Down Expand Up @@ -3482,6 +3546,34 @@ func flattenSalesforceSourceProperties(salesforceSourceProperties *types.Salesfo
return m
}

func flattenSAPODataPaginationConfigProperties(sapoDataPaginationConfig *types.SAPODataPaginationConfig) []any {
if sapoDataPaginationConfig == nil {
return nil
}

m := map[string]any{}

if v := sapoDataPaginationConfig.MaxPageSize; v != nil {
m["max_page_size"] = aws.ToInt32(v)
}

return []any{m}
}

func flattenSAPODataParallelismConfigProperties(sapoDataParallelismConfig *types.SAPODataParallelismConfig) []any {
if sapoDataParallelismConfig == nil {
return nil
}

m := map[string]any{}

if v := sapoDataParallelismConfig.MaxParallelism; v != nil {
m["max_parallelism"] = aws.ToInt32(v)
}

return []any{m}
}

func flattenSAPODataSourceProperties(sapoDataSourceProperties *types.SAPODataSourceProperties) map[string]interface{} {
if sapoDataSourceProperties == nil {
return nil
Expand All @@ -3493,6 +3585,14 @@ func flattenSAPODataSourceProperties(sapoDataSourceProperties *types.SAPODataSou
m["object_path"] = aws.ToString(v)
}

if v := sapoDataSourceProperties.PaginationConfig; v != nil {
m["pagination_config"] = flattenSAPODataPaginationConfigProperties(v)
}

if v := sapoDataSourceProperties.ParallelismConfig; v != nil {
m["pagination_config"] = flattenSAPODataParallelismConfigProperties(v)
}

return m
}

Expand Down
4 changes: 4 additions & 0 deletions website/docs/r/appflow_flow.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,10 @@ Amplitude, Datadog, Dynatrace, Google Analytics, Infor Nexus, Marketo, ServiceNo
##### SAPOData Source Properties

* `object_path` - (Required) Object path specified in the SAPOData flow source.
* `pagination_config` - (Optional) Sets the page size for each concurrent process that transfers OData records from your SAP instance.
* `max_page_size` - (Optional) he maximum number of records that Amazon AppFlow receives in each page of the response from your SAP application.
* `parallelism_config` - (Optional) Sets the number of concurrent processes that transfers OData records from your SAP instance.
* `max_parallelism` - (Optional) The maximum number of processes that Amazon AppFlow runs at the same time when it retrieves your data from your SAP application.

##### Veeva Source Properties

Expand Down

0 comments on commit e604986

Please sign in to comment.