Skip to content

Commit a50ec09

Browse files
Juan Gustavo Ramos RangelSrividyaKamakshi
authored andcommitted
Added - Support for Phase 2 - Add ZeroETL as a resource in Golden Gate Cloud Service
1 parent fe34f6f commit a50ec09

File tree

8 files changed

+117
-5
lines changed

8 files changed

+117
-5
lines changed

examples/goldengate/Pipeline/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ variable "region" {}
88
variable "source_connection_id" { }
99
variable "target_connection_id" { }
1010
variable "display_name" {
11-
default = "Pipeline display Name"
11+
default = "Data fabric pipeline display name"
1212
}
1313
variable "license_model" {
1414
default = "LICENSE_INCLUDED"
@@ -26,6 +26,7 @@ provider "oci" {
2626
}
2727

2828
resource "oci_golden_gate_pipeline" "test_pipeline" {
29+
# Required
2930
compartment_id = var.compartment_id
3031
display_name = var.display_name
3132
license_model = var.license_model

internal/integrationtest/golden_gate_pipeline_test.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,10 @@ var (
6969
// "message": acctest.Representation{RepType: acctest.Optional, Create: `message`},
7070
//}
7171
GoldenGatePipelineProcessOptionsRepresentation = map[string]interface{}{
72-
"initial_data_load": acctest.RepresentationGroup{RepType: acctest.Required, Group: GoldenGatePipelineProcessOptionsInitialDataLoadRepresentation},
73-
"replicate_schema_change": acctest.RepresentationGroup{RepType: acctest.Required, Group: GoldenGatePipelineProcessOptionsReplicateSchemaChangeRepresentation},
74-
"should_restart_on_failure": acctest.Representation{RepType: acctest.Required, Create: `ENABLED`, Update: `DISABLED`},
72+
"initial_data_load": acctest.RepresentationGroup{RepType: acctest.Required, Group: GoldenGatePipelineProcessOptionsInitialDataLoadRepresentation},
73+
"replicate_schema_change": acctest.RepresentationGroup{RepType: acctest.Required, Group: GoldenGatePipelineProcessOptionsReplicateSchemaChangeRepresentation},
74+
"should_restart_on_failure": acctest.Representation{RepType: acctest.Required, Create: `ENABLED`, Update: `DISABLED`},
75+
"start_using_default_mapping": acctest.Representation{RepType: acctest.Optional, Create: `ENABLED`, Update: `DISABLED`},
7576
}
7677
GoldenGatePipelineProcessOptionsInitialDataLoadRepresentation = map[string]interface{}{
7778
"is_initial_load": acctest.Representation{RepType: acctest.Required, Create: `ENABLED`, Update: `DISABLED`},
@@ -158,6 +159,7 @@ func TestGoldenGatePipelineResource_basic(t *testing.T) {
158159
resource.TestCheckResourceAttr(resourceName, "process_options.0.replicate_schema_change.0.action_on_dml_error", "TERMINATE"),
159160
resource.TestCheckResourceAttr(resourceName, "process_options.0.replicate_schema_change.0.can_replicate_schema_change", "ENABLED"),
160161
resource.TestCheckResourceAttr(resourceName, "process_options.0.should_restart_on_failure", "ENABLED"),
162+
resource.TestCheckResourceAttr(resourceName, "process_options.0.start_using_default_mapping", "ENABLED"),
161163
resource.TestCheckResourceAttr(resourceName, "recipe_type", "ZERO_ETL"),
162164
resource.TestCheckResourceAttr(resourceName, "source_connection_details.#", "1"),
163165
resource.TestCheckResourceAttrSet(resourceName, "source_connection_details.0.connection_id"),
@@ -199,6 +201,7 @@ func TestGoldenGatePipelineResource_basic(t *testing.T) {
199201
resource.TestCheckResourceAttr(resourceName, "process_options.0.replicate_schema_change.0.action_on_dml_error", "TERMINATE"),
200202
resource.TestCheckResourceAttr(resourceName, "process_options.0.replicate_schema_change.0.can_replicate_schema_change", "ENABLED"),
201203
resource.TestCheckResourceAttr(resourceName, "process_options.0.should_restart_on_failure", "ENABLED"),
204+
resource.TestCheckResourceAttr(resourceName, "process_options.0.start_using_default_mapping", "ENABLED"),
202205
resource.TestCheckResourceAttr(resourceName, "recipe_type", "ZERO_ETL"),
203206
resource.TestCheckResourceAttr(resourceName, "source_connection_details.#", "1"),
204207
resource.TestCheckResourceAttrSet(resourceName, "source_connection_details.0.connection_id"),
@@ -240,6 +243,7 @@ func TestGoldenGatePipelineResource_basic(t *testing.T) {
240243
resource.TestCheckResourceAttr(resourceName, "process_options.0.replicate_schema_change.0.action_on_dml_error", "DISCARD"),
241244
resource.TestCheckResourceAttr(resourceName, "process_options.0.replicate_schema_change.0.can_replicate_schema_change", "DISABLED"),
242245
resource.TestCheckResourceAttr(resourceName, "process_options.0.should_restart_on_failure", "DISABLED"),
246+
resource.TestCheckResourceAttr(resourceName, "process_options.0.start_using_default_mapping", "DISABLED"),
243247
resource.TestCheckResourceAttr(resourceName, "recipe_type", "ZERO_ETL"),
244248
resource.TestCheckResourceAttr(resourceName, "source_connection_details.#", "1"),
245249
resource.TestCheckResourceAttrSet(resourceName, "source_connection_details.0.connection_id"),
@@ -292,6 +296,7 @@ func TestGoldenGatePipelineResource_basic(t *testing.T) {
292296
resource.TestCheckResourceAttr(singularDatasourceName, "license_model", "LICENSE_INCLUDED"),
293297
resource.TestCheckResourceAttrSet(singularDatasourceName, "lifecycle_sub_state"),
294298
resource.TestCheckResourceAttr(singularDatasourceName, "mapping_rules.#", "1"),
299+
resource.TestCheckResourceAttr(singularDatasourceName, "pipeline_diagnostic_data.#", "0"),
295300
resource.TestCheckResourceAttr(singularDatasourceName, "process_options.#", "1"),
296301
resource.TestCheckResourceAttr(singularDatasourceName, "process_options.0.initial_data_load.#", "1"),
297302
resource.TestCheckResourceAttr(singularDatasourceName, "process_options.0.initial_data_load.0.action_on_existing_table", "REPLACE"),
@@ -301,6 +306,7 @@ func TestGoldenGatePipelineResource_basic(t *testing.T) {
301306
resource.TestCheckResourceAttr(singularDatasourceName, "process_options.0.replicate_schema_change.0.action_on_dml_error", "DISCARD"),
302307
resource.TestCheckResourceAttr(singularDatasourceName, "process_options.0.replicate_schema_change.0.can_replicate_schema_change", "DISABLED"),
303308
resource.TestCheckResourceAttr(singularDatasourceName, "process_options.0.should_restart_on_failure", "DISABLED"),
309+
resource.TestCheckResourceAttr(singularDatasourceName, "process_options.0.start_using_default_mapping", "DISABLED"),
304310
resource.TestCheckResourceAttr(singularDatasourceName, "recipe_type", "ZERO_ETL"),
305311
resource.TestCheckResourceAttr(singularDatasourceName, "source_connection_details.#", "1"),
306312
resource.TestCheckResourceAttrSet(singularDatasourceName, "state"),

internal/service/golden_gate/golden_gate_pipeline_data_source.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,12 @@ func (s *GoldenGatePipelineDataSourceCrud) SetData() error {
127127
}
128128
s.D.Set("locks", locks)
129129

130+
if v.PipelineDiagnosticData != nil {
131+
s.D.Set("pipeline_diagnostic_data", []interface{}{PipelineDiagnosticDataToMap(v.PipelineDiagnosticData)})
132+
} else {
133+
s.D.Set("pipeline_diagnostic_data", nil)
134+
}
135+
130136
if v.SourceConnectionDetails != nil {
131137
s.D.Set("source_connection_details", []interface{}{SourcePipelineConnectionDetailsToMap(v.SourceConnectionDetails)})
132138
} else {

internal/service/golden_gate/golden_gate_pipeline_resource.go

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ func GoldenGatePipelineResource() *schema.Resource {
209209
},
210210

211211
// Optional
212+
"start_using_default_mapping": {
213+
Type: schema.TypeString,
214+
Optional: true,
215+
Computed: true,
216+
},
212217

213218
// Computed
214219
},
@@ -257,6 +262,39 @@ func GoldenGatePipelineResource() *schema.Resource {
257262
},
258263
},
259264
},
265+
"pipeline_diagnostic_data": {
266+
Type: schema.TypeList,
267+
Computed: true,
268+
Elem: &schema.Resource{
269+
Schema: map[string]*schema.Schema{
270+
// Required
271+
272+
// Optional
273+
274+
// Computed
275+
"bucket": {
276+
Type: schema.TypeString,
277+
Computed: true,
278+
},
279+
"diagnostic_state": {
280+
Type: schema.TypeString,
281+
Computed: true,
282+
},
283+
"namespace": {
284+
Type: schema.TypeString,
285+
Computed: true,
286+
},
287+
"object": {
288+
Type: schema.TypeString,
289+
Computed: true,
290+
},
291+
"time_last_collected": {
292+
Type: schema.TypeString,
293+
Computed: true,
294+
},
295+
},
296+
},
297+
},
260298
"state": {
261299
Type: schema.TypeString,
262300
Computed: true,
@@ -623,6 +661,12 @@ func (s *GoldenGatePipelineResourceCrud) SetData() error {
623661
}
624662
s.D.Set("locks", locks)
625663

664+
if v.PipelineDiagnosticData != nil {
665+
s.D.Set("pipeline_diagnostic_data", []interface{}{PipelineDiagnosticDataToMap(v.PipelineDiagnosticData)})
666+
} else {
667+
s.D.Set("pipeline_diagnostic_data", nil)
668+
}
669+
626670
if v.SourceConnectionDetails != nil {
627671
s.D.Set("source_connection_details", []interface{}{SourcePipelineConnectionDetailsToMap(v.SourceConnectionDetails)})
628672
} else {
@@ -715,6 +759,30 @@ func MappingRuleToMap(obj oci_golden_gate.MappingRule) map[string]interface{} {
715759
return result
716760
}
717761

762+
func PipelineDiagnosticDataToMap(obj *oci_golden_gate.PipelineDiagnosticData) map[string]interface{} {
763+
result := map[string]interface{}{}
764+
765+
if obj.BucketName != nil {
766+
result["bucket"] = string(*obj.BucketName)
767+
}
768+
769+
result["diagnostic_state"] = string(obj.DiagnosticState)
770+
771+
if obj.NamespaceName != nil {
772+
result["namespace"] = string(*obj.NamespaceName)
773+
}
774+
775+
if obj.ObjectName != nil {
776+
result["object"] = string(*obj.ObjectName)
777+
}
778+
779+
if obj.TimeLastCollected != nil {
780+
result["time_last_collected"] = obj.TimeLastCollected.String()
781+
}
782+
783+
return result
784+
}
785+
718786
func PipelineSummaryToMap(obj oci_golden_gate.PipelineSummary) map[string]interface{} {
719787
result := map[string]interface{}{}
720788
switch v := (obj).(type) {
@@ -765,6 +833,10 @@ func (s *GoldenGatePipelineResourceCrud) mapToProcessOptions(fieldKeyFormat stri
765833
result.ShouldRestartOnFailure = oci_golden_gate.ProcessOptionsShouldRestartOnFailureEnum(shouldRestartOnFailure.(string))
766834
}
767835

836+
if startUsingDefaultMapping, ok := s.D.GetOkExists(fmt.Sprintf(fieldKeyFormat, "start_using_default_mapping")); ok {
837+
result.StartUsingDefaultMapping = oci_golden_gate.ProcessOptionsStartUsingDefaultMappingEnum(startUsingDefaultMapping.(string))
838+
}
839+
768840
return result, nil
769841
}
770842

@@ -781,6 +853,8 @@ func ProcessOptionsToMap(obj *oci_golden_gate.ProcessOptions) map[string]interfa
781853

782854
result["should_restart_on_failure"] = string(obj.ShouldRestartOnFailure)
783855

856+
result["start_using_default_mapping"] = string(obj.StartUsingDefaultMapping)
857+
784858
return result
785859
}
786860

website/docs/d/golden_gate_pipeline.html.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,12 @@ The following attributes are exported:
5353
* `mapping_type` - Defines the exclude/include rules of source and target schemas and tables when replicating from source to target. This option applies when creating and updating a pipeline.
5454
* `source` - The source schema/table combination for replication to target.
5555
* `target` - The target schema/table combination for replication from the source.
56+
* `pipeline_diagnostic_data` - Information regarding the pipeline diagnostic collection
57+
* `bucket` - Name of the bucket where the object is to be uploaded in the object storage
58+
* `diagnostic_state` - The state of the pipeline diagnostics collection.
59+
* `namespace` - Name of namespace that serves as a container for all of your buckets
60+
* `object` - Name of the diagnostic collected and uploaded to object storage
61+
* `time_last_collected` - The date and time the diagnostic data was last collected for the pipeline. The format is defined by [RFC3339](https://tools.ietf.org/html/rfc3339), such as `2024-07-25T21:10:29.600Z`.
5662
* `process_options` - Required pipeline options to configure the replication process (Extract or Replicat).
5763
* `initial_data_load` - Options required for the pipeline Initial Data Load. If enabled, copies existing data from source to target before replication.
5864
* `action_on_existing_table` - Action upon existing tables in target when initial Data Load is set i.e., isInitialLoad=true.
@@ -62,6 +68,7 @@ The following attributes are exported:
6268
* `action_on_dml_error` - Action upon DML Error (active only if 'Replicate schema changes (DDL)' is selected) i.e canReplicateSchemaChange=true
6369
* `can_replicate_schema_change` - If ENABLED, then addition or removal of schema is also replicated, apart from individual tables and records when creating or updating the pipeline.
6470
* `should_restart_on_failure` - If ENABLED, then the replication process restarts itself upon failure. This option applies when creating or updating a pipeline.
71+
* `start_using_default_mapping` - If ENABLED, then the pipeline is started as part of pipeline creation. It uses default mapping. This option applies when creating or updating a pipeline.
6572
* `recipe_type` - The type of the recipe
6673
* `source_connection_details` - The source connection details for creating a pipeline.
6774
* `connection_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the connection being referenced.

website/docs/d/golden_gate_pipeline_running_processes.html.markdown

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ description: |-
1010
# Data Source: oci_golden_gate_pipeline_running_processes
1111
This data source provides the list of Pipeline Running Processes in Oracle Cloud Infrastructure Golden Gate service.
1212

13-
Retrieves a Pipeline's running replication process's status like extracts/replicats.
13+
Retrieves a Pipeline's running replication process's status like Capture/Apply.
1414

1515

1616
## Example Usage

website/docs/d/golden_gate_pipelines.html.markdown

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,12 @@ The following attributes are exported:
6767
* `mapping_type` - Defines the exclude/include rules of source and target schemas and tables when replicating from source to target. This option applies when creating and updating a pipeline.
6868
* `source` - The source schema/table combination for replication to target.
6969
* `target` - The target schema/table combination for replication from the source.
70+
* `pipeline_diagnostic_data` - Information regarding the pipeline diagnostic collection
71+
* `bucket` - Name of the bucket where the object is to be uploaded in the object storage
72+
* `diagnostic_state` - The state of the pipeline diagnostics collection.
73+
* `namespace` - Name of namespace that serves as a container for all of your buckets
74+
* `object` - Name of the diagnostic collected and uploaded to object storage
75+
* `time_last_collected` - The date and time the diagnostic data was last collected for the pipeline. The format is defined by [RFC3339](https://tools.ietf.org/html/rfc3339), such as `2024-07-25T21:10:29.600Z`.
7076
* `process_options` - Required pipeline options to configure the replication process (Extract or Replicat).
7177
* `initial_data_load` - Options required for the pipeline Initial Data Load. If enabled, copies existing data from source to target before replication.
7278
* `action_on_existing_table` - Action upon existing tables in target when initial Data Load is set i.e., isInitialLoad=true.
@@ -76,6 +82,7 @@ The following attributes are exported:
7682
* `action_on_dml_error` - Action upon DML Error (active only if 'Replicate schema changes (DDL)' is selected) i.e canReplicateSchemaChange=true
7783
* `can_replicate_schema_change` - If ENABLED, then addition or removal of schema is also replicated, apart from individual tables and records when creating or updating the pipeline.
7884
* `should_restart_on_failure` - If ENABLED, then the replication process restarts itself upon failure. This option applies when creating or updating a pipeline.
85+
* `start_using_default_mapping` - If ENABLED, then the pipeline is started as part of pipeline creation. It uses default mapping. This option applies when creating or updating a pipeline.
7986
* `recipe_type` - The type of the recipe
8087
* `source_connection_details` - The source connection details for creating a pipeline.
8188
* `connection_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the connection being referenced.

website/docs/r/golden_gate_pipeline.html.markdown

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ resource "oci_golden_gate_pipeline" "test_pipeline" {
6262
action_on_dml_error = var.pipeline_process_options_replicate_schema_change_action_on_dml_error
6363
}
6464
should_restart_on_failure = var.pipeline_process_options_should_restart_on_failure
65+
66+
#Optional
67+
start_using_default_mapping = var.pipeline_process_options_start_using_default_mapping
6568
}
6669
}
6770
```
@@ -90,6 +93,7 @@ The following arguments are supported:
9093
* `action_on_dml_error` - (Optional) (Updatable) Action upon DML Error (active only if 'Replicate schema changes (DDL)' is selected) i.e canReplicateSchemaChange=true
9194
* `can_replicate_schema_change` - (Required) (Updatable) If ENABLED, then addition or removal of schema is also replicated, apart from individual tables and records when creating or updating the pipeline.
9295
* `should_restart_on_failure` - (Required) (Updatable) If ENABLED, then the replication process restarts itself upon failure. This option applies when creating or updating a pipeline.
96+
* `start_using_default_mapping` - (Optional) (Updatable) If ENABLED, then the pipeline is started as part of pipeline creation. It uses default mapping. This option applies when creating or updating a pipeline.
9397
* `recipe_type` - (Required) (Updatable) The type of the recipe
9498
* `source_connection_details` - (Required) The source connection details for creating a pipeline.
9599
* `connection_id` - (Required) The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the connection being referenced.
@@ -124,6 +128,12 @@ The following attributes are exported:
124128
* `mapping_type` - Defines the exclude/include rules of source and target schemas and tables when replicating from source to target. This option applies when creating and updating a pipeline.
125129
* `source` - The source schema/table combination for replication to target.
126130
* `target` - The target schema/table combination for replication from the source.
131+
* `pipeline_diagnostic_data` - Information regarding the pipeline diagnostic collection
132+
* `bucket` - Name of the bucket where the object is to be uploaded in the object storage
133+
* `diagnostic_state` - The state of the pipeline diagnostics collection.
134+
* `namespace` - Name of namespace that serves as a container for all of your buckets
135+
* `object` - Name of the diagnostic collected and uploaded to object storage
136+
* `time_last_collected` - The date and time the diagnostic data was last collected for the pipeline. The format is defined by [RFC3339](https://tools.ietf.org/html/rfc3339), such as `2024-07-25T21:10:29.600Z`.
127137
* `process_options` - Required pipeline options to configure the replication process (Extract or Replicat).
128138
* `initial_data_load` - Options required for the pipeline Initial Data Load. If enabled, copies existing data from source to target before replication.
129139
* `action_on_existing_table` - Action upon existing tables in target when initial Data Load is set i.e., isInitialLoad=true.
@@ -133,6 +143,7 @@ The following attributes are exported:
133143
* `action_on_dml_error` - Action upon DML Error (active only if 'Replicate schema changes (DDL)' is selected) i.e canReplicateSchemaChange=true
134144
* `can_replicate_schema_change` - If ENABLED, then addition or removal of schema is also replicated, apart from individual tables and records when creating or updating the pipeline.
135145
* `should_restart_on_failure` - If ENABLED, then the replication process restarts itself upon failure. This option applies when creating or updating a pipeline.
146+
* `start_using_default_mapping` - If ENABLED, then the pipeline is started as part of pipeline creation. It uses default mapping. This option applies when creating or updating a pipeline.
136147
* `recipe_type` - The type of the recipe
137148
* `source_connection_details` - The source connection details for creating a pipeline.
138149
* `connection_id` - The [OCID](https://docs.cloud.oracle.com/iaas/Content/General/Concepts/identifiers.htm) of the connection being referenced.

0 commit comments

Comments
 (0)