// 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 CreateModelDeploymentExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createModelDeploymentDetails = new Oci.DatascienceService.Models.CreateModelDeploymentDetails
{
DisplayName = "EXAMPLE-displayName-Value",
Description = "EXAMPLE-description-Value",
ProjectId = "ocid1.test.oc1..<unique_ID>EXAMPLE-projectId-Value",
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
ModelDeploymentConfigurationDetails = new Oci.DatascienceService.Models.SingleModelDeploymentConfigurationDetails
{
ModelConfigurationDetails = new Oci.DatascienceService.Models.ModelConfigurationDetails
{
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)22.022038,
MemoryInGBs = (float)243.80164,
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 = 2
},
BandwidthMbps = 4505,
MaximumBandwidthMbps = 2384
},
EnvironmentConfigurationDetails = new Oci.DatascienceService.Models.DefaultModelDeploymentEnvironmentConfigurationDetails
{
EnvironmentVariables = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_yXo9D",
"EXAMPLE_VALUE_LLl1ICntiMjRtIJoek1S"
}
}
}
},
CategoryLogDetails = new Oci.DatascienceService.Models.CategoryLogDetails
{
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_OUbJn",
"EXAMPLE_VALUE_4wPEUKfzqUJE2tvdUat6"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_7m1Ii",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_okJWJ",
"EXAMPLE--Value"
}
}
}
}
};
var createModelDeploymentRequest = new Oci.DatascienceService.Requests.CreateModelDeploymentRequest
{
CreateModelDeploymentDetails = createModelDeploymentDetails,
OpcRequestId = "YVVLKHHPXPWLX0EPR5XG<unique_ID>",
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcParentRptUrl = "EXAMPLE-opcParentRptUrl-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 DataScienceClient(provider, new ClientConfiguration()))
{
var response = await client.CreateModelDeployment(createModelDeploymentRequest);
// Retrieve value from the response.
var id = response.ModelDeployment.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateModelDeployment Failed with {e.Message}");
throw e;
}
}
}
}