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

package provider

import (
	"encoding/json"
	tfTypes "github.com/airbytehq/terraform-provider-airbyte/internal/provider/types"
	"github.com/airbytehq/terraform-provider-airbyte/internal/sdk/models/shared"
	"github.com/hashicorp/terraform-plugin-framework/types"
)

func (r *SourceMysqlResourceModel) ToSharedSourceMysqlCreateRequest() *shared.SourceMysqlCreateRequest {
	var name string
	name = r.Name.ValueString()

	definitionID := new(string)
	if !r.DefinitionID.IsUnknown() && !r.DefinitionID.IsNull() {
		*definitionID = r.DefinitionID.ValueString()
	} else {
		definitionID = nil
	}
	var workspaceID string
	workspaceID = r.WorkspaceID.ValueString()

	checkPrivileges := new(bool)
	if !r.Configuration.CheckPrivileges.IsUnknown() && !r.Configuration.CheckPrivileges.IsNull() {
		*checkPrivileges = r.Configuration.CheckPrivileges.ValueBool()
	} else {
		checkPrivileges = nil
	}
	checkpointTargetIntervalSeconds := new(int64)
	if !r.Configuration.CheckpointTargetIntervalSeconds.IsUnknown() && !r.Configuration.CheckpointTargetIntervalSeconds.IsNull() {
		*checkpointTargetIntervalSeconds = r.Configuration.CheckpointTargetIntervalSeconds.ValueInt64()
	} else {
		checkpointTargetIntervalSeconds = nil
	}
	concurrency := new(int64)
	if !r.Configuration.Concurrency.IsUnknown() && !r.Configuration.Concurrency.IsNull() {
		*concurrency = r.Configuration.Concurrency.ValueInt64()
	} else {
		concurrency = nil
	}
	var database string
	database = r.Configuration.Database.ValueString()

	var host string
	host = r.Configuration.Host.ValueString()

	jdbcURLParams := new(string)
	if !r.Configuration.JdbcURLParams.IsUnknown() && !r.Configuration.JdbcURLParams.IsNull() {
		*jdbcURLParams = r.Configuration.JdbcURLParams.ValueString()
	} else {
		jdbcURLParams = nil
	}
	password := new(string)
	if !r.Configuration.Password.IsUnknown() && !r.Configuration.Password.IsNull() {
		*password = r.Configuration.Password.ValueString()
	} else {
		password = nil
	}
	port := new(int64)
	if !r.Configuration.Port.IsUnknown() && !r.Configuration.Port.IsNull() {
		*port = r.Configuration.Port.ValueInt64()
	} else {
		port = nil
	}
	var replicationMethod shared.SourceMysqlUpdateMethod
	var sourceMysqlScanChangesWithUserDefinedCursor *shared.SourceMysqlScanChangesWithUserDefinedCursor
	if r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor != nil {
		method := new(shared.SourceMysqlMethod)
		if !r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.Method.IsUnknown() && !r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.Method.IsNull() {
			*method = shared.SourceMysqlMethod(r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.Method.ValueString())
		} else {
			method = nil
		}
		var additionalProperties interface{}
		if !r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.AdditionalProperties.IsUnknown() && !r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.AdditionalProperties.IsNull() {
			_ = json.Unmarshal([]byte(r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.AdditionalProperties.ValueString()), &additionalProperties)
		}
		sourceMysqlScanChangesWithUserDefinedCursor = &shared.SourceMysqlScanChangesWithUserDefinedCursor{
			Method:               method,
			AdditionalProperties: additionalProperties,
		}
	}
	if sourceMysqlScanChangesWithUserDefinedCursor != nil {
		replicationMethod = shared.SourceMysqlUpdateMethod{
			SourceMysqlScanChangesWithUserDefinedCursor: sourceMysqlScanChangesWithUserDefinedCursor,
		}
	}
	var sourceMysqlReadChangesUsingChangeDataCaptureCDC *shared.SourceMysqlReadChangesUsingChangeDataCaptureCDC
	if r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC != nil {
		initialLoadTimeoutHours := new(int64)
		if !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InitialLoadTimeoutHours.IsUnknown() && !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InitialLoadTimeoutHours.IsNull() {
			*initialLoadTimeoutHours = r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InitialLoadTimeoutHours.ValueInt64()
		} else {
			initialLoadTimeoutHours = nil
		}
		invalidCdcCursorPositionBehavior := new(shared.SourceMysqlInvalidCDCPositionBehaviorAdvanced)
		if !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InvalidCdcCursorPositionBehavior.IsUnknown() && !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InvalidCdcCursorPositionBehavior.IsNull() {
			*invalidCdcCursorPositionBehavior = shared.SourceMysqlInvalidCDCPositionBehaviorAdvanced(r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InvalidCdcCursorPositionBehavior.ValueString())
		} else {
			invalidCdcCursorPositionBehavior = nil
		}
		method1 := new(shared.SourceMysqlSchemasMethod)
		if !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.Method.IsUnknown() && !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.Method.IsNull() {
			*method1 = shared.SourceMysqlSchemasMethod(r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.Method.ValueString())
		} else {
			method1 = nil
		}
		serverTimezone := new(string)
		if !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.ServerTimezone.IsUnknown() && !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.ServerTimezone.IsNull() {
			*serverTimezone = r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.ServerTimezone.ValueString()
		} else {
			serverTimezone = nil
		}
		var additionalProperties1 interface{}
		if !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.AdditionalProperties.IsUnknown() && !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.AdditionalProperties.IsNull() {
			_ = json.Unmarshal([]byte(r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.AdditionalProperties.ValueString()), &additionalProperties1)
		}
		sourceMysqlReadChangesUsingChangeDataCaptureCDC = &shared.SourceMysqlReadChangesUsingChangeDataCaptureCDC{
			InitialLoadTimeoutHours:          initialLoadTimeoutHours,
			InvalidCdcCursorPositionBehavior: invalidCdcCursorPositionBehavior,
			Method:                           method1,
			ServerTimezone:                   serverTimezone,
			AdditionalProperties:             additionalProperties1,
		}
	}
	if sourceMysqlReadChangesUsingChangeDataCaptureCDC != nil {
		replicationMethod = shared.SourceMysqlUpdateMethod{
			SourceMysqlReadChangesUsingChangeDataCaptureCDC: sourceMysqlReadChangesUsingChangeDataCaptureCDC,
		}
	}
	var sslMode *shared.SourceMysqlEncryption
	if r.Configuration.SslMode != nil {
		var preferred *shared.Preferred
		if r.Configuration.SslMode.Preferred != nil {
			mode := new(shared.SourceMysqlMode)
			if !r.Configuration.SslMode.Preferred.Mode.IsUnknown() && !r.Configuration.SslMode.Preferred.Mode.IsNull() {
				*mode = shared.SourceMysqlMode(r.Configuration.SslMode.Preferred.Mode.ValueString())
			} else {
				mode = nil
			}
			var additionalProperties2 interface{}
			if !r.Configuration.SslMode.Preferred.AdditionalProperties.IsUnknown() && !r.Configuration.SslMode.Preferred.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.SslMode.Preferred.AdditionalProperties.ValueString()), &additionalProperties2)
			}
			preferred = &shared.Preferred{
				Mode:                 mode,
				AdditionalProperties: additionalProperties2,
			}
		}
		if preferred != nil {
			sslMode = &shared.SourceMysqlEncryption{
				Preferred: preferred,
			}
		}
		var required *shared.Required
		if r.Configuration.SslMode.Required != nil {
			mode1 := new(shared.SourceMysqlSchemasMode)
			if !r.Configuration.SslMode.Required.Mode.IsUnknown() && !r.Configuration.SslMode.Required.Mode.IsNull() {
				*mode1 = shared.SourceMysqlSchemasMode(r.Configuration.SslMode.Required.Mode.ValueString())
			} else {
				mode1 = nil
			}
			var additionalProperties3 interface{}
			if !r.Configuration.SslMode.Required.AdditionalProperties.IsUnknown() && !r.Configuration.SslMode.Required.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.SslMode.Required.AdditionalProperties.ValueString()), &additionalProperties3)
			}
			required = &shared.Required{
				Mode:                 mode1,
				AdditionalProperties: additionalProperties3,
			}
		}
		if required != nil {
			sslMode = &shared.SourceMysqlEncryption{
				Required: required,
			}
		}
		var verifyCa *shared.VerifyCa
		if r.Configuration.SslMode.VerifyCa != nil {
			var caCertificate string
			caCertificate = r.Configuration.SslMode.VerifyCa.CaCertificate.ValueString()

			clientCertificate := new(string)
			if !r.Configuration.SslMode.VerifyCa.ClientCertificate.IsUnknown() && !r.Configuration.SslMode.VerifyCa.ClientCertificate.IsNull() {
				*clientCertificate = r.Configuration.SslMode.VerifyCa.ClientCertificate.ValueString()
			} else {
				clientCertificate = nil
			}
			clientKey := new(string)
			if !r.Configuration.SslMode.VerifyCa.ClientKey.IsUnknown() && !r.Configuration.SslMode.VerifyCa.ClientKey.IsNull() {
				*clientKey = r.Configuration.SslMode.VerifyCa.ClientKey.ValueString()
			} else {
				clientKey = nil
			}
			clientKeyPassword := new(string)
			if !r.Configuration.SslMode.VerifyCa.ClientKeyPassword.IsUnknown() && !r.Configuration.SslMode.VerifyCa.ClientKeyPassword.IsNull() {
				*clientKeyPassword = r.Configuration.SslMode.VerifyCa.ClientKeyPassword.ValueString()
			} else {
				clientKeyPassword = nil
			}
			mode2 := new(shared.SourceMysqlSchemasSslModeMode)
			if !r.Configuration.SslMode.VerifyCa.Mode.IsUnknown() && !r.Configuration.SslMode.VerifyCa.Mode.IsNull() {
				*mode2 = shared.SourceMysqlSchemasSslModeMode(r.Configuration.SslMode.VerifyCa.Mode.ValueString())
			} else {
				mode2 = nil
			}
			var additionalProperties4 interface{}
			if !r.Configuration.SslMode.VerifyCa.AdditionalProperties.IsUnknown() && !r.Configuration.SslMode.VerifyCa.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.SslMode.VerifyCa.AdditionalProperties.ValueString()), &additionalProperties4)
			}
			verifyCa = &shared.VerifyCa{
				CaCertificate:        caCertificate,
				ClientCertificate:    clientCertificate,
				ClientKey:            clientKey,
				ClientKeyPassword:    clientKeyPassword,
				Mode:                 mode2,
				AdditionalProperties: additionalProperties4,
			}
		}
		if verifyCa != nil {
			sslMode = &shared.SourceMysqlEncryption{
				VerifyCa: verifyCa,
			}
		}
		var verifyIdentity *shared.VerifyIdentity
		if r.Configuration.SslMode.VerifyIdentity != nil {
			var caCertificate1 string
			caCertificate1 = r.Configuration.SslMode.VerifyIdentity.CaCertificate.ValueString()

			clientCertificate1 := new(string)
			if !r.Configuration.SslMode.VerifyIdentity.ClientCertificate.IsUnknown() && !r.Configuration.SslMode.VerifyIdentity.ClientCertificate.IsNull() {
				*clientCertificate1 = r.Configuration.SslMode.VerifyIdentity.ClientCertificate.ValueString()
			} else {
				clientCertificate1 = nil
			}
			clientKey1 := new(string)
			if !r.Configuration.SslMode.VerifyIdentity.ClientKey.IsUnknown() && !r.Configuration.SslMode.VerifyIdentity.ClientKey.IsNull() {
				*clientKey1 = r.Configuration.SslMode.VerifyIdentity.ClientKey.ValueString()
			} else {
				clientKey1 = nil
			}
			clientKeyPassword1 := new(string)
			if !r.Configuration.SslMode.VerifyIdentity.ClientKeyPassword.IsUnknown() && !r.Configuration.SslMode.VerifyIdentity.ClientKeyPassword.IsNull() {
				*clientKeyPassword1 = r.Configuration.SslMode.VerifyIdentity.ClientKeyPassword.ValueString()
			} else {
				clientKeyPassword1 = nil
			}
			mode3 := new(shared.SourceMysqlSchemasSslModeEncryptionMode)
			if !r.Configuration.SslMode.VerifyIdentity.Mode.IsUnknown() && !r.Configuration.SslMode.VerifyIdentity.Mode.IsNull() {
				*mode3 = shared.SourceMysqlSchemasSslModeEncryptionMode(r.Configuration.SslMode.VerifyIdentity.Mode.ValueString())
			} else {
				mode3 = nil
			}
			var additionalProperties5 interface{}
			if !r.Configuration.SslMode.VerifyIdentity.AdditionalProperties.IsUnknown() && !r.Configuration.SslMode.VerifyIdentity.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.SslMode.VerifyIdentity.AdditionalProperties.ValueString()), &additionalProperties5)
			}
			verifyIdentity = &shared.VerifyIdentity{
				CaCertificate:        caCertificate1,
				ClientCertificate:    clientCertificate1,
				ClientKey:            clientKey1,
				ClientKeyPassword:    clientKeyPassword1,
				Mode:                 mode3,
				AdditionalProperties: additionalProperties5,
			}
		}
		if verifyIdentity != nil {
			sslMode = &shared.SourceMysqlEncryption{
				VerifyIdentity: verifyIdentity,
			}
		}
	}
	var tunnelMethod *shared.SourceMysqlSSHTunnelMethod
	if r.Configuration.TunnelMethod != nil {
		var sourceMysqlNoTunnel *shared.SourceMysqlNoTunnel
		if r.Configuration.TunnelMethod.NoTunnel != nil {
			tunnelMethod1 := new(shared.SourceMysqlTunnelMethod)
			if !r.Configuration.TunnelMethod.NoTunnel.TunnelMethod.IsUnknown() && !r.Configuration.TunnelMethod.NoTunnel.TunnelMethod.IsNull() {
				*tunnelMethod1 = shared.SourceMysqlTunnelMethod(r.Configuration.TunnelMethod.NoTunnel.TunnelMethod.ValueString())
			} else {
				tunnelMethod1 = nil
			}
			var additionalProperties6 interface{}
			if !r.Configuration.TunnelMethod.NoTunnel.AdditionalProperties.IsUnknown() && !r.Configuration.TunnelMethod.NoTunnel.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.TunnelMethod.NoTunnel.AdditionalProperties.ValueString()), &additionalProperties6)
			}
			sourceMysqlNoTunnel = &shared.SourceMysqlNoTunnel{
				TunnelMethod:         tunnelMethod1,
				AdditionalProperties: additionalProperties6,
			}
		}
		if sourceMysqlNoTunnel != nil {
			tunnelMethod = &shared.SourceMysqlSSHTunnelMethod{
				SourceMysqlNoTunnel: sourceMysqlNoTunnel,
			}
		}
		var sourceMysqlSSHKeyAuthentication *shared.SourceMysqlSSHKeyAuthentication
		if r.Configuration.TunnelMethod.SSHKeyAuthentication != nil {
			var sshKey string
			sshKey = r.Configuration.TunnelMethod.SSHKeyAuthentication.SSHKey.ValueString()

			var tunnelHost string
			tunnelHost = r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelHost.ValueString()

			tunnelMethod2 := new(shared.SourceMysqlSchemasTunnelMethod)
			if !r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelMethod.IsUnknown() && !r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelMethod.IsNull() {
				*tunnelMethod2 = shared.SourceMysqlSchemasTunnelMethod(r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelMethod.ValueString())
			} else {
				tunnelMethod2 = nil
			}
			tunnelPort := new(int64)
			if !r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelPort.IsUnknown() && !r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelPort.IsNull() {
				*tunnelPort = r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelPort.ValueInt64()
			} else {
				tunnelPort = nil
			}
			var tunnelUser string
			tunnelUser = r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelUser.ValueString()

			var additionalProperties7 interface{}
			if !r.Configuration.TunnelMethod.SSHKeyAuthentication.AdditionalProperties.IsUnknown() && !r.Configuration.TunnelMethod.SSHKeyAuthentication.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.TunnelMethod.SSHKeyAuthentication.AdditionalProperties.ValueString()), &additionalProperties7)
			}
			sourceMysqlSSHKeyAuthentication = &shared.SourceMysqlSSHKeyAuthentication{
				SSHKey:               sshKey,
				TunnelHost:           tunnelHost,
				TunnelMethod:         tunnelMethod2,
				TunnelPort:           tunnelPort,
				TunnelUser:           tunnelUser,
				AdditionalProperties: additionalProperties7,
			}
		}
		if sourceMysqlSSHKeyAuthentication != nil {
			tunnelMethod = &shared.SourceMysqlSSHTunnelMethod{
				SourceMysqlSSHKeyAuthentication: sourceMysqlSSHKeyAuthentication,
			}
		}
		var sourceMysqlPasswordAuthentication *shared.SourceMysqlPasswordAuthentication
		if r.Configuration.TunnelMethod.PasswordAuthentication != nil {
			var tunnelHost1 string
			tunnelHost1 = r.Configuration.TunnelMethod.PasswordAuthentication.TunnelHost.ValueString()

			tunnelMethod3 := new(shared.SourceMysqlSchemasTunnelMethodTunnelMethod)
			if !r.Configuration.TunnelMethod.PasswordAuthentication.TunnelMethod.IsUnknown() && !r.Configuration.TunnelMethod.PasswordAuthentication.TunnelMethod.IsNull() {
				*tunnelMethod3 = shared.SourceMysqlSchemasTunnelMethodTunnelMethod(r.Configuration.TunnelMethod.PasswordAuthentication.TunnelMethod.ValueString())
			} else {
				tunnelMethod3 = nil
			}
			tunnelPort1 := new(int64)
			if !r.Configuration.TunnelMethod.PasswordAuthentication.TunnelPort.IsUnknown() && !r.Configuration.TunnelMethod.PasswordAuthentication.TunnelPort.IsNull() {
				*tunnelPort1 = r.Configuration.TunnelMethod.PasswordAuthentication.TunnelPort.ValueInt64()
			} else {
				tunnelPort1 = nil
			}
			var tunnelUser1 string
			tunnelUser1 = r.Configuration.TunnelMethod.PasswordAuthentication.TunnelUser.ValueString()

			var tunnelUserPassword string
			tunnelUserPassword = r.Configuration.TunnelMethod.PasswordAuthentication.TunnelUserPassword.ValueString()

			var additionalProperties8 interface{}
			if !r.Configuration.TunnelMethod.PasswordAuthentication.AdditionalProperties.IsUnknown() && !r.Configuration.TunnelMethod.PasswordAuthentication.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.TunnelMethod.PasswordAuthentication.AdditionalProperties.ValueString()), &additionalProperties8)
			}
			sourceMysqlPasswordAuthentication = &shared.SourceMysqlPasswordAuthentication{
				TunnelHost:           tunnelHost1,
				TunnelMethod:         tunnelMethod3,
				TunnelPort:           tunnelPort1,
				TunnelUser:           tunnelUser1,
				TunnelUserPassword:   tunnelUserPassword,
				AdditionalProperties: additionalProperties8,
			}
		}
		if sourceMysqlPasswordAuthentication != nil {
			tunnelMethod = &shared.SourceMysqlSSHTunnelMethod{
				SourceMysqlPasswordAuthentication: sourceMysqlPasswordAuthentication,
			}
		}
	}
	var username string
	username = r.Configuration.Username.ValueString()

	configuration := shared.SourceMysql{
		CheckPrivileges:                 checkPrivileges,
		CheckpointTargetIntervalSeconds: checkpointTargetIntervalSeconds,
		Concurrency:                     concurrency,
		Database:                        database,
		Host:                            host,
		JdbcURLParams:                   jdbcURLParams,
		Password:                        password,
		Port:                            port,
		ReplicationMethod:               replicationMethod,
		SslMode:                         sslMode,
		TunnelMethod:                    tunnelMethod,
		Username:                        username,
	}
	secretID := new(string)
	if !r.SecretID.IsUnknown() && !r.SecretID.IsNull() {
		*secretID = r.SecretID.ValueString()
	} else {
		secretID = nil
	}
	out := shared.SourceMysqlCreateRequest{
		Name:          name,
		DefinitionID:  definitionID,
		WorkspaceID:   workspaceID,
		Configuration: configuration,
		SecretID:      secretID,
	}
	return &out
}

