// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.

package shared

import (
	"encoding/json"
	"errors"
	"fmt"
	"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/internal/utils"
)

type DestinationOracleUpdateSchemasEncryptionEncryptionMethod string

const (
	DestinationOracleUpdateSchemasEncryptionEncryptionMethodEncryptedVerifyCertificate DestinationOracleUpdateSchemasEncryptionEncryptionMethod = "encrypted_verify_certificate"
)

func (e DestinationOracleUpdateSchemasEncryptionEncryptionMethod) ToPointer() *DestinationOracleUpdateSchemasEncryptionEncryptionMethod {
	return &e
}
func (e *DestinationOracleUpdateSchemasEncryptionEncryptionMethod) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "encrypted_verify_certificate":
		*e = DestinationOracleUpdateSchemasEncryptionEncryptionMethod(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DestinationOracleUpdateSchemasEncryptionEncryptionMethod: %v", v)
	}
}

// DestinationOracleUpdateTLSEncryptedVerifyCertificate - Verify and use the certificate provided by the server.
type DestinationOracleUpdateTLSEncryptedVerifyCertificate struct {
	encryptionMethod *DestinationOracleUpdateSchemasEncryptionEncryptionMethod `const:"encrypted_verify_certificate" json:"encryption_method"`
	// Privacy Enhanced Mail (PEM) files are concatenated certificate containers frequently used in certificate installations.
	SslCertificate string `json:"ssl_certificate"`
}

func (d DestinationOracleUpdateTLSEncryptedVerifyCertificate) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

func (d *DestinationOracleUpdateTLSEncryptedVerifyCertificate) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &d, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *DestinationOracleUpdateTLSEncryptedVerifyCertificate) GetEncryptionMethod() *DestinationOracleUpdateSchemasEncryptionEncryptionMethod {
	return DestinationOracleUpdateSchemasEncryptionEncryptionMethodEncryptedVerifyCertificate.ToPointer()
}

func (o *DestinationOracleUpdateTLSEncryptedVerifyCertificate) GetSslCertificate() string {
	if o == nil {
		return ""
	}
	return o.SslCertificate
}

// DestinationOracleUpdateEncryptionAlgorithm - This parameter defines the database encryption algorithm.
type DestinationOracleUpdateEncryptionAlgorithm string

const (
	DestinationOracleUpdateEncryptionAlgorithmAes256      DestinationOracleUpdateEncryptionAlgorithm = "AES256"
	DestinationOracleUpdateEncryptionAlgorithmRc456       DestinationOracleUpdateEncryptionAlgorithm = "RC4_56"
	DestinationOracleUpdateEncryptionAlgorithmThreeDes168 DestinationOracleUpdateEncryptionAlgorithm = "3DES168"
)

func (e DestinationOracleUpdateEncryptionAlgorithm) ToPointer() *DestinationOracleUpdateEncryptionAlgorithm {
	return &e
}
func (e *DestinationOracleUpdateEncryptionAlgorithm) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "AES256":
		fallthrough
	case "RC4_56":
		fallthrough
	case "3DES168":
		*e = DestinationOracleUpdateEncryptionAlgorithm(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DestinationOracleUpdateEncryptionAlgorithm: %v", v)
	}
}

type DestinationOracleUpdateSchemasEncryptionMethod string

const (
	DestinationOracleUpdateSchemasEncryptionMethodClientNne DestinationOracleUpdateSchemasEncryptionMethod = "client_nne"
)

func (e DestinationOracleUpdateSchemasEncryptionMethod) ToPointer() *DestinationOracleUpdateSchemasEncryptionMethod {
	return &e
}
func (e *DestinationOracleUpdateSchemasEncryptionMethod) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "client_nne":
		*e = DestinationOracleUpdateSchemasEncryptionMethod(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DestinationOracleUpdateSchemasEncryptionMethod: %v", v)
	}
}

