@@ -321,6 +321,45 @@ func MysqlMysqlDbSystemResource() *schema.Resource {
321321 Computed : true ,
322322 ForceNew : true ,
323323 },
324+ "read_endpoint" : {
325+ Type : schema .TypeList ,
326+ Optional : true ,
327+ Computed : true ,
328+ MaxItems : 1 ,
329+ MinItems : 1 ,
330+ Elem : & schema.Resource {
331+ Schema : map [string ]* schema.Schema {
332+ // Required
333+
334+ // Optional
335+ "exclude_ips" : {
336+ Type : schema .TypeList ,
337+ Optional : true ,
338+ Computed : true ,
339+ Elem : & schema.Schema {
340+ Type : schema .TypeString ,
341+ },
342+ },
343+ "is_enabled" : {
344+ Type : schema .TypeBool ,
345+ Optional : true ,
346+ Computed : true ,
347+ },
348+ "read_endpoint_hostname_label" : {
349+ Type : schema .TypeString ,
350+ Optional : true ,
351+ Computed : true ,
352+ },
353+ "read_endpoint_ip_address" : {
354+ Type : schema .TypeString ,
355+ Optional : true ,
356+ Computed : true ,
357+ },
358+
359+ // Computed
360+ },
361+ },
362+ },
324363 "secure_connections" : {
325364 Type : schema .TypeList ,
326365 Optional : true ,
@@ -1063,6 +1102,17 @@ func (s *MysqlMysqlDbSystemResourceCrud) Create() error {
10631102 request .PortX = & tmp
10641103 }
10651104
1105+ if readEndpoint , ok := s .D .GetOkExists ("read_endpoint" ); ok {
1106+ if tmpList := readEndpoint .([]interface {}); len (tmpList ) > 0 {
1107+ fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "read_endpoint" , 0 )
1108+ tmp , err := s .mapToCreateReadEndpointDetails (fieldKeyFormat )
1109+ if err != nil {
1110+ return err
1111+ }
1112+ request .ReadEndpoint = & tmp
1113+ }
1114+ }
1115+
10661116 if secureConnections , ok := s .D .GetOkExists ("secure_connections" ); ok {
10671117 if tmpList := secureConnections .([]interface {}); len (tmpList ) > 0 {
10681118 fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "secure_connections" , 0 )
@@ -1244,6 +1294,17 @@ func (s *MysqlMysqlDbSystemResourceCrud) Update() error {
12441294 }
12451295 }
12461296
1297+ if readEndpoint , ok := s .D .GetOkExists ("read_endpoint" ); ok && s .D .HasChange ("read_endpoint" ) {
1298+ if tmpList := readEndpoint .([]interface {}); len (tmpList ) > 0 {
1299+ fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "read_endpoint" , 0 )
1300+ tmp , err := s .mapToUpdateReadEndpointDetails (fieldKeyFormat )
1301+ if err != nil {
1302+ return err
1303+ }
1304+ request .ReadEndpoint = & tmp
1305+ }
1306+ }
1307+
12471308 if secureConnections , ok := s .D .GetOkExists ("secure_connections" ); ok && s .D .HasChange ("secure_connections" ) {
12481309 if tmpList := secureConnections .([]interface {}); len (tmpList ) > 0 {
12491310 fieldKeyFormat := fmt .Sprintf ("%s.%d.%%s" , "secure_connections" , 0 )
@@ -1413,6 +1474,12 @@ func (s *MysqlMysqlDbSystemResourceCrud) SetData() error {
14131474 s .D .Set ("port_x" , * s .Res .PortX )
14141475 }
14151476
1477+ if s .Res .ReadEndpoint != nil {
1478+ s .D .Set ("read_endpoint" , []interface {}{ReadEndpointDetailsToMap (s .Res .ReadEndpoint )})
1479+ } else {
1480+ s .D .Set ("read_endpoint" , nil )
1481+ }
1482+
14161483 if s .Res .SecureConnections != nil {
14171484 s .D .Set ("secure_connections" , []interface {}{SecureConnectionDetailsToMap (s .Res .SecureConnections )})
14181485 } else {
@@ -1979,6 +2046,94 @@ func DataStorageToMap(obj *oci_mysql.DataStorage) map[string]interface{} {
19792046 return result
19802047}
19812048
2049+ func (s * MysqlMysqlDbSystemResourceCrud ) mapToCreateReadEndpointDetails (fieldKeyFormat string ) (oci_mysql.CreateReadEndpointDetails , error ) {
2050+ result := oci_mysql.CreateReadEndpointDetails {}
2051+
2052+ if excludeIps , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "exclude_ips" )); ok {
2053+ interfaces := excludeIps .([]interface {})
2054+ tmp := make ([]string , len (interfaces ))
2055+ for i := range interfaces {
2056+ if interfaces [i ] != nil {
2057+ tmp [i ] = interfaces [i ].(string )
2058+ }
2059+ }
2060+ if len (tmp ) != 0 || s .D .HasChange (fmt .Sprintf (fieldKeyFormat , "exclude_ips" )) {
2061+ result .ExcludeIps = tmp
2062+ }
2063+ }
2064+
2065+ if isEnabled , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "is_enabled" )); ok {
2066+ tmp := isEnabled .(bool )
2067+ result .IsEnabled = & tmp
2068+ }
2069+
2070+ if readEndpointHostnameLabel , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "read_endpoint_hostname_label" )); ok {
2071+ tmp := readEndpointHostnameLabel .(string )
2072+ result .ReadEndpointHostnameLabel = & tmp
2073+ }
2074+
2075+ if readEndpointIpAddress , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "read_endpoint_ip_address" )); ok {
2076+ tmp := readEndpointIpAddress .(string )
2077+ result .ReadEndpointIpAddress = & tmp
2078+ }
2079+
2080+ return result , nil
2081+ }
2082+
2083+ func (s * MysqlMysqlDbSystemResourceCrud ) mapToUpdateReadEndpointDetails (fieldKeyFormat string ) (oci_mysql.UpdateReadEndpointDetails , error ) {
2084+ result := oci_mysql.UpdateReadEndpointDetails {}
2085+
2086+ if excludeIps , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "exclude_ips" )); ok {
2087+ interfaces := excludeIps .([]interface {})
2088+ tmp := make ([]string , len (interfaces ))
2089+ for i := range interfaces {
2090+ if interfaces [i ] != nil {
2091+ tmp [i ] = interfaces [i ].(string )
2092+ }
2093+ }
2094+ if len (tmp ) != 0 || s .D .HasChange (fmt .Sprintf (fieldKeyFormat , "exclude_ips" )) {
2095+ result .ExcludeIps = tmp
2096+ }
2097+ }
2098+
2099+ if isEnabled , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "is_enabled" )); ok {
2100+ tmp := isEnabled .(bool )
2101+ result .IsEnabled = & tmp
2102+ }
2103+
2104+ if readEndpointHostnameLabel , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "read_endpoint_hostname_label" )); ok {
2105+ tmp := readEndpointHostnameLabel .(string )
2106+ result .ReadEndpointHostnameLabel = & tmp
2107+ }
2108+
2109+ if readEndpointIpAddress , ok := s .D .GetOkExists (fmt .Sprintf (fieldKeyFormat , "read_endpoint_ip_address" )); ok {
2110+ tmp := readEndpointIpAddress .(string )
2111+ result .ReadEndpointIpAddress = & tmp
2112+ }
2113+
2114+ return result , nil
2115+ }
2116+
2117+ func ReadEndpointDetailsToMap (obj * oci_mysql.ReadEndpointDetails ) map [string ]interface {} {
2118+ result := map [string ]interface {}{}
2119+
2120+ result ["exclude_ips" ] = obj .ExcludeIps
2121+
2122+ if obj .IsEnabled != nil {
2123+ result ["is_enabled" ] = bool (* obj .IsEnabled )
2124+ }
2125+
2126+ if obj .ReadEndpointHostnameLabel != nil {
2127+ result ["read_endpoint_hostname_label" ] = string (* obj .ReadEndpointHostnameLabel )
2128+ }
2129+
2130+ if obj .ReadEndpointIpAddress != nil {
2131+ result ["read_endpoint_ip_address" ] = string (* obj .ReadEndpointIpAddress )
2132+ }
2133+
2134+ return result
2135+ }
2136+
19822137func (s * MysqlMysqlDbSystemResourceCrud ) mapToCustomerContact (fieldKeyFormat string ) (oci_mysql.CustomerContact , error ) {
19832138 result := oci_mysql.CustomerContact {}
19842139
0 commit comments