@@ -10,144 +10,12 @@ import (
1010)
1111
1212func DatabaseDatabaseDataSource () * schema.Resource {
13- return & schema.Resource {
14- Read : readSingularDatabaseDatabase ,
15- Schema : map [string ]* schema.Schema {
16- "database_id" : {
17- Type : schema .TypeString ,
18- Required : true ,
19- },
20- // Computed
21- "character_set" : {
22- Type : schema .TypeString ,
23- Computed : true ,
24- },
25- "compartment_id" : {
26- Type : schema .TypeString ,
27- Computed : true ,
28- },
29- "connection_strings" : {
30- Type : schema .TypeList ,
31- Computed : true ,
32- Elem : & schema.Resource {
33- Schema : map [string ]* schema.Schema {
34- // Required
35-
36- // Optional
37-
38- // Computed
39- "all_connection_strings" : {
40- Type : schema .TypeMap ,
41- Computed : true ,
42- Elem : schema .TypeString ,
43- },
44- "cdb_default" : {
45- Type : schema .TypeString ,
46- Computed : true ,
47- },
48- "cdb_ip_default" : {
49- Type : schema .TypeString ,
50- Computed : true ,
51- },
52- },
53- },
54- },
55- "db_backup_config" : {
56- Type : schema .TypeList ,
57- Computed : true ,
58- MaxItems : 1 ,
59- MinItems : 1 ,
60- Elem : & schema.Resource {
61- Schema : map [string ]* schema.Schema {
62- // Required
63-
64- // Optional
65-
66- // Computed
67- "auto_backup_enabled" : {
68- Type : schema .TypeBool ,
69- Computed : true ,
70- },
71- "auto_backup_window" : {
72- Type : schema .TypeString ,
73- Computed : true ,
74- },
75- "backup_destination_details" : {
76- Type : schema .TypeList ,
77- Computed : true ,
78- Elem : & schema.Resource {
79- Schema : map [string ]* schema.Schema {
80- // Required
81-
82- // Optional
83-
84- // Computed
85- "id" : {
86- Type : schema .TypeString ,
87- Computed : true ,
88- },
89- "type" : {
90- Type : schema .TypeString ,
91- Computed : true ,
92- },
93- },
94- },
95- },
96- "recovery_window_in_days" : {
97- Type : schema .TypeInt ,
98- Computed : true ,
99- },
100- },
101- },
102- },
103- "db_home_id" : {
104- Type : schema .TypeString ,
105- Computed : true ,
106- },
107- "db_name" : {
108- Type : schema .TypeString ,
109- Computed : true ,
110- },
111- "db_unique_name" : {
112- Type : schema .TypeString ,
113- Computed : true ,
114- },
115- "db_workload" : {
116- Type : schema .TypeString ,
117- Computed : true ,
118- },
119- "defined_tags" : {
120- Type : schema .TypeMap ,
121- Computed : true ,
122- Elem : schema .TypeString ,
123- },
124- "freeform_tags" : {
125- Type : schema .TypeMap ,
126- Computed : true ,
127- Elem : schema .TypeString ,
128- },
129- "lifecycle_details" : {
130- Type : schema .TypeString ,
131- Computed : true ,
132- },
133- "ncharacter_set" : {
134- Type : schema .TypeString ,
135- Computed : true ,
136- },
137- "pdb_name" : {
138- Type : schema .TypeString ,
139- Computed : true ,
140- },
141- "state" : {
142- Type : schema .TypeString ,
143- Computed : true ,
144- },
145- "time_created" : {
146- Type : schema .TypeString ,
147- Computed : true ,
148- },
149- },
13+ fieldMap := make (map [string ]* schema.Schema )
14+ fieldMap ["database_id" ] = & schema.Schema {
15+ Type : schema .TypeString ,
16+ Required : true ,
15017 }
18+ return GetSingularDataSourceItemSchema (DatabaseDatabaseResource (), fieldMap , readSingularDatabaseDatabase )
15119}
15220
15321func readSingularDatabaseDatabase (d * schema.ResourceData , m interface {}) error {
@@ -222,6 +90,10 @@ func (s *DatabaseDatabaseDataSourceCrud) SetData() error {
22290 s .D .Set ("db_name" , * s .Res .DbName )
22391 }
22492
93+ if s .Res .DbSystemId != nil {
94+ s .D .Set ("db_system_id" , * s .Res .DbSystemId )
95+ }
96+
22597 if s .Res .DbUniqueName != nil {
22698 s .D .Set ("db_unique_name" , * s .Res .DbUniqueName )
22799 }
@@ -254,35 +126,9 @@ func (s *DatabaseDatabaseDataSourceCrud) SetData() error {
254126 s .D .Set ("time_created" , s .Res .TimeCreated .String ())
255127 }
256128
257- return nil
258- }
259-
260- func BackupDestinationDetailsToMap (obj oci_database.BackupDestinationDetails ) map [string ]interface {} {
261- result := map [string ]interface {}{}
262-
263- if obj .Id != nil {
264- result ["id" ] = string (* obj .Id )
129+ if s .Res .VmClusterId != nil {
130+ s .D .Set ("vm_cluster_id" , * s .Res .VmClusterId )
265131 }
266132
267- result ["type" ] = string (obj .Type )
268-
269- return result
270- }
271-
272- func DatabaseConnectionStringsToMap (obj * oci_database.DatabaseConnectionStrings ) map [string ]interface {} {
273- result := map [string ]interface {}{}
274-
275- result ["all_connection_strings" ] = obj .AllConnectionStrings
276-
277- if obj .CdbDefault != nil {
278- result ["cdb_default" ] = string (* obj .CdbDefault )
279- }
280-
281- if obj .CdbIpDefault != nil {
282- result ["cdb_ip_default" ] = string (* obj .CdbIpDefault )
283- }
284-
285- return result
133+ return nil
286134}
287-
288- // @CODEGEN 08/2018: Method DbBackupConfigToMap is available in database_db_system_resource.go
0 commit comments