// 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).

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using Oci.DataintegrationService;
using Oci.Common;
using Oci.Common.Auth;

namespace Oci.Sdk.DotNet.Example.Dataintegration
{
    public class UpdateUserDefinedFunctionExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateUserDefinedFunctionDetails = new Oci.DataintegrationService.Models.UpdateUserDefinedFunctionDetails
			{
				ParentRef = new Oci.DataintegrationService.Models.ParentReference
				{
					Parent = "EXAMPLE-parent-Value",
					RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
				},
				Name = "EXAMPLE-name-Value",
				Identifier = "EXAMPLE-identifier-Value",
				ModelVersion = "EXAMPLE-modelVersion-Value",
				ObjectVersion = 931,
				Signatures = new List<Oci.DataintegrationService.Models.FunctionSignature>
				{
					new Oci.DataintegrationService.Models.FunctionSignature
					{
						Key = "EXAMPLE-key-Value",
						ModelType = Oci.DataintegrationService.Models.FunctionSignature.ModelTypeEnum.DisFunctionSignature,
						ModelVersion = "EXAMPLE-modelVersion-Value",
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						},
						Name = "EXAMPLE-name-Value",
						RetType = new Oci.DataintegrationService.Models.ConfiguredType
						{
							WrappedType = "EXAMPLE-wrappedType-Value",
							ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
							{
								ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
								{
									{
										"EXAMPLE_KEY_VZFDa", 
										new Oci.DataintegrationService.Models.ConfigParameterValue
										{
											StringValue = "EXAMPLE-stringValue-Value",
											IntValue = 163,
											ObjectValue = "EXAMPLE-objectValue-Value",
											RefValue = "EXAMPLE-refValue-Value",
											ParameterValue = "EXAMPLE-parameterValue-Value",
											RootObjectValue = "EXAMPLE-rootObjectValue-Value"
										}
									}
								},
								ParentRef = new Oci.DataintegrationService.Models.ParentReference
								{
									Parent = "EXAMPLE-parent-Value",
									RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
								}
							},
							ConfigDefinition = new Oci.DataintegrationService.Models.ConfigDefinition
							{
								Key = "EXAMPLE-key-Value",
								ModelType = "EXAMPLE-modelType-Value",
								ModelVersion = "EXAMPLE-modelVersion-Value",
								ParentRef = new Oci.DataintegrationService.Models.ParentReference
								{
									Parent = "EXAMPLE-parent-Value",
									RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
								},
								Name = "EXAMPLE-name-Value",
								IsContained = false,
								ObjectStatus = 748,
								ConfigParameterDefinitions = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterDefinition>()
								{
									{
										"EXAMPLE_KEY_WAEHL", 
										new Oci.DataintegrationService.Models.ConfigParameterDefinition
										{
											ParameterType = new Oci.DataintegrationService.Models.CompositeType
											{
												Elements = new List<Oci.DataintegrationService.Models.TypedObject>
												{
													new Oci.DataintegrationService.Models.MaterializedDynamicField
													{
														Scope = "EXAMPLE-scope-Value",
														Type = new Oci.DataintegrationService.Models.MaterializedCompositeType
														{
															Elements = new List<string>
															{
																"EXAMPLE--Value"
															},
															PathNames = new List<string>
															{
																"EXAMPLE--Value"
															},
															Key = "EXAMPLE-key-Value",
															ModelVersion = "EXAMPLE-modelVersion-Value",
															ParentRef = new Oci.DataintegrationService.Models.ParentReference
															{
																Parent = "EXAMPLE-parent-Value",
																RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
															},
															Name = "EXAMPLE-name-Value",
															ObjectStatus = 731,
															Description = "EXAMPLE-description-Value"
														},
														Key = "EXAMPLE-key-Value",
														ModelVersion = "EXAMPLE-modelVersion-Value",
														ParentRef = new Oci.DataintegrationService.Models.ParentReference
														{
															Parent = "EXAMPLE-parent-Value",
															RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
														},
														ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
														{
															ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
															{
																{
																	"EXAMPLE_KEY_b8zH2", 
																	new Oci.DataintegrationService.Models.ConfigParameterValue
																	{
																		StringValue = "EXAMPLE-stringValue-Value",
																		IntValue = 267,
																		ObjectValue = "EXAMPLE-objectValue-Value",
																		RefValue = "EXAMPLE-refValue-Value",
																		ParameterValue = "EXAMPLE-parameterValue-Value",
																		RootObjectValue = "EXAMPLE-rootObjectValue-Value"
																	}
																}
															},
															ParentRef = new Oci.DataintegrationService.Models.ParentReference
															{
																Parent = "EXAMPLE-parent-Value",
																RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
															}
														},
														ObjectStatus = 380,
														Name = "EXAMPLE-name-Value",
														Description = "EXAMPLE-description-Value"
													}
												},
												Key = "EXAMPLE-key-Value",
												ModelVersion = "EXAMPLE-modelVersion-Value",
												ParentRef = new Oci.DataintegrationService.Models.ParentReference
												{
													Parent = "EXAMPLE-parent-Value",
													RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
												},
												Name = "EXAMPLE-name-Value",
												ObjectStatus = 43,
												Description = "EXAMPLE-description-Value"
											},
											ParameterName = "EXAMPLE-parameterName-Value",
											Description = "EXAMPLE-description-Value",
											DefaultValue = "EXAMPLE-defaultValue-Value",
											ClassFieldName = "EXAMPLE-classFieldName-Value",
											IsStatic = false,
											IsClassFieldValue = false
										}
									}
								}
							},
							Key = "EXAMPLE-key-Value",
							ModelVersion = "EXAMPLE-modelVersion-Value",
							ParentRef = new Oci.DataintegrationService.Models.ParentReference
							{
								Parent = "EXAMPLE-parent-Value",
								RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
							},
							Name = "EXAMPLE-name-Value",
							ObjectStatus = 969,
							Description = "EXAMPLE-description-Value"
						},
						Arguments = new List<Oci.DataintegrationService.Models.TypedObject>
						{
							new Oci.DataintegrationService.Models.InputProxyField
							{
								Scope = "EXAMPLE-scope-Value",
								Type = new Oci.DataintegrationService.Models.JavaType
								{
									JavaTypeName = "EXAMPLE-javaTypeName-Value",
									ConfigDefinition = new Oci.DataintegrationService.Models.ConfigDefinition
									{
										Key = "EXAMPLE-key-Value",
										ModelType = "EXAMPLE-modelType-Value",
										ModelVersion = "EXAMPLE-modelVersion-Value",
										ParentRef = new Oci.DataintegrationService.Models.ParentReference
										{
											Parent = "EXAMPLE-parent-Value",
											RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
										},
										Name = "EXAMPLE-name-Value",
										IsContained = false,
										ObjectStatus = 831,
										ConfigParameterDefinitions = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterDefinition>()
										{
											{
												"EXAMPLE_KEY_EuKmq", 
												new Oci.DataintegrationService.Models.ConfigParameterDefinition
												{
													ParameterName = "EXAMPLE-parameterName-Value",
													Description = "EXAMPLE-description-Value",
													DefaultValue = "EXAMPLE-defaultValue-Value",
													ClassFieldName = "EXAMPLE-classFieldName-Value",
													IsStatic = false,
													IsClassFieldValue = true
												}
											}
										}
									},
									Key = "EXAMPLE-key-Value",
									ModelVersion = "EXAMPLE-modelVersion-Value",
									ParentRef = new Oci.DataintegrationService.Models.ParentReference
									{
										Parent = "EXAMPLE-parent-Value",
										RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
									},
									Name = "EXAMPLE-name-Value",
									ObjectStatus = 883,
									Description = "EXAMPLE-description-Value"
								},
								Labels = new List<string>
								{
									"EXAMPLE--Value"
								},
								Key = "EXAMPLE-key-Value",
								ModelVersion = "EXAMPLE-modelVersion-Value",
								ParentRef = new Oci.DataintegrationService.Models.ParentReference
								{
									Parent = "EXAMPLE-parent-Value",
									RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
								},
								ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
								{
									ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
									{
										{
											"EXAMPLE_KEY_4hF3r", 
											new Oci.DataintegrationService.Models.ConfigParameterValue
											{
												StringValue = "EXAMPLE-stringValue-Value",
												IntValue = 94,
												ObjectValue = "EXAMPLE-objectValue-Value",
												RefValue = "EXAMPLE-refValue-Value",
												ParameterValue = "EXAMPLE-parameterValue-Value",
												RootObjectValue = "EXAMPLE-rootObjectValue-Value"
											}
										}
									},
									ParentRef = new Oci.DataintegrationService.Models.ParentReference
									{
										Parent = "EXAMPLE-parent-Value",
										RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
									}
								},
								ObjectStatus = 612,
								Name = "EXAMPLE-name-Value",
								Description = "EXAMPLE-description-Value"
							}
						},
						Description = "EXAMPLE-description-Value",
						ObjectStatus = 505
					}
				},
				Expr = new Oci.DataintegrationService.Models.Expression
				{
					Key = "EXAMPLE-key-Value",
					ModelType = "EXAMPLE-modelType-Value",
					ModelVersion = "EXAMPLE-modelVersion-Value",
					ParentRef = new Oci.DataintegrationService.Models.ParentReference
					{
						Parent = "EXAMPLE-parent-Value",
						RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
					},
					ExprString = "EXAMPLE-exprString-Value",
					ConfigValues = new Oci.DataintegrationService.Models.ConfigValues
					{
						ConfigParamValues = new Dictionary<string, Oci.DataintegrationService.Models.ConfigParameterValue>()
						{
							{
								"EXAMPLE_KEY_EgGAS", 
								new Oci.DataintegrationService.Models.ConfigParameterValue
								{
									StringValue = "EXAMPLE-stringValue-Value",
									IntValue = 939,
									ObjectValue = "EXAMPLE-objectValue-Value",
									RefValue = "EXAMPLE-refValue-Value",
									ParameterValue = "EXAMPLE-parameterValue-Value",
									RootObjectValue = "EXAMPLE-rootObjectValue-Value"
								}
							}
						},
						ParentRef = new Oci.DataintegrationService.Models.ParentReference
						{
							Parent = "EXAMPLE-parent-Value",
							RootDocId = "ocid1.test.oc1..<unique_ID>EXAMPLE-rootDocId-Value"
						}
					},
					ObjectStatus = 161
				},
				Description = "EXAMPLE-description-Value",
				ObjectStatus = 182,
				RegistryMetadata = new Oci.DataintegrationService.Models.RegistryMetadata
				{
					AggregatorKey = "EXAMPLE-aggregatorKey-Value",
					Labels = new List<string>
					{
						"EXAMPLE--Value"
					},
					RegistryVersion = 798,
					Key = "EXAMPLE-key-Value",
					IsFavorite = true
				}
			};
			var updateUserDefinedFunctionRequest = new Oci.DataintegrationService.Requests.UpdateUserDefinedFunctionRequest
			{
				WorkspaceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
				UserDefinedFunctionKey = "EXAMPLE-userDefinedFunctionKey-Value",
				UpdateUserDefinedFunctionDetails = updateUserDefinedFunctionDetails,
				OpcRequestId = "VA362QGCOJNWAYDFIXNZ<unique_ID>",
				IfMatch = "EXAMPLE-ifMatch-Value"
			};

            // 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. 
            var provider = new ConfigFileAuthenticationDetailsProvider("DEFAULT");
            try
            {
                // Create a service client and send the request.
				using (var client = new DataIntegrationClient(provider, new ClientConfiguration()))
				{
					var response = await client.UpdateUserDefinedFunction(updateUserDefinedFunctionRequest);
					// Retrieve value from the response.
					var keyValue = response.UserDefinedFunction.Key;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateUserDefinedFunction Failed with {e.Message}");
                throw e;
            }
        }

    }
}