func (r *SourceMysqlResourceModel) RefreshFromSharedSourceResponse(resp *shared.SourceResponse) {
	if resp != nil {
		r.CreatedAt = types.Int64Value(resp.CreatedAt)
		r.DefinitionID = types.StringValue(resp.DefinitionID)
		r.Name = types.StringValue(resp.Name)
		if resp.ResourceAllocation == nil {
			r.ResourceAllocation = nil
		} else {
			r.ResourceAllocation = &tfTypes.ScopedResourceRequirements{}
			if resp.ResourceAllocation.Default == nil {
				r.ResourceAllocation.Default = nil
			} else {
				r.ResourceAllocation.Default = &tfTypes.ResourceRequirements{}
				r.ResourceAllocation.Default.CPULimit = types.StringPointerValue(resp.ResourceAllocation.Default.CPULimit)
				r.ResourceAllocation.Default.CPURequest = types.StringPointerValue(resp.ResourceAllocation.Default.CPURequest)
				r.ResourceAllocation.Default.EphemeralStorageLimit = types.StringPointerValue(resp.ResourceAllocation.Default.EphemeralStorageLimit)
				r.ResourceAllocation.Default.EphemeralStorageRequest = types.StringPointerValue(resp.ResourceAllocation.Default.EphemeralStorageRequest)
				r.ResourceAllocation.Default.MemoryLimit = types.StringPointerValue(resp.ResourceAllocation.Default.MemoryLimit)
				r.ResourceAllocation.Default.MemoryRequest = types.StringPointerValue(resp.ResourceAllocation.Default.MemoryRequest)
			}
			r.ResourceAllocation.JobSpecific = []tfTypes.JobTypeResourceLimit{}
			if len(r.ResourceAllocation.JobSpecific) > len(resp.ResourceAllocation.JobSpecific) {
				r.ResourceAllocation.JobSpecific = r.ResourceAllocation.JobSpecific[:len(resp.ResourceAllocation.JobSpecific)]
			}
			for jobSpecificCount, jobSpecificItem := range resp.ResourceAllocation.JobSpecific {
				var jobSpecific1 tfTypes.JobTypeResourceLimit
				jobSpecific1.JobType = types.StringValue(string(jobSpecificItem.JobType))
				jobSpecific1.ResourceRequirements.CPULimit = types.StringPointerValue(jobSpecificItem.ResourceRequirements.CPULimit)
				jobSpecific1.ResourceRequirements.CPURequest = types.StringPointerValue(jobSpecificItem.ResourceRequirements.CPURequest)
				jobSpecific1.ResourceRequirements.EphemeralStorageLimit = types.StringPointerValue(jobSpecificItem.ResourceRequirements.EphemeralStorageLimit)
				jobSpecific1.ResourceRequirements.EphemeralStorageRequest = types.StringPointerValue(jobSpecificItem.ResourceRequirements.EphemeralStorageRequest)
				jobSpecific1.ResourceRequirements.MemoryLimit = types.StringPointerValue(jobSpecificItem.ResourceRequirements.MemoryLimit)
				jobSpecific1.ResourceRequirements.MemoryRequest = types.StringPointerValue(jobSpecificItem.ResourceRequirements.MemoryRequest)
				if jobSpecificCount+1 > len(r.ResourceAllocation.JobSpecific) {
					r.ResourceAllocation.JobSpecific = append(r.ResourceAllocation.JobSpecific, jobSpecific1)
				} else {
					r.ResourceAllocation.JobSpecific[jobSpecificCount].JobType = jobSpecific1.JobType
					r.ResourceAllocation.JobSpecific[jobSpecificCount].ResourceRequirements = jobSpecific1.ResourceRequirements
				}
			}
		}
		r.SourceID = types.StringValue(resp.SourceID)
		r.SourceType = types.StringValue(resp.SourceType)
		r.WorkspaceID = types.StringValue(resp.WorkspaceID)
	}
}