// DestinationOracleUpdateNativeNetworkEncryptionNNE - The native network encryption gives you the ability to encrypt database connections, without the configuration overhead of TCP/IP and SSL/TLS and without the need to open and listen on different ports.
type DestinationOracleUpdateNativeNetworkEncryptionNNE struct {
	// This parameter defines the database encryption algorithm.
	EncryptionAlgorithm *DestinationOracleUpdateEncryptionAlgorithm     `default:"AES256" json:"encryption_algorithm"`
	encryptionMethod    *DestinationOracleUpdateSchemasEncryptionMethod `const:"client_nne" json:"encryption_method"`
}

func (d DestinationOracleUpdateNativeNetworkEncryptionNNE) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

func (d *DestinationOracleUpdateNativeNetworkEncryptionNNE) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &d, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *DestinationOracleUpdateNativeNetworkEncryptionNNE) GetEncryptionAlgorithm() *DestinationOracleUpdateEncryptionAlgorithm {
	if o == nil {
		return nil
	}
	return o.EncryptionAlgorithm
}

func (o *DestinationOracleUpdateNativeNetworkEncryptionNNE) GetEncryptionMethod() *DestinationOracleUpdateSchemasEncryptionMethod {
	return DestinationOracleUpdateSchemasEncryptionMethodClientNne.ToPointer()
}

type DestinationOracleUpdateEncryptionMethod string

const (
	DestinationOracleUpdateEncryptionMethodUnencrypted DestinationOracleUpdateEncryptionMethod = "unencrypted"
)

func (e DestinationOracleUpdateEncryptionMethod) ToPointer() *DestinationOracleUpdateEncryptionMethod {
	return &e
}
func (e *DestinationOracleUpdateEncryptionMethod) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "unencrypted":
		*e = DestinationOracleUpdateEncryptionMethod(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DestinationOracleUpdateEncryptionMethod: %v", v)
	}
}

// DestinationOracleUpdateUnencrypted - Data transfer will not be encrypted.
type DestinationOracleUpdateUnencrypted struct {
	encryptionMethod *DestinationOracleUpdateEncryptionMethod `const:"unencrypted" json:"encryption_method"`
}

func (d DestinationOracleUpdateUnencrypted) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

func (d *DestinationOracleUpdateUnencrypted) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &d, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *DestinationOracleUpdateUnencrypted) GetEncryptionMethod() *DestinationOracleUpdateEncryptionMethod {
	return DestinationOracleUpdateEncryptionMethodUnencrypted.ToPointer()
}

type DestinationOracleUpdateEncryptionType string

const (
	DestinationOracleUpdateEncryptionTypeDestinationOracleUpdateUnencrypted                   DestinationOracleUpdateEncryptionType = "destination-oracle-update_Unencrypted"
	DestinationOracleUpdateEncryptionTypeDestinationOracleUpdateNativeNetworkEncryptionNNE    DestinationOracleUpdateEncryptionType = "destination-oracle-update_Native Network Encryption (NNE)"
	DestinationOracleUpdateEncryptionTypeDestinationOracleUpdateTLSEncryptedVerifyCertificate DestinationOracleUpdateEncryptionType = "destination-oracle-update_TLS Encrypted (verify certificate)"
)

// DestinationOracleUpdateEncryption - The encryption method which is used when communicating with the database.
type DestinationOracleUpdateEncryption struct {
	DestinationOracleUpdateUnencrypted                   *DestinationOracleUpdateUnencrypted                   `queryParam:"inline"`
	DestinationOracleUpdateNativeNetworkEncryptionNNE    *DestinationOracleUpdateNativeNetworkEncryptionNNE    `queryParam:"inline"`
	DestinationOracleUpdateTLSEncryptedVerifyCertificate *DestinationOracleUpdateTLSEncryptedVerifyCertificate `queryParam:"inline"`

	Type DestinationOracleUpdateEncryptionType
}

func CreateDestinationOracleUpdateEncryptionDestinationOracleUpdateUnencrypted(destinationOracleUpdateUnencrypted DestinationOracleUpdateUnencrypted) DestinationOracleUpdateEncryption {
	typ := DestinationOracleUpdateEncryptionTypeDestinationOracleUpdateUnencrypted

	return DestinationOracleUpdateEncryption{
		DestinationOracleUpdateUnencrypted: &destinationOracleUpdateUnencrypted,
		Type:                               typ,
	}
}

