// 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.DifService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Dif
{
public class AddServiceExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var addServiceDetails = new Oci.DifService.Models.AddServiceDetails
{
StackTemplates = new List<Oci.DifService.Models.StackTemplate>
{
Oci.DifService.Models.StackTemplate.Datapipeline
},
Services = new List<Oci.DifService.Models.Service>
{
Oci.DifService.Models.Service.Oke
},
Adb = new List<Oci.DifService.Models.AdbDetail>
{
new Oci.DifService.Models.AdbDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
DbWorkload = Oci.DifService.Models.DbWorkload.Oltp,
Ecpu = 166,
DataStorageSizeInTBs = 490,
AdminPasswordId = "ocid1.test.oc1..<unique_ID>EXAMPLE-adminPasswordId-Value",
IsMtlsConnectionRequired = false,
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
DbVersion = "EXAMPLE-dbVersion-Value",
ToolsPublicAccess = "EXAMPLE-toolsPublicAccess-Value",
IsPublic = false
}
},
Ggcs = new List<Oci.DifService.Models.GgcsDetail>
{
new Oci.DifService.Models.GgcsDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
Ocpu = 714,
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
PublicSubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-publicSubnetId-Value",
PasswordSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-passwordSecretId-Value",
OggVersion = "EXAMPLE-oggVersion-Value",
Connections = new List<Oci.DifService.Models.GgcsConnectionDetails>
{
new Oci.DifService.Models.GgcsConnectionDetails
{
ConnectionName = "EXAMPLE-connectionName-Value",
DifDependencies = new List<Oci.DifService.Models.DifDependencyDetails>
{
new Oci.DifService.Models.DifDependencyDetails
{
ServiceType = "EXAMPLE-serviceType-Value",
ServiceInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-serviceInstanceId-Value"
}
},
GgAdminSecretId = "ocid1.test.oc1..<unique_ID>EXAMPLE-ggAdminSecretId-Value",
ConnectionId = "ocid1.test.oc1..<unique_ID>EXAMPLE-connectionId-Value"
}
}
}
},
Dataflow = new List<Oci.DifService.Models.DataflowDetail>
{
new Oci.DifService.Models.DataflowDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
SparkVersion = "EXAMPLE-sparkVersion-Value",
DriverShape = "EXAMPLE-driverShape-Value",
ExecutorShape = "EXAMPLE-executorShape-Value",
DriverShapeConfig = new Oci.DifService.Models.ShapeConfig
{
MemoryInGBs = 616,
Ocpus = 301
},
ExecutorShapeConfig = new Oci.DifService.Models.ShapeConfig
{
MemoryInGBs = 316,
Ocpus = 318
},
NumExecutors = 434,
PrivateEndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-privateEndpointId-Value",
Connections = new Oci.DifService.Models.DataflowConnections
{
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
ConnectionDetails = new Oci.DifService.Models.DataflowConnectionDetails
{
DifDependencies = new List<Oci.DifService.Models.DifDependencyDetails>
{
new Oci.DifService.Models.DifDependencyDetails
{
ServiceType = "EXAMPLE-serviceType-Value",
ServiceInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-serviceInstanceId-Value"
}
},
DomainNames = new List<string>
{
"EXAMPLE--Value"
}
}
},
LogBucketInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-logBucketInstanceId-Value",
WarehouseBucketInstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-warehouseBucketInstanceId-Value"
}
},
Objectstorage = new List<Oci.DifService.Models.ObjectStorageDetail>
{
new Oci.DifService.Models.ObjectStorageDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
ObjectVersioning = Oci.DifService.Models.ObjectVersioning.Suspended,
StorageTier = Oci.DifService.Models.StorageTier.Archive,
AutoTiering = Oci.DifService.Models.AutoTiering.Disabled
}
},
Genai = new List<Oci.DifService.Models.GenAiDetail>
{
new Oci.DifService.Models.GenAiDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
ClusterType = Oci.DifService.Models.ClusterType.Hosting,
BaseModel = "EXAMPLE-baseModel-Value",
OciRegion = "EXAMPLE-ociRegion-Value",
UnitCount = 704,
Endpoints = new List<Oci.DifService.Models.EndpointDetails>
{
new Oci.DifService.Models.EndpointDetails
{
EndpointName = "EXAMPLE-endpointName-Value",
IsContentModerationEnabled = false
}
}
}
},
Aidataplatform = new List<Oci.DifService.Models.AiDataPlatformDetail>
{
new Oci.DifService.Models.AiDataPlatformDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
DefaultWorkspaceName = "EXAMPLE-defaultWorkspaceName-Value"
}
},
Omk = new List<Oci.DifService.Models.OmkDetail>
{
new Oci.DifService.Models.OmkDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
ClusterNamespaceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clusterNamespaceId-Value",
ClusterId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clusterId-Value",
NamespaceName = "EXAMPLE-namespaceName-Value"
}
},
Oke = new List<Oci.DifService.Models.OkeDetail>
{
new Oci.DifService.Models.OkeDetail
{
InstanceId = "ocid1.test.oc1..<unique_ID>EXAMPLE-instanceId-Value",
ClusterId = "ocid1.test.oc1..<unique_ID>EXAMPLE-clusterId-Value",
NamespaceName = "EXAMPLE-namespaceName-Value"
}
}
};
var addServiceRequest = new Oci.DifService.Requests.AddServiceRequest
{
StackId = "ocid1.test.oc1..<unique_ID>EXAMPLE-stackId-Value",
AddServiceDetails = addServiceDetails,
IfMatch = "EXAMPLE-ifMatch-Value",
OpcRequestId = "A3TASNQ6C6PKT3QEUX9A<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 StackClient(provider, new ClientConfiguration()))
{
var response = await client.AddService(addServiceRequest);
// Retrieve value from the response.
var versionValue = response.httpResponseMessage.Version;
}
}
catch (Exception e)
{
Console.WriteLine($"AddService Failed with {e.Message}");
throw e;
}
}
}
}