func (r *SourceMysqlResourceModel) ToSharedSourceMysqlPutRequest() *shared.SourceMysqlPutRequest {
	var name string
	name = r.Name.ValueString()

	var workspaceID string
	workspaceID = r.WorkspaceID.ValueString()

	checkPrivileges := new(bool)
	if !r.Configuration.CheckPrivileges.IsUnknown() && !r.Configuration.CheckPrivileges.IsNull() {
		*checkPrivileges = r.Configuration.CheckPrivileges.ValueBool()
	} else {
		checkPrivileges = nil
	}
	checkpointTargetIntervalSeconds := new(int64)
	if !r.Configuration.CheckpointTargetIntervalSeconds.IsUnknown() && !r.Configuration.CheckpointTargetIntervalSeconds.IsNull() {
		*checkpointTargetIntervalSeconds = r.Configuration.CheckpointTargetIntervalSeconds.ValueInt64()
	} else {
		checkpointTargetIntervalSeconds = nil
	}
	concurrency := new(int64)
	if !r.Configuration.Concurrency.IsUnknown() && !r.Configuration.Concurrency.IsNull() {
		*concurrency = r.Configuration.Concurrency.ValueInt64()
	} else {
		concurrency = nil
	}
	var database string
	database = r.Configuration.Database.ValueString()

	var host string
	host = r.Configuration.Host.ValueString()

	jdbcURLParams := new(string)
	if !r.Configuration.JdbcURLParams.IsUnknown() && !r.Configuration.JdbcURLParams.IsNull() {
		*jdbcURLParams = r.Configuration.JdbcURLParams.ValueString()
	} else {
		jdbcURLParams = nil
	}
	password := new(string)
	if !r.Configuration.Password.IsUnknown() && !r.Configuration.Password.IsNull() {
		*password = r.Configuration.Password.ValueString()
	} else {
		password = nil
	}
	port := new(int64)
	if !r.Configuration.Port.IsUnknown() && !r.Configuration.Port.IsNull() {
		*port = r.Configuration.Port.ValueInt64()
	} else {
		port = nil
	}
	var replicationMethod shared.SourceMysqlUpdateUpdateMethod
	var sourceMysqlUpdateScanChangesWithUserDefinedCursor *shared.SourceMysqlUpdateScanChangesWithUserDefinedCursor
	if r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor != nil {
		method := new(shared.SourceMysqlUpdateSchemasReplicationMethodMethod)
		if !r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.Method.IsUnknown() && !r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.Method.IsNull() {
			*method = shared.SourceMysqlUpdateSchemasReplicationMethodMethod(r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.Method.ValueString())
		} else {
			method = nil
		}
		var additionalProperties interface{}
		if !r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.AdditionalProperties.IsUnknown() && !r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.AdditionalProperties.IsNull() {
			_ = json.Unmarshal([]byte(r.Configuration.ReplicationMethod.ScanChangesWithUserDefinedCursor.AdditionalProperties.ValueString()), &additionalProperties)
		}
		sourceMysqlUpdateScanChangesWithUserDefinedCursor = &shared.SourceMysqlUpdateScanChangesWithUserDefinedCursor{
			Method:               method,
			AdditionalProperties: additionalProperties,
		}
	}
	if sourceMysqlUpdateScanChangesWithUserDefinedCursor != nil {
		replicationMethod = shared.SourceMysqlUpdateUpdateMethod{
			SourceMysqlUpdateScanChangesWithUserDefinedCursor: sourceMysqlUpdateScanChangesWithUserDefinedCursor,
		}
	}
	var sourceMysqlUpdateReadChangesUsingChangeDataCaptureCDC *shared.SourceMysqlUpdateReadChangesUsingChangeDataCaptureCDC
	if r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC != nil {
		initialLoadTimeoutHours := new(int64)
		if !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InitialLoadTimeoutHours.IsUnknown() && !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InitialLoadTimeoutHours.IsNull() {
			*initialLoadTimeoutHours = r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InitialLoadTimeoutHours.ValueInt64()
		} else {
			initialLoadTimeoutHours = nil
		}
		invalidCdcCursorPositionBehavior := new(shared.SourceMysqlUpdateInvalidCDCPositionBehaviorAdvanced)
		if !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InvalidCdcCursorPositionBehavior.IsUnknown() && !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InvalidCdcCursorPositionBehavior.IsNull() {
			*invalidCdcCursorPositionBehavior = shared.SourceMysqlUpdateInvalidCDCPositionBehaviorAdvanced(r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.InvalidCdcCursorPositionBehavior.ValueString())
		} else {
			invalidCdcCursorPositionBehavior = nil
		}
		method1 := new(shared.SourceMysqlUpdateSchemasMethod)
		if !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.Method.IsUnknown() && !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.Method.IsNull() {
			*method1 = shared.SourceMysqlUpdateSchemasMethod(r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.Method.ValueString())
		} else {
			method1 = nil
		}
		serverTimezone := new(string)
		if !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.ServerTimezone.IsUnknown() && !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.ServerTimezone.IsNull() {
			*serverTimezone = r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.ServerTimezone.ValueString()
		} else {
			serverTimezone = nil
		}
		var additionalProperties1 interface{}
		if !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.AdditionalProperties.IsUnknown() && !r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.AdditionalProperties.IsNull() {
			_ = json.Unmarshal([]byte(r.Configuration.ReplicationMethod.ReadChangesUsingChangeDataCaptureCDC.AdditionalProperties.ValueString()), &additionalProperties1)
		}
		sourceMysqlUpdateReadChangesUsingChangeDataCaptureCDC = &shared.SourceMysqlUpdateReadChangesUsingChangeDataCaptureCDC{
			InitialLoadTimeoutHours:          initialLoadTimeoutHours,
			InvalidCdcCursorPositionBehavior: invalidCdcCursorPositionBehavior,
			Method:                           method1,
			ServerTimezone:                   serverTimezone,
			AdditionalProperties:             additionalProperties1,
		}
	}
	if sourceMysqlUpdateReadChangesUsingChangeDataCaptureCDC != nil {
		replicationMethod = shared.SourceMysqlUpdateUpdateMethod{
			SourceMysqlUpdateReadChangesUsingChangeDataCaptureCDC: sourceMysqlUpdateReadChangesUsingChangeDataCaptureCDC,
		}
	}
	var sslMode *shared.SourceMysqlUpdateEncryption
	if r.Configuration.SslMode != nil {
		var sourceMysqlUpdatePreferred *shared.SourceMysqlUpdatePreferred
		if r.Configuration.SslMode.Preferred != nil {
			mode := new(shared.SourceMysqlUpdateMode)
			if !r.Configuration.SslMode.Preferred.Mode.IsUnknown() && !r.Configuration.SslMode.Preferred.Mode.IsNull() {
				*mode = shared.SourceMysqlUpdateMode(r.Configuration.SslMode.Preferred.Mode.ValueString())
			} else {
				mode = nil
			}
			var additionalProperties2 interface{}
			if !r.Configuration.SslMode.Preferred.AdditionalProperties.IsUnknown() && !r.Configuration.SslMode.Preferred.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.SslMode.Preferred.AdditionalProperties.ValueString()), &additionalProperties2)
			}
			sourceMysqlUpdatePreferred = &shared.SourceMysqlUpdatePreferred{
				Mode:                 mode,
				AdditionalProperties: additionalProperties2,
			}
		}
		if sourceMysqlUpdatePreferred != nil {
			sslMode = &shared.SourceMysqlUpdateEncryption{
				SourceMysqlUpdatePreferred: sourceMysqlUpdatePreferred,
			}
		}
		var sourceMysqlUpdateRequired *shared.SourceMysqlUpdateRequired
		if r.Configuration.SslMode.Required != nil {
			mode1 := new(shared.SourceMysqlUpdateSchemasMode)
			if !r.Configuration.SslMode.Required.Mode.IsUnknown() && !r.Configuration.SslMode.Required.Mode.IsNull() {
				*mode1 = shared.SourceMysqlUpdateSchemasMode(r.Configuration.SslMode.Required.Mode.ValueString())
			} else {
				mode1 = nil
			}
			var additionalProperties3 interface{}
			if !r.Configuration.SslMode.Required.AdditionalProperties.IsUnknown() && !r.Configuration.SslMode.Required.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.SslMode.Required.AdditionalProperties.ValueString()), &additionalProperties3)
			}
			sourceMysqlUpdateRequired = &shared.SourceMysqlUpdateRequired{
				Mode:                 mode1,
				AdditionalProperties: additionalProperties3,
			}
		}
		if sourceMysqlUpdateRequired != nil {
			sslMode = &shared.SourceMysqlUpdateEncryption{
				SourceMysqlUpdateRequired: sourceMysqlUpdateRequired,
			}
		}
		var sourceMysqlUpdateVerifyCa *shared.SourceMysqlUpdateVerifyCa
		if r.Configuration.SslMode.VerifyCa != nil {
			var caCertificate string
			caCertificate = r.Configuration.SslMode.VerifyCa.CaCertificate.ValueString()

			clientCertificate := new(string)
			if !r.Configuration.SslMode.VerifyCa.ClientCertificate.IsUnknown() && !r.Configuration.SslMode.VerifyCa.ClientCertificate.IsNull() {
				*clientCertificate = r.Configuration.SslMode.VerifyCa.ClientCertificate.ValueString()
			} else {
				clientCertificate = nil
			}
			clientKey := new(string)
			if !r.Configuration.SslMode.VerifyCa.ClientKey.IsUnknown() && !r.Configuration.SslMode.VerifyCa.ClientKey.IsNull() {
				*clientKey = r.Configuration.SslMode.VerifyCa.ClientKey.ValueString()
			} else {
				clientKey = nil
			}
			clientKeyPassword := new(string)
			if !r.Configuration.SslMode.VerifyCa.ClientKeyPassword.IsUnknown() && !r.Configuration.SslMode.VerifyCa.ClientKeyPassword.IsNull() {
				*clientKeyPassword = r.Configuration.SslMode.VerifyCa.ClientKeyPassword.ValueString()
			} else {
				clientKeyPassword = nil
			}
			mode2 := new(shared.SourceMysqlUpdateSchemasSslModeMode)
			if !r.Configuration.SslMode.VerifyCa.Mode.IsUnknown() && !r.Configuration.SslMode.VerifyCa.Mode.IsNull() {
				*mode2 = shared.SourceMysqlUpdateSchemasSslModeMode(r.Configuration.SslMode.VerifyCa.Mode.ValueString())
			} else {
				mode2 = nil
			}
			var additionalProperties4 interface{}
			if !r.Configuration.SslMode.VerifyCa.AdditionalProperties.IsUnknown() && !r.Configuration.SslMode.VerifyCa.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.SslMode.VerifyCa.AdditionalProperties.ValueString()), &additionalProperties4)
			}
			sourceMysqlUpdateVerifyCa = &shared.SourceMysqlUpdateVerifyCa{
				CaCertificate:        caCertificate,
				ClientCertificate:    clientCertificate,
				ClientKey:            clientKey,
				ClientKeyPassword:    clientKeyPassword,
				Mode:                 mode2,
				AdditionalProperties: additionalProperties4,
			}
		}
		if sourceMysqlUpdateVerifyCa != nil {
			sslMode = &shared.SourceMysqlUpdateEncryption{
				SourceMysqlUpdateVerifyCa: sourceMysqlUpdateVerifyCa,
			}
		}
		var sourceMysqlUpdateVerifyIdentity *shared.SourceMysqlUpdateVerifyIdentity
		if r.Configuration.SslMode.VerifyIdentity != nil {
			var caCertificate1 string
			caCertificate1 = r.Configuration.SslMode.VerifyIdentity.CaCertificate.ValueString()

			clientCertificate1 := new(string)
			if !r.Configuration.SslMode.VerifyIdentity.ClientCertificate.IsUnknown() && !r.Configuration.SslMode.VerifyIdentity.ClientCertificate.IsNull() {
				*clientCertificate1 = r.Configuration.SslMode.VerifyIdentity.ClientCertificate.ValueString()
			} else {
				clientCertificate1 = nil
			}
			clientKey1 := new(string)
			if !r.Configuration.SslMode.VerifyIdentity.ClientKey.IsUnknown() && !r.Configuration.SslMode.VerifyIdentity.ClientKey.IsNull() {
				*clientKey1 = r.Configuration.SslMode.VerifyIdentity.ClientKey.ValueString()
			} else {
				clientKey1 = nil
			}
			clientKeyPassword1 := new(string)
			if !r.Configuration.SslMode.VerifyIdentity.ClientKeyPassword.IsUnknown() && !r.Configuration.SslMode.VerifyIdentity.ClientKeyPassword.IsNull() {
				*clientKeyPassword1 = r.Configuration.SslMode.VerifyIdentity.ClientKeyPassword.ValueString()
			} else {
				clientKeyPassword1 = nil
			}
			mode3 := new(shared.SourceMysqlUpdateSchemasSslModeEncryptionMode)
			if !r.Configuration.SslMode.VerifyIdentity.Mode.IsUnknown() && !r.Configuration.SslMode.VerifyIdentity.Mode.IsNull() {
				*mode3 = shared.SourceMysqlUpdateSchemasSslModeEncryptionMode(r.Configuration.SslMode.VerifyIdentity.Mode.ValueString())
			} else {
				mode3 = nil
			}
			var additionalProperties5 interface{}
			if !r.Configuration.SslMode.VerifyIdentity.AdditionalProperties.IsUnknown() && !r.Configuration.SslMode.VerifyIdentity.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.SslMode.VerifyIdentity.AdditionalProperties.ValueString()), &additionalProperties5)
			}
			sourceMysqlUpdateVerifyIdentity = &shared.SourceMysqlUpdateVerifyIdentity{
				CaCertificate:        caCertificate1,
				ClientCertificate:    clientCertificate1,
				ClientKey:            clientKey1,
				ClientKeyPassword:    clientKeyPassword1,
				Mode:                 mode3,
				AdditionalProperties: additionalProperties5,
			}
		}
		if sourceMysqlUpdateVerifyIdentity != nil {
			sslMode = &shared.SourceMysqlUpdateEncryption{
				SourceMysqlUpdateVerifyIdentity: sourceMysqlUpdateVerifyIdentity,
			}
		}
	}
	var tunnelMethod *shared.SourceMysqlUpdateSSHTunnelMethod
	if r.Configuration.TunnelMethod != nil {
		var sourceMysqlUpdateNoTunnel *shared.SourceMysqlUpdateNoTunnel
		if r.Configuration.TunnelMethod.NoTunnel != nil {
			tunnelMethod1 := new(shared.SourceMysqlUpdateTunnelMethod)
			if !r.Configuration.TunnelMethod.NoTunnel.TunnelMethod.IsUnknown() && !r.Configuration.TunnelMethod.NoTunnel.TunnelMethod.IsNull() {
				*tunnelMethod1 = shared.SourceMysqlUpdateTunnelMethod(r.Configuration.TunnelMethod.NoTunnel.TunnelMethod.ValueString())
			} else {
				tunnelMethod1 = nil
			}
			var additionalProperties6 interface{}
			if !r.Configuration.TunnelMethod.NoTunnel.AdditionalProperties.IsUnknown() && !r.Configuration.TunnelMethod.NoTunnel.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.TunnelMethod.NoTunnel.AdditionalProperties.ValueString()), &additionalProperties6)
			}
			sourceMysqlUpdateNoTunnel = &shared.SourceMysqlUpdateNoTunnel{
				TunnelMethod:         tunnelMethod1,
				AdditionalProperties: additionalProperties6,
			}
		}
		if sourceMysqlUpdateNoTunnel != nil {
			tunnelMethod = &shared.SourceMysqlUpdateSSHTunnelMethod{
				SourceMysqlUpdateNoTunnel: sourceMysqlUpdateNoTunnel,
			}
		}
		var sourceMysqlUpdateSSHKeyAuthentication *shared.SourceMysqlUpdateSSHKeyAuthentication
		if r.Configuration.TunnelMethod.SSHKeyAuthentication != nil {
			var sshKey string
			sshKey = r.Configuration.TunnelMethod.SSHKeyAuthentication.SSHKey.ValueString()

			var tunnelHost string
			tunnelHost = r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelHost.ValueString()

			tunnelMethod2 := new(shared.SourceMysqlUpdateSchemasTunnelMethod)
			if !r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelMethod.IsUnknown() && !r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelMethod.IsNull() {
				*tunnelMethod2 = shared.SourceMysqlUpdateSchemasTunnelMethod(r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelMethod.ValueString())
			} else {
				tunnelMethod2 = nil
			}
			tunnelPort := new(int64)
			if !r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelPort.IsUnknown() && !r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelPort.IsNull() {
				*tunnelPort = r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelPort.ValueInt64()
			} else {
				tunnelPort = nil
			}
			var tunnelUser string
			tunnelUser = r.Configuration.TunnelMethod.SSHKeyAuthentication.TunnelUser.ValueString()

			var additionalProperties7 interface{}
			if !r.Configuration.TunnelMethod.SSHKeyAuthentication.AdditionalProperties.IsUnknown() && !r.Configuration.TunnelMethod.SSHKeyAuthentication.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.TunnelMethod.SSHKeyAuthentication.AdditionalProperties.ValueString()), &additionalProperties7)
			}
			sourceMysqlUpdateSSHKeyAuthentication = &shared.SourceMysqlUpdateSSHKeyAuthentication{
				SSHKey:               sshKey,
				TunnelHost:           tunnelHost,
				TunnelMethod:         tunnelMethod2,
				TunnelPort:           tunnelPort,
				TunnelUser:           tunnelUser,
				AdditionalProperties: additionalProperties7,
			}
		}
		if sourceMysqlUpdateSSHKeyAuthentication != nil {
			tunnelMethod = &shared.SourceMysqlUpdateSSHTunnelMethod{
				SourceMysqlUpdateSSHKeyAuthentication: sourceMysqlUpdateSSHKeyAuthentication,
			}
		}
		var sourceMysqlUpdatePasswordAuthentication *shared.SourceMysqlUpdatePasswordAuthentication
		if r.Configuration.TunnelMethod.PasswordAuthentication != nil {
			var tunnelHost1 string
			tunnelHost1 = r.Configuration.TunnelMethod.PasswordAuthentication.TunnelHost.ValueString()

			tunnelMethod3 := new(shared.SourceMysqlUpdateSchemasTunnelMethodTunnelMethod)
			if !r.Configuration.TunnelMethod.PasswordAuthentication.TunnelMethod.IsUnknown() && !r.Configuration.TunnelMethod.PasswordAuthentication.TunnelMethod.IsNull() {
				*tunnelMethod3 = shared.SourceMysqlUpdateSchemasTunnelMethodTunnelMethod(r.Configuration.TunnelMethod.PasswordAuthentication.TunnelMethod.ValueString())
			} else {
				tunnelMethod3 = nil
			}
			tunnelPort1 := new(int64)
			if !r.Configuration.TunnelMethod.PasswordAuthentication.TunnelPort.IsUnknown() && !r.Configuration.TunnelMethod.PasswordAuthentication.TunnelPort.IsNull() {
				*tunnelPort1 = r.Configuration.TunnelMethod.PasswordAuthentication.TunnelPort.ValueInt64()
			} else {
				tunnelPort1 = nil
			}
			var tunnelUser1 string
			tunnelUser1 = r.Configuration.TunnelMethod.PasswordAuthentication.TunnelUser.ValueString()

			var tunnelUserPassword string
			tunnelUserPassword = r.Configuration.TunnelMethod.PasswordAuthentication.TunnelUserPassword.ValueString()

			var additionalProperties8 interface{}
			if !r.Configuration.TunnelMethod.PasswordAuthentication.AdditionalProperties.IsUnknown() && !r.Configuration.TunnelMethod.PasswordAuthentication.AdditionalProperties.IsNull() {
				_ = json.Unmarshal([]byte(r.Configuration.TunnelMethod.PasswordAuthentication.AdditionalProperties.ValueString()), &additionalProperties8)
			}
			sourceMysqlUpdatePasswordAuthentication = &shared.SourceMysqlUpdatePasswordAuthentication{
				TunnelHost:           tunnelHost1,
				TunnelMethod:         tunnelMethod3,
				TunnelPort:           tunnelPort1,
				TunnelUser:           tunnelUser1,
				TunnelUserPassword:   tunnelUserPassword,
				AdditionalProperties: additionalProperties8,
			}
		}
		if sourceMysqlUpdatePasswordAuthentication != nil {
			tunnelMethod = &shared.SourceMysqlUpdateSSHTunnelMethod{
				SourceMysqlUpdatePasswordAuthentication: sourceMysqlUpdatePasswordAuthentication,
			}
		}
	}
	var username string
	username = r.Configuration.Username.ValueString()

	configuration := shared.SourceMysqlUpdate{
		CheckPrivileges:                 checkPrivileges,
		CheckpointTargetIntervalSeconds: checkpointTargetIntervalSeconds,
		Concurrency:                     concurrency,
		Database:                        database,
		Host:                            host,
		JdbcURLParams:                   jdbcURLParams,
		Password:                        password,
		Port:                            port,
		ReplicationMethod:               replicationMethod,
		SslMode:                         sslMode,
		TunnelMethod:                    tunnelMethod,
		Username:                        username,
	}
	out := shared.SourceMysqlPutRequest{
		Name:          name,
		WorkspaceID:   workspaceID,
		Configuration: configuration,
	}
	return &out
}
