// 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)19.565693,
MemoryInGBs = (float)690.4443,
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",
NetworkAccessType = Oci.DatascienceService.Models.InstanceConfiguration.NetworkAccessTypeEnum.CustomNetworking
},
ScalingPolicy = new Oci.DatascienceService.Models.FixedSizeScalingPolicy
{
InstanceCount = 6
},
BandwidthMbps = 5122,
MaximumBandwidthMbps = 2718
},
EnvironmentConfigurationDetails = new Oci.DatascienceService.Models.UpdateOcirModelDeploymentEnvironmentConfigurationDetails
{
Image = "EXAMPLE-image-Value",
ImageDigest = "EXAMPLE-imageDigest-Value",
ImageSignatureId = "ocid1.test.oc1..<unique_ID>EXAMPLE-imageSignatureId-Value",
Cmd = new List<string>
{
"EXAMPLE--Value"
},
Entrypoint = new List<string>
{
"EXAMPLE--Value"
},
ServerPort = 344,
HealthCheckPort = 73,
EnvironmentVariables = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_6uZif",
"EXAMPLE_VALUE_n9flnHidpJQuFaaUkRGn"
}
},
}
},
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_Dqg29",
"EXAMPLE_VALUE_w0yihn9XPmmD8MW6AWLv"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_9cgeV",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_pp7D6",
"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 = "2FCXAG9EOTKSTAHRIHFK<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;
}
}
}
}