// 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.DataccService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Datacc
{
public class CreateVmClusterNetworkExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createVmClusterNetworkDetails = new Oci.DataccService.Models.CreateVmClusterNetworkDetails
{
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
InfrastructureId = "ocid1.test.oc1..<unique_ID>EXAMPLE-infrastructureId-Value",
DisplayName = "EXAMPLE-displayName-Value",
NodeCount = 1,
Scans = new List<Oci.DataccService.Models.ScanDetails>
{
new Oci.DataccService.Models.ScanDetails
{
Hostname = "EXAMPLE-hostname-Value",
Ips = new List<string>
{
"EXAMPLE--Value"
}
}
},
ListenerPort = 2835,
ListenerPortSsl = 2104,
DnsServers = new List<string>
{
"EXAMPLE--Value"
},
NtpServers = new List<string>
{
"EXAMPLE--Value"
},
VmNetworks = new List<Oci.DataccService.Models.VmNetworkDetails>
{
new Oci.DataccService.Models.VmNetworkDetails
{
VlanId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vlanId-Value",
NetworkType = Oci.DataccService.Models.VmClusterNetworkType.Client,
Netmask = "EXAMPLE-netmask-Value",
Gateway = "EXAMPLE-gateway-Value",
DomainName = "EXAMPLE-domainName-Value",
Prefix = "EXAMPLE-prefix-Value",
Nodes = new List<Oci.DataccService.Models.NodeDetails>
{
new Oci.DataccService.Models.NodeDetails
{
Hostname = "EXAMPLE-hostname-Value",
Ip = "EXAMPLE-ip-Value",
VipHostname = "EXAMPLE-vipHostname-Value",
Vip = "EXAMPLE-vip-Value"
}
}
}
},
ConsumerType = Oci.DataccService.Models.VmNetworkConsumerType.Instance,
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_BcA6n",
"EXAMPLE_VALUE_eUwcKJA5Gqvbp3GVRPiD"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_TLN1C",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_gSZmy",
"EXAMPLE--Value"
}
}
}
}
};
var createVmClusterNetworkRequest = new Oci.DataccService.Requests.CreateVmClusterNetworkRequest
{
CreateVmClusterNetworkDetails = createVmClusterNetworkDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "7W9ZXDU9GN93Y4QIPS98<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 BaseinfraClient(provider, new ClientConfiguration()))
{
var response = await client.CreateVmClusterNetwork(createVmClusterNetworkRequest);
// Retrieve value from the response.
var id = response.VmClusterNetwork.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateVmClusterNetwork Failed with {e.Message}");
throw e;
}
}
}
}