func CreateDestinationOracleUpdateEncryptionDestinationOracleUpdateNativeNetworkEncryptionNNE(destinationOracleUpdateNativeNetworkEncryptionNNE DestinationOracleUpdateNativeNetworkEncryptionNNE) DestinationOracleUpdateEncryption {
	typ := DestinationOracleUpdateEncryptionTypeDestinationOracleUpdateNativeNetworkEncryptionNNE

	return DestinationOracleUpdateEncryption{
		DestinationOracleUpdateNativeNetworkEncryptionNNE: &destinationOracleUpdateNativeNetworkEncryptionNNE,
		Type: typ,
	}
}

func CreateDestinationOracleUpdateEncryptionDestinationOracleUpdateTLSEncryptedVerifyCertificate(destinationOracleUpdateTLSEncryptedVerifyCertificate DestinationOracleUpdateTLSEncryptedVerifyCertificate) DestinationOracleUpdateEncryption {
	typ := DestinationOracleUpdateEncryptionTypeDestinationOracleUpdateTLSEncryptedVerifyCertificate

	return DestinationOracleUpdateEncryption{
		DestinationOracleUpdateTLSEncryptedVerifyCertificate: &destinationOracleUpdateTLSEncryptedVerifyCertificate,
		Type: typ,
	}
}

func (u *DestinationOracleUpdateEncryption) UnmarshalJSON(data []byte) error {

	var destinationOracleUpdateUnencrypted DestinationOracleUpdateUnencrypted = DestinationOracleUpdateUnencrypted{}
	if err := utils.UnmarshalJSON(data, &destinationOracleUpdateUnencrypted, "", true, true); err == nil {
		u.DestinationOracleUpdateUnencrypted = &destinationOracleUpdateUnencrypted
		u.Type = DestinationOracleUpdateEncryptionTypeDestinationOracleUpdateUnencrypted
		return nil
	}

	var destinationOracleUpdateNativeNetworkEncryptionNNE DestinationOracleUpdateNativeNetworkEncryptionNNE = DestinationOracleUpdateNativeNetworkEncryptionNNE{}
	if err := utils.UnmarshalJSON(data, &destinationOracleUpdateNativeNetworkEncryptionNNE, "", true, true); err == nil {
		u.DestinationOracleUpdateNativeNetworkEncryptionNNE = &destinationOracleUpdateNativeNetworkEncryptionNNE
		u.Type = DestinationOracleUpdateEncryptionTypeDestinationOracleUpdateNativeNetworkEncryptionNNE
		return nil
	}

	var destinationOracleUpdateTLSEncryptedVerifyCertificate DestinationOracleUpdateTLSEncryptedVerifyCertificate = DestinationOracleUpdateTLSEncryptedVerifyCertificate{}
	if err := utils.UnmarshalJSON(data, &destinationOracleUpdateTLSEncryptedVerifyCertificate, "", true, true); err == nil {
		u.DestinationOracleUpdateTLSEncryptedVerifyCertificate = &destinationOracleUpdateTLSEncryptedVerifyCertificate
		u.Type = DestinationOracleUpdateEncryptionTypeDestinationOracleUpdateTLSEncryptedVerifyCertificate
		return nil
	}

	return fmt.Errorf("could not unmarshal `%s` into any supported union types for DestinationOracleUpdateEncryption", string(data))
}

func (u DestinationOracleUpdateEncryption) MarshalJSON() ([]byte, error) {
	if u.DestinationOracleUpdateUnencrypted != nil {
		return utils.MarshalJSON(u.DestinationOracleUpdateUnencrypted, "", true)
	}

	if u.DestinationOracleUpdateNativeNetworkEncryptionNNE != nil {
		return utils.MarshalJSON(u.DestinationOracleUpdateNativeNetworkEncryptionNNE, "", true)
	}

	if u.DestinationOracleUpdateTLSEncryptedVerifyCertificate != nil {
		return utils.MarshalJSON(u.DestinationOracleUpdateTLSEncryptedVerifyCertificate, "", true)
	}

	return nil, errors.New("could not marshal union type DestinationOracleUpdateEncryption: all fields are null")
}

