// This is an automatically generated code sample.
// To make this code sample work in your Oracle Cloud tenancy,
// please replace the values for any parameters whose current values do not fit
// your use case (such as resource IDs, strings containing ‘EXAMPLE’ or ‘unique_id’, and
// boolean, number, and enum parameters with values not fitting your use case).

package main

import (
	"context"
	"fmt"

	"github.com/oracle/oci-go-sdk/v65/common"
	"github.com/oracle/oci-go-sdk/v65/dataintegration"
	"github.com/oracle/oci-go-sdk/v65/example/helpers"
)

func ExampleCreateUserDefinedFunction() {
	// Create a default authentication provider that uses the DEFAULT
	// profile in the configuration file.
	// Refer to <see href="https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File>the public documentation</see> on how to prepare a configuration file.
	client, err := dataintegration.NewDataIntegrationClientWithConfigurationProvider(common.DefaultConfigProvider())
	helpers.FatalIfError(err)

	// Create a request and dependent object(s).
	var defaultValue interface{}
	defaultValue = "EXAMPLE-defaultValue-Value"
	var objectValue interface{}
	objectValue = "EXAMPLE-objectValue-Value"
	var refValue interface{}
	refValue = "EXAMPLE-refValue-Value"
	var rootObjectValue interface{}
	rootObjectValue = "EXAMPLE-rootObjectValue-Value"
	var wrappedType interface{}
	wrappedType = "EXAMPLE-wrappedType-Value"
	req := dataintegration.CreateUserDefinedFunctionRequest{CreateUserDefinedFunctionDetails: dataintegration.CreateUserDefinedFunctionDetails{Signatures: []dataintegration.FunctionSignature{dataintegration.FunctionSignature{Arguments: []dataintegration.TypedObject{dataintegration.MacroField{ObjectStatus: common.Int(454),
		IsUseSourceType: common.Bool(true),
		Key:             common.String("EXAMPLE-key-Value"),
		ModelVersion:    common.String("EXAMPLE-modelVersion-Value"),
		Name:            common.String("EXAMPLE-name-Value"),
		Type: dataintegration.MaterializedCompositeType{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			Name: common.String("EXAMPLE-name-Value"),
			ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
				RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
			ConfigDefinition: &dataintegration.ConfigDefinition{Name: common.String("EXAMPLE-name-Value"),
				ObjectStatus: common.Int(385),
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
				ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_BpEAb": dataintegration.ConfigParameterDefinition{ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
					DefaultValue:      &defaultValue,
					Description:       common.String("EXAMPLE-description-Value"),
					IsClassFieldValue: common.Bool(false),
					IsStatic:          common.Bool(false),
					ParameterName:     common.String("EXAMPLE-parameterName-Value")}},
				IsContained:  common.Bool(false),
				Key:          common.String("EXAMPLE-key-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
			Key:          common.String("EXAMPLE-key-Value"),
			PathNames:    []string{"EXAMPLE--Value"},
			Description:  common.String("EXAMPLE-description-Value"),
			Elements:     []string{"EXAMPLE--Value"},
			ObjectStatus: common.Int(270)},
		UseType: &dataintegration.ConfiguredType{ConfigDefinition: &dataintegration.ConfigDefinition{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			Name:         common.String("EXAMPLE-name-Value"),
			ObjectStatus: common.Int(959),
			ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
				RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
			ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_SuPum": dataintegration.ConfigParameterDefinition{ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
				DefaultValue:      &defaultValue,
				Description:       common.String("EXAMPLE-description-Value"),
				IsClassFieldValue: common.Bool(true),
				IsStatic:          common.Bool(false),
				ParameterName:     common.String("EXAMPLE-parameterName-Value"),
				ParameterType: dataintegration.JavaType{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					Description:  common.String("EXAMPLE-description-Value"),
					JavaTypeName: common.String("EXAMPLE-javaTypeName-Value"),
					Key:          common.String("EXAMPLE-key-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(255)}}},
			IsContained: common.Bool(true),
			Key:         common.String("EXAMPLE-key-Value")},
			ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_0D68L": dataintegration.ConfigParameterValue{IntValue: common.Int(856),
				ObjectValue:     &objectValue,
				ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
				RefValue:        &refValue,
				RootObjectValue: &rootObjectValue,
				StringValue:     common.String("EXAMPLE-stringValue-Value")}},
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
			Description:  common.String("EXAMPLE-description-Value"),
			ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			Name:         common.String("EXAMPLE-name-Value"),
			ObjectStatus: common.Int(536),
			ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
				Parent: common.String("EXAMPLE-parent-Value")},
			Key:         common.String("EXAMPLE-key-Value"),
			WrappedType: &wrappedType},
		ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_Itdu6": dataintegration.ConfigParameterValue{ObjectValue: &objectValue,
			ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
			RefValue:        &refValue,
			RootObjectValue: &rootObjectValue,
			StringValue:     common.String("EXAMPLE-stringValue-Value"),
			IntValue:        common.Int(955)}},
			ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
				Parent: common.String("EXAMPLE-parent-Value")}},
		Description: common.String("EXAMPLE-description-Value"),
		Expr: &dataintegration.Expression{ObjectStatus: common.Int(320),
			ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
				RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
			ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_EIbDF": dataintegration.ConfigParameterValue{ObjectValue: &objectValue,
				ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
				RefValue:        &refValue,
				RootObjectValue: &rootObjectValue,
				StringValue:     common.String("EXAMPLE-stringValue-Value"),
				IntValue:        common.Int(957)}},
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
			ExprString:   common.String("EXAMPLE-exprString-Value"),
			Key:          common.String("EXAMPLE-key-Value"),
			ModelVersion: common.String("EXAMPLE-modelVersion-Value")},
		Labels: []string{"EXAMPLE--Value"},
		ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
			RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}}},
		Description:  common.String("EXAMPLE-description-Value"),
		Key:          common.String("EXAMPLE-key-Value"),
		ObjectStatus: common.Int(891),
		ModelType:    dataintegration.FunctionSignatureModelTypeDisFunctionSignature,
		ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
		Name:         common.String("EXAMPLE-name-Value"),
		ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
			RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
		RetType: &dataintegration.ConfiguredType{Key: common.String("EXAMPLE-key-Value"),
			ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
				RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
			ConfigDefinition: &dataintegration.ConfigDefinition{ObjectStatus: common.Int(403),
				ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
					Parent: common.String("EXAMPLE-parent-Value")},
				ConfigParameterDefinitions: map[string]dataintegration.ConfigParameterDefinition{"EXAMPLE_KEY_44BEM": dataintegration.ConfigParameterDefinition{ClassFieldName: common.String("EXAMPLE-classFieldName-Value"),
					DefaultValue:      &defaultValue,
					Description:       common.String("EXAMPLE-description-Value"),
					IsClassFieldValue: common.Bool(true),
					IsStatic:          common.Bool(true),
					ParameterName:     common.String("EXAMPLE-parameterName-Value"),
					ParameterType: dataintegration.CompositeType{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
						Name:         common.String("EXAMPLE-name-Value"),
						ObjectStatus: common.Int(128),
						ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
							RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
						Description: common.String("EXAMPLE-description-Value"),
						Elements: []dataintegration.TypedObject{dataintegration.DecisionOutputPort{DecisionOutputPortType: dataintegration.DecisionOutputPortDecisionOutputPortTypeTrue,
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value"),
							ObjectStatus: common.Int(943),
							ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_jkMXO": dataintegration.ConfigParameterValue{ObjectValue: &objectValue,
								ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
								RefValue:        &refValue,
								RootObjectValue: &rootObjectValue,
								StringValue:     common.String("EXAMPLE-stringValue-Value"),
								IntValue:        common.Int(382)}},
								ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
									RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
							Description: common.String("EXAMPLE-description-Value"),
							ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
								RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
							PortType: dataintegration.DecisionOutputPortPortTypeModel}},
						Key: common.String("EXAMPLE-key-Value")}}},
				IsContained:  common.Bool(false),
				Key:          common.String("EXAMPLE-key-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				Name:         common.String("EXAMPLE-name-Value")},
			Description:  common.String("EXAMPLE-description-Value"),
			Name:         common.String("EXAMPLE-name-Value"),
			ObjectStatus: common.Int(851),
			WrappedType:  &wrappedType,
			ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_Hreiy": dataintegration.ConfigParameterValue{IntValue: common.Int(845),
				ObjectValue:     &objectValue,
				ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
				RefValue:        &refValue,
				RootObjectValue: &rootObjectValue,
				StringValue:     common.String("EXAMPLE-stringValue-Value")}},
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}}}}},
		Expr: &dataintegration.Expression{Key: common.String("EXAMPLE-key-Value"),
			ModelType:    common.String("EXAMPLE-modelType-Value"),
			ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
			ObjectStatus: common.Int(23),
			ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
				RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
			ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_irKUM": dataintegration.ConfigParameterValue{StringValue: common.String("EXAMPLE-stringValue-Value"),
				IntValue:        common.Int(890),
				ObjectValue:     &objectValue,
				ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
				RefValue:        &refValue,
				RootObjectValue: &rootObjectValue}},
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
			ExprString: common.String("EXAMPLE-exprString-Value")},
		Key:          common.String("EXAMPLE-key-Value"),
		ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
		ObjectStatus: common.Int(110),
		RegistryMetadata: &dataintegration.RegistryMetadata{AggregatorKey: common.String("EXAMPLE-aggregatorKey-Value"),
			IsFavorite:      common.Bool(true),
			Key:             common.String("EXAMPLE-key-Value"),
			Labels:          []string{"EXAMPLE--Value"},
			RegistryVersion: common.Int(471)},
		Description: common.String("EXAMPLE-description-Value"),
		Identifier:  common.String("EXAMPLE-identifier-Value"),
		Name:        common.String("EXAMPLE-name-Value"),
		ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
			RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
		OpcRequestId:  common.String("SXFQZ4RRPFS4EJOQQNAT<unique_ID>"),
		OpcRetryToken: common.String("EXAMPLE-opcRetryToken-Value"),
		WorkspaceId:   common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value")}

	// Send the request using the service client
	resp, err := client.CreateUserDefinedFunction(context.Background(), req)
	helpers.FatalIfError(err)

	// Retrieve value from the response.
	fmt.Println(resp)
}