// 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 ExampleUpdateUserDefinedFunction() {
	// 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 objectValue interface{}
	objectValue = "EXAMPLE-objectValue-Value"
	var refValue interface{}
	refValue = "EXAMPLE-refValue-Value"
	var rootObjectValue interface{}
	rootObjectValue = "EXAMPLE-rootObjectValue-Value"
	var scope interface{}
	scope = "EXAMPLE-scope-Value"
	var defaultValue interface{}
	defaultValue = "EXAMPLE-defaultValue-Value"
	var wrappedType interface{}
	wrappedType = "EXAMPLE-wrappedType-Value"
	req := dataintegration.UpdateUserDefinedFunctionRequest{IfMatch: common.String("EXAMPLE-ifMatch-Value"),
		OpcRequestId: common.String("ZHLDKILLQ7BT8LJA4QKK<unique_ID>"),
		UpdateUserDefinedFunctionDetails: dataintegration.UpdateUserDefinedFunctionDetails{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(328)},
			Description: common.String("EXAMPLE-description-Value"),
			Expr: &dataintegration.Expression{ModelType: common.String("EXAMPLE-modelType-Value"),
				ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus: common.Int(16),
				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_du6gz": dataintegration.ConfigParameterValue{IntValue: common.Int(221),
					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")}},
				ExprString: common.String("EXAMPLE-exprString-Value"),
				Key:        common.String("EXAMPLE-key-Value")},
			Identifier: common.String("EXAMPLE-identifier-Value"),
			Signatures: []dataintegration.FunctionSignature{dataintegration.FunctionSignature{ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
				ObjectStatus: common.Int(372),
				ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
					RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
				RetType: &dataintegration.ConfiguredType{ConfigDefinition: &dataintegration.ConfigDefinition{IsContained: common.Bool(true),
					Key:          common.String("EXAMPLE-key-Value"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					Name:         common.String("EXAMPLE-name-Value"),
					ObjectStatus: common.Int(866),
					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_2B4lp": dataintegration.ConfigParameterDefinition{IsStatic: common.Bool(true),
						ParameterName: common.String("EXAMPLE-parameterName-Value"),
						ParameterType: dataintegration.DynamicType{ObjectStatus: common.Int(983),
							ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
								RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
							TypeHandler: dataintegration.RuleTypeConfig{ConfigValues: &dataintegration.ConfigValues{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
								RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
								ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_N0opa": dataintegration.ConfigParameterValue{ParameterValue: common.String("EXAMPLE-parameterValue-Value"),
									RefValue:        &refValue,
									RootObjectValue: &rootObjectValue,
									StringValue:     common.String("EXAMPLE-stringValue-Value"),
									IntValue:        common.Int(959),
									ObjectValue:     &objectValue}}},
								IsOrderByRule: common.Bool(false),
								Key:           common.String("EXAMPLE-key-Value"),
								ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
								ObjectStatus:  common.Int(600),
								ProjectionRules: []dataintegration.ProjectionRule{dataintegration.NamePatternRule{ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
									RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
									IsCaseSensitive:             common.Bool(false),
									Key:                         common.String("EXAMPLE-key-Value"),
									ObjectStatus:                common.Int(43),
									RuleType:                    dataintegration.NamePatternRuleRuleTypeExclude,
									Scope:                       &scope,
									Description:                 common.String("EXAMPLE-description-Value"),
									MatchingStrategy:            dataintegration.NamePatternRuleMatchingStrategyTagsOnly,
									IsJavaRegexSyntax:           common.Bool(true),
									IsSkipRemainingRulesOnMatch: common.Bool(false),
									ModelVersion:                common.String("EXAMPLE-modelVersion-Value"),
									Pattern:                     common.String("EXAMPLE-pattern-Value"),
									ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_Tw5mC": dataintegration.ConfigParameterValue{IntValue: common.Int(114),
										ObjectValue:     &objectValue,
										ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
										RefValue:        &refValue,
										RootObjectValue: &rootObjectValue,
										StringValue:     common.String("EXAMPLE-stringValue-Value")}},
										ParentRef: &dataintegration.ParentReference{RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"),
											Parent: common.String("EXAMPLE-parent-Value")}},
									IsCascade: common.Bool(false)}},
								Scope: &scope,
								ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
									RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
								ScopeReference: &dataintegration.ScopeReference{ReferenceObject: common.String("EXAMPLE-referenceObject-Value"),
									ReferenceType: dataintegration.ScopeReferenceReferenceTypeOciFunctionOutputShape,
									RefObjectName: common.String("EXAMPLE-refObjectName-Value")}},
							Description:  common.String("EXAMPLE-description-Value"),
							Key:          common.String("EXAMPLE-key-Value"),
							ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
							Name:         common.String("EXAMPLE-name-Value")},
						ClassFieldName:    common.String("EXAMPLE-classFieldName-Value"),
						DefaultValue:      &defaultValue,
						Description:       common.String("EXAMPLE-description-Value"),
						IsClassFieldValue: common.Bool(false)}}},
					Description: common.String("EXAMPLE-description-Value"),
					Name:        common.String("EXAMPLE-name-Value"),
					ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_q4bkz": dataintegration.ConfigParameterValue{IntValue: common.Int(416),
						ObjectValue:     &objectValue,
						ParameterValue:  common.String("EXAMPLE-parameterValue-Value"),
						RefValue:        &refValue,
						RootObjectValue: &rootObjectValue,
						StringValue:     common.String("EXAMPLE-stringValue-Value")}},
						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"),
					ModelVersion: common.String("EXAMPLE-modelVersion-Value"),
					ObjectStatus: common.Int(889),
					ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
						RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")},
					WrappedType: &wrappedType},
				Name: common.String("EXAMPLE-name-Value"),
				Arguments: []dataintegration.TypedObject{dataintegration.OutputPort{Key: common.String("EXAMPLE-key-Value"),
					ObjectStatus: common.Int(96),
					PortType:     dataintegration.OutputPortPortTypeControl,
					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")},
					ConfigValues: &dataintegration.ConfigValues{ConfigParamValues: map[string]dataintegration.ConfigParameterValue{"EXAMPLE_KEY_44BEM": dataintegration.ConfigParameterValue{IntValue: common.Int(552),
						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")}},
				Description: common.String("EXAMPLE-description-Value"),
				Key:         common.String("EXAMPLE-key-Value"),
				ModelType:   dataintegration.FunctionSignatureModelTypeDisFunctionSignature}},
			ModelVersion:  common.String("EXAMPLE-modelVersion-Value"),
			Name:          common.String("EXAMPLE-name-Value"),
			ObjectStatus:  common.Int(185),
			ObjectVersion: common.Int(316),
			ParentRef: &dataintegration.ParentReference{Parent: common.String("EXAMPLE-parent-Value"),
				RootDocId: common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value")}},
		UserDefinedFunctionKey: common.String("EXAMPLE-userDefinedFunctionKey-Value"),
		WorkspaceId:            common.String("ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value")}

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

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