// DestinationOracleUpdateSchemasTunnelMethodTunnelMethod - Connect through a jump server tunnel host using username and password authentication
type DestinationOracleUpdateSchemasTunnelMethodTunnelMethod string

const (
	DestinationOracleUpdateSchemasTunnelMethodTunnelMethodSSHPasswordAuth DestinationOracleUpdateSchemasTunnelMethodTunnelMethod = "SSH_PASSWORD_AUTH"
)

func (e DestinationOracleUpdateSchemasTunnelMethodTunnelMethod) ToPointer() *DestinationOracleUpdateSchemasTunnelMethodTunnelMethod {
	return &e
}
func (e *DestinationOracleUpdateSchemasTunnelMethodTunnelMethod) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "SSH_PASSWORD_AUTH":
		*e = DestinationOracleUpdateSchemasTunnelMethodTunnelMethod(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DestinationOracleUpdateSchemasTunnelMethodTunnelMethod: %v", v)
	}
}

type DestinationOracleUpdatePasswordAuthentication struct {
	// Hostname of the jump server host that allows inbound ssh tunnel.
	TunnelHost string `json:"tunnel_host"`
	// Connect through a jump server tunnel host using username and password authentication
	tunnelMethod DestinationOracleUpdateSchemasTunnelMethodTunnelMethod `const:"SSH_PASSWORD_AUTH" json:"tunnel_method"`
	// Port on the proxy/jump server that accepts inbound ssh connections.
	TunnelPort *int64 `default:"22" json:"tunnel_port"`
	// OS-level username for logging into the jump server host
	TunnelUser string `json:"tunnel_user"`
	// OS-level password for logging into the jump server host
	TunnelUserPassword string `json:"tunnel_user_password"`
}

func (d DestinationOracleUpdatePasswordAuthentication) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

func (d *DestinationOracleUpdatePasswordAuthentication) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &d, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *DestinationOracleUpdatePasswordAuthentication) GetTunnelHost() string {
	if o == nil {
		return ""
	}
	return o.TunnelHost
}

func (o *DestinationOracleUpdatePasswordAuthentication) GetTunnelMethod() DestinationOracleUpdateSchemasTunnelMethodTunnelMethod {
	return DestinationOracleUpdateSchemasTunnelMethodTunnelMethodSSHPasswordAuth
}

func (o *DestinationOracleUpdatePasswordAuthentication) GetTunnelPort() *int64 {
	if o == nil {
		return nil
	}
	return o.TunnelPort
}

func (o *DestinationOracleUpdatePasswordAuthentication) GetTunnelUser() string {
	if o == nil {
		return ""
	}
	return o.TunnelUser
}

func (o *DestinationOracleUpdatePasswordAuthentication) GetTunnelUserPassword() string {
	if o == nil {
		return ""
	}
	return o.TunnelUserPassword
}

// DestinationOracleUpdateSchemasTunnelMethod - Connect through a jump server tunnel host using username and ssh key
type DestinationOracleUpdateSchemasTunnelMethod string

const (
	DestinationOracleUpdateSchemasTunnelMethodSSHKeyAuth DestinationOracleUpdateSchemasTunnelMethod = "SSH_KEY_AUTH"
)

func (e DestinationOracleUpdateSchemasTunnelMethod) ToPointer() *DestinationOracleUpdateSchemasTunnelMethod {
	return &e
}
func (e *DestinationOracleUpdateSchemasTunnelMethod) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "SSH_KEY_AUTH":
		*e = DestinationOracleUpdateSchemasTunnelMethod(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DestinationOracleUpdateSchemasTunnelMethod: %v", v)
	}
}

