// 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 UpdateModelDeploymentExample
    {
        public static async Task Main()
        {
            // Create a request and dependent object(s).
			var updateModelDeploymentDetails = new Oci.DatascienceService.Models.UpdateModelDeploymentDetails
			{
				DisplayName = "EXAMPLE-displayName-Value",
				Description = "EXAMPLE-description-Value",
				ModelDeploymentConfigurationDetails = new Oci.DatascienceService.Models.UpdateSingleModelDeploymentConfigurationDetails
				{
					ModelConfigurationDetails = new Oci.DatascienceService.Models.UpdateModelConfigurationDetails
					{
						ModelId = "ocid1.test.oc1..<unique_ID>EXAMPLE-modelId-Value",
						InstanceConfiguration = new Oci.DatascienceService.Models.InstanceConfiguration
						{
							InstanceShapeName = "EXAMPLE-instanceShapeName-Value",
							ModelDeploymentInstanceShapeConfigDetails = new Oci.DatascienceService.Models.ModelDeploymentInstanceShapeConfigDetails
							{
								Ocpus = (float)23.673515,
								MemoryInGBs = (float)144.94312,
								CpuBaseline = Oci.DatascienceService.Models.ModelDeploymentInstanceShapeConfigDetails.CpuBaselineEnum.Baseline11
							},
							SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
							PrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-privateEndpointId-Value"
						},
						ScalingPolicy = new Oci.DatascienceService.Models.AutoScalingPolicy
						{
							CoolDownInSeconds = 786,
							IsEnabled = false,
							AutoScalingPolicies = new List<Oci.DatascienceService.Models.AutoScalingPolicyDetails>
							{
								new Oci.DatascienceService.Models.ThresholdBasedAutoScalingPolicyDetails
								{
									Rules = new List<Oci.DatascienceService.Models.MetricExpressionRule>
									{
										new Oci.DatascienceService.Models.CustomMetricExpressionRule
										{
											ScaleInConfiguration = new Oci.DatascienceService.Models.CustomExpressionQueryScalingConfiguration
											{
												Query = "EXAMPLE-query-Value",
												PendingDuration = "EXAMPLE-pendingDuration-Value",
												InstanceCountAdjustment = 945
											},
										}
									},
									MaximumInstanceCount = 7,
									MinimumInstanceCount = 513,
									InitialInstanceCount = 368
								}
							}
						},
						BandwidthMbps = 1042,
						MaximumBandwidthMbps = 5810
					},
					EnvironmentConfigurationDetails = new Oci.DatascienceService.Models.UpdateOcirModelDeploymentEnvironmentConfigurationDetails
					{
						Image = "EXAMPLE-image-Value",
						ImageDigest = "EXAMPLE-imageDigest-Value",
						Cmd = new List<string>
						{
							"EXAMPLE--Value"
						},
						Entrypoint = new List<string>
						{
							"EXAMPLE--Value"
						},
						ServerPort = 712,
						HealthCheckPort = 844,
						EnvironmentVariables = new Dictionary<string, string>()
						{
							{
								"EXAMPLE_KEY_jtKua", 
								"EXAMPLE_VALUE_Vo6zbcRnrN2j57EXSGoh"
							}
						}
					}
				},
				CategoryLogDetails = new Oci.DatascienceService.Models.UpdateCategoryLogDetails
				{
					Access = new Oci.DatascienceService.Models.LogDetails
					{
						LogId = "ocid1.test.oc1..<unique_ID>EXAMPLE-logId-Value",
						LogGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-logGroupId-Value"
					},
					Predict = new Oci.DatascienceService.Models.LogDetails
					{
						LogId = "ocid1.test.oc1..<unique_ID>EXAMPLE-logId-Value",
						LogGroupId = "ocid1.test.oc1..<unique_ID>EXAMPLE-logGroupId-Value"
					}
				},
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_lDdao", 
						"EXAMPLE_VALUE_vWbtU1tPoNA7cBvWBwBM"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_UPq8b", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_N6xTv", 
								"EXAMPLE--Value"
							}
						}
					}
				}
			};
			var updateModelDeploymentRequest = new Oci.DatascienceService.Requests.UpdateModelDeploymentRequest
			{
				ModelDeploymentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-modelDeploymentId-Value",
				UpdateModelDeploymentDetails = updateModelDeploymentDetails,
				IfMatch = "EXAMPLE-ifMatch-Value",
				OpcRequestId = "7L4EK7F3CXUKAMNTGYOK<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.UpdateModelDeployment(updateModelDeploymentRequest);
					// Retrieve value from the response.
					var versionValue = response.httpResponseMessage.Version;
				}
            }
            catch (Exception e)
            {
                Console.WriteLine($"UpdateModelDeployment Failed with {e.Message}");
                throw e;
            }
        }

    }
}

Was this article helpful?