// 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.DatascienceService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Datascience
{
public class UpdateModelExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var updateModelDetails = new Oci.DatascienceService.Models.UpdateModelDetails
{
DisplayName = "EXAMPLE-displayName-Value",
Description = "EXAMPLE-description-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_r6gfI",
"EXAMPLE_VALUE_ohidS6Xt02nw8FcQ73Gz"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_Q5YJf",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_7u9hk",
"EXAMPLE--Value"
}
}
}
},
CustomMetadataList = new List<Oci.DatascienceService.Models.Metadata>
{
new Oci.DatascienceService.Models.Metadata
{
Key = "EXAMPLE-key-Value",
Value = "EXAMPLE-value-Value",
Description = "EXAMPLE-description-Value",
Category = "EXAMPLE-category-Value",
Keywords = new List<string>
{
"EXAMPLE--Value"
},
HasArtifact = false
}
},
DefinedMetadataList = new List<Oci.DatascienceService.Models.Metadata>
{
new Oci.DatascienceService.Models.Metadata
{
Key = "EXAMPLE-key-Value",
Value = "EXAMPLE-value-Value",
Description = "EXAMPLE-description-Value",
Category = "EXAMPLE-category-Value",
Keywords = new List<string>
{
"EXAMPLE--Value"
},
HasArtifact = false
}
},
ModelVersionSetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-modelVersionSetId-Value",
VersionLabel = "EXAMPLE-versionLabel-Value",
RetentionSetting = new Oci.DatascienceService.Models.RetentionSetting
{
ArchiveAfterDays = 366,
DeleteAfterDays = 5,
CustomerNotificationType = Oci.DatascienceService.Models.ModelSettingCustomerNotificationType.All
},
BackupSetting = new Oci.DatascienceService.Models.BackupSetting
{
IsBackupEnabled = false,
BackupRegion = "EXAMPLE-backupRegion-Value",
CustomerNotificationType = Oci.DatascienceService.Models.ModelSettingCustomerNotificationType.All
}
};
var updateModelRequest = new Oci.DatascienceService.Requests.UpdateModelRequest
{
ModelId = "ocid1.test.oc1..<unique_ID>EXAMPLE-modelId-Value",
UpdateModelDetails = updateModelDetails,
IfMatch = "EXAMPLE-ifMatch-Value",
OpcRequestId = "LE60EDGBVJY7LSLC5SBI<unique_ID>"
};
// 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 DataScienceClient(provider, new ClientConfiguration()))
{
var response = await client.UpdateModel(updateModelRequest);
// Retrieve value from the response.
var id = response.Model.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"UpdateModel Failed with {e.Message}");
throw e;
}
}
}
}