type DestinationOracleUpdateSSHKeyAuthentication struct {
	// OS-level user account ssh key credentials in RSA PEM format ( created with ssh-keygen -t rsa -m PEM -f myuser_rsa )
	SSHKey string `json:"ssh_key"`
	// Hostname of the jump server host that allows inbound ssh tunnel.
	TunnelHost string `json:"tunnel_host"`
	// Connect through a jump server tunnel host using username and ssh key
	tunnelMethod DestinationOracleUpdateSchemasTunnelMethod `const:"SSH_KEY_AUTH" json:"tunnel_method"`
	// Port on the proxy/jump server that accepts inbound ssh connections.
	TunnelPort *int64 `default:"22" json:"tunnel_port"`
	// OS-level username for logging into the jump server host.
	TunnelUser string `json:"tunnel_user"`
}

func (d DestinationOracleUpdateSSHKeyAuthentication) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

func (d *DestinationOracleUpdateSSHKeyAuthentication) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &d, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *DestinationOracleUpdateSSHKeyAuthentication) GetSSHKey() string {
	if o == nil {
		return ""
	}
	return o.SSHKey
}

func (o *DestinationOracleUpdateSSHKeyAuthentication) GetTunnelHost() string {
	if o == nil {
		return ""
	}
	return o.TunnelHost
}

func (o *DestinationOracleUpdateSSHKeyAuthentication) GetTunnelMethod() DestinationOracleUpdateSchemasTunnelMethod {
	return DestinationOracleUpdateSchemasTunnelMethodSSHKeyAuth
}

func (o *DestinationOracleUpdateSSHKeyAuthentication) GetTunnelPort() *int64 {
	if o == nil {
		return nil
	}
	return o.TunnelPort
}

func (o *DestinationOracleUpdateSSHKeyAuthentication) GetTunnelUser() string {
	if o == nil {
		return ""
	}
	return o.TunnelUser
}

// DestinationOracleUpdateTunnelMethod - No ssh tunnel needed to connect to database
type DestinationOracleUpdateTunnelMethod string

const (
	DestinationOracleUpdateTunnelMethodNoTunnel DestinationOracleUpdateTunnelMethod = "NO_TUNNEL"
)

func (e DestinationOracleUpdateTunnelMethod) ToPointer() *DestinationOracleUpdateTunnelMethod {
	return &e
}
func (e *DestinationOracleUpdateTunnelMethod) UnmarshalJSON(data []byte) error {
	var v string
	if err := json.Unmarshal(data, &v); err != nil {
		return err
	}
	switch v {
	case "NO_TUNNEL":
		*e = DestinationOracleUpdateTunnelMethod(v)
		return nil
	default:
		return fmt.Errorf("invalid value for DestinationOracleUpdateTunnelMethod: %v", v)
	}
}

type DestinationOracleUpdateNoTunnel struct {
	// No ssh tunnel needed to connect to database
	tunnelMethod DestinationOracleUpdateTunnelMethod `const:"NO_TUNNEL" json:"tunnel_method"`
}

func (d DestinationOracleUpdateNoTunnel) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

func (d *DestinationOracleUpdateNoTunnel) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &d, "", false, true); err != nil {
		return err
	}
	return nil
}

func (o *DestinationOracleUpdateNoTunnel) GetTunnelMethod() DestinationOracleUpdateTunnelMethod {
	return DestinationOracleUpdateTunnelMethodNoTunnel
}

type DestinationOracleUpdateSSHTunnelMethodType string

const (
	DestinationOracleUpdateSSHTunnelMethodTypeDestinationOracleUpdateNoTunnel               DestinationOracleUpdateSSHTunnelMethodType = "destination-oracle-update_No Tunnel"
	DestinationOracleUpdateSSHTunnelMethodTypeDestinationOracleUpdateSSHKeyAuthentication   DestinationOracleUpdateSSHTunnelMethodType = "destination-oracle-update_SSH Key Authentication"
	DestinationOracleUpdateSSHTunnelMethodTypeDestinationOracleUpdatePasswordAuthentication DestinationOracleUpdateSSHTunnelMethodType = "destination-oracle-update_Password Authentication"
)

