Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecuteDBToolsConnection ¶
func ExecuteDBToolsConnection(cfg DBToolsConfig) ([]byte, error)
example.ExecuteDBToolsConnection() calls the Database Tools ORDS endpoint to execute some SQL queries against the database at the other end of the connection. This should work even if the database is sitting behind a private subnet as long as the connection was setup using a private endpoint.
Queries are executed by signing requests using the details from the default profile in the ~/.oci/config file. (i.e. [DEFAULT])
func GetDatabaseToolsEndpoint ¶
func GetDatabaseToolsEndpoint(cfg DBToolsConfig) string
Use the information from the ~/.oci/config file (for the region) combined with the OCID of the connection to get the ORDS endpoint. For example: https://sql.dbtools.us-phoenix-1.oci.oraclecloud.com/20201005/ords/ocid1.databasetoolsconnection...change-me/_/sql
func ValidateDBToolsConnection ¶
func ValidateDBToolsConnection(cfg DBToolsConfig)
example.ValidateDBToolsCOnnection() calls the Database Tools API to validate a connection based on the OCID provided.
Types ¶
type DBToolsConfig ¶
type DBToolsConfig struct { ConnectionId string `json:"connectionId"` ContentType string `json:"contentType"` Payload string `json:"payload"` }
DBToolsConfig is the configuration for the example and is primarily used for setting the endpoint and payload.
- ConnectionId is the OCID of the DBTools connection
- ContentType should be either application/sql or application/json
- Payload is the SQL to execute (either SQL or JSON format)
In addition to the above, the Go SDK for provides a DefaultConfigProvider and should be configured with a [DEFAULT] section in the ~/.oci/config file.