// DestinationOracleUpdateSSHTunnelMethod - Whether to initiate an SSH tunnel before connecting to the database, and if so, which kind of authentication to use.
type DestinationOracleUpdateSSHTunnelMethod struct {
	DestinationOracleUpdateNoTunnel               *DestinationOracleUpdateNoTunnel               `queryParam:"inline"`
	DestinationOracleUpdateSSHKeyAuthentication   *DestinationOracleUpdateSSHKeyAuthentication   `queryParam:"inline"`
	DestinationOracleUpdatePasswordAuthentication *DestinationOracleUpdatePasswordAuthentication `queryParam:"inline"`

	Type DestinationOracleUpdateSSHTunnelMethodType
}

func CreateDestinationOracleUpdateSSHTunnelMethodDestinationOracleUpdateNoTunnel(destinationOracleUpdateNoTunnel DestinationOracleUpdateNoTunnel) DestinationOracleUpdateSSHTunnelMethod {
	typ := DestinationOracleUpdateSSHTunnelMethodTypeDestinationOracleUpdateNoTunnel

	return DestinationOracleUpdateSSHTunnelMethod{
		DestinationOracleUpdateNoTunnel: &destinationOracleUpdateNoTunnel,
		Type:                            typ,
	}
}

func CreateDestinationOracleUpdateSSHTunnelMethodDestinationOracleUpdateSSHKeyAuthentication(destinationOracleUpdateSSHKeyAuthentication DestinationOracleUpdateSSHKeyAuthentication) DestinationOracleUpdateSSHTunnelMethod {
	typ := DestinationOracleUpdateSSHTunnelMethodTypeDestinationOracleUpdateSSHKeyAuthentication

	return DestinationOracleUpdateSSHTunnelMethod{
		DestinationOracleUpdateSSHKeyAuthentication: &destinationOracleUpdateSSHKeyAuthentication,
		Type: typ,
	}
}

func CreateDestinationOracleUpdateSSHTunnelMethodDestinationOracleUpdatePasswordAuthentication(destinationOracleUpdatePasswordAuthentication DestinationOracleUpdatePasswordAuthentication) DestinationOracleUpdateSSHTunnelMethod {
	typ := DestinationOracleUpdateSSHTunnelMethodTypeDestinationOracleUpdatePasswordAuthentication

	return DestinationOracleUpdateSSHTunnelMethod{
		DestinationOracleUpdatePasswordAuthentication: &destinationOracleUpdatePasswordAuthentication,
		Type: typ,
	}
}

func (u *DestinationOracleUpdateSSHTunnelMethod) UnmarshalJSON(data []byte) error {

	var destinationOracleUpdateNoTunnel DestinationOracleUpdateNoTunnel = DestinationOracleUpdateNoTunnel{}
	if err := utils.UnmarshalJSON(data, &destinationOracleUpdateNoTunnel, "", true, true); err == nil {
		u.DestinationOracleUpdateNoTunnel = &destinationOracleUpdateNoTunnel
		u.Type = DestinationOracleUpdateSSHTunnelMethodTypeDestinationOracleUpdateNoTunnel
		return nil
	}

	var destinationOracleUpdateSSHKeyAuthentication DestinationOracleUpdateSSHKeyAuthentication = DestinationOracleUpdateSSHKeyAuthentication{}
	if err := utils.UnmarshalJSON(data, &destinationOracleUpdateSSHKeyAuthentication, "", true, true); err == nil {
		u.DestinationOracleUpdateSSHKeyAuthentication = &destinationOracleUpdateSSHKeyAuthentication
		u.Type = DestinationOracleUpdateSSHTunnelMethodTypeDestinationOracleUpdateSSHKeyAuthentication
		return nil
	}

	var destinationOracleUpdatePasswordAuthentication DestinationOracleUpdatePasswordAuthentication = DestinationOracleUpdatePasswordAuthentication{}
	if err := utils.UnmarshalJSON(data, &destinationOracleUpdatePasswordAuthentication, "", true, true); err == nil {
		u.DestinationOracleUpdatePasswordAuthentication = &destinationOracleUpdatePasswordAuthentication
		u.Type = DestinationOracleUpdateSSHTunnelMethodTypeDestinationOracleUpdatePasswordAuthentication
		return nil
	}

	return fmt.Errorf("could not unmarshal `%s` into any supported union types for DestinationOracleUpdateSSHTunnelMethod", string(data))
}

func (u DestinationOracleUpdateSSHTunnelMethod) MarshalJSON() ([]byte, error) {
	if u.DestinationOracleUpdateNoTunnel != nil {
		return utils.MarshalJSON(u.DestinationOracleUpdateNoTunnel, "", true)
	}

	if u.DestinationOracleUpdateSSHKeyAuthentication != nil {
		return utils.MarshalJSON(u.DestinationOracleUpdateSSHKeyAuthentication, "", true)
	}

	if u.DestinationOracleUpdatePasswordAuthentication != nil {
		return utils.MarshalJSON(u.DestinationOracleUpdatePasswordAuthentication, "", true)
	}

	return nil, errors.New("could not marshal union type DestinationOracleUpdateSSHTunnelMethod: all fields are null")
}

type DestinationOracleUpdate struct {
	// The encryption method which is used when communicating with the database.
	Encryption *DestinationOracleUpdateEncryption `json:"encryption,omitempty"`
	// The hostname of the database.
	Host string `json:"host"`
	// Additional properties to pass to the JDBC URL string when connecting to the database formatted as 'key=value' pairs separated by the symbol '&'. (example: key1=value1&key2=value2&key3=value3).
	JdbcURLParams *string `json:"jdbc_url_params,omitempty"`
	// The password associated with the username.
	Password *string `json:"password,omitempty"`
	// The port of the database.
	Port *int64 `default:"1521" json:"port"`
	// The schema to write raw tables into (default: airbyte_internal)
	RawDataSchema *string `json:"raw_data_schema,omitempty"`
	// The default schema is used as the target schema for all statements issued from the connection that do not explicitly specify a schema name. The usual value for this field is "airbyte".  In Oracle, schemas and users are the same thing, so the "user" parameter is used as the login credentials and this is used for the default Airbyte message schema.
	Schema *string `default:"airbyte" json:"schema"`
	// The System Identifier uniquely distinguishes the instance from any other instance on the same computer.
	Sid string `json:"sid"`
	// Whether to initiate an SSH tunnel before connecting to the database, and if so, which kind of authentication to use.
	TunnelMethod *DestinationOracleUpdateSSHTunnelMethod `json:"tunnel_method,omitempty"`
	// The username to access the database. This user must have CREATE USER privileges in the database.
	Username string `json:"username"`
}

func (d DestinationOracleUpdate) MarshalJSON() ([]byte, error) {
	return utils.MarshalJSON(d, "", false)
}

func (d *DestinationOracleUpdate) UnmarshalJSON(data []byte) error {
	if err := utils.UnmarshalJSON(data, &d, "", false, false); err != nil {
		return err
	}
	return nil
}

func (o *DestinationOracleUpdate) GetEncryption() *DestinationOracleUpdateEncryption {
	if o == nil {
		return nil
	}
	return o.Encryption
}

func (o *DestinationOracleUpdate) GetHost() string {
	if o == nil {
		return ""
	}
	return o.Host
}

func (o *DestinationOracleUpdate) GetJdbcURLParams() *string {
	if o == nil {
		return nil
	}
	return o.JdbcURLParams
}

func (o *DestinationOracleUpdate) GetPassword() *string {
	if o == nil {
		return nil
	}
	return o.Password
}

func (o *DestinationOracleUpdate) GetPort() *int64 {
	if o == nil {
		return nil
	}
	return o.Port
}

func (o *DestinationOracleUpdate) GetRawDataSchema() *string {
	if o == nil {
		return nil
	}
	return o.RawDataSchema
}

func (o *DestinationOracleUpdate) GetSchema() *string {
	if o == nil {
		return nil
	}
	return o.Schema
}

func (o *DestinationOracleUpdate) GetSid() string {
	if o == nil {
		return ""
	}
	return o.Sid
}

func (o *DestinationOracleUpdate) GetTunnelMethod() *DestinationOracleUpdateSSHTunnelMethod {
	if o == nil {
		return nil
	}
	return o.TunnelMethod
}

func (o *DestinationOracleUpdate) GetUsername() string {
	if o == nil {
		return ""
	}
	return o.Username
}
