// 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.DataintegrationService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Dataintegration
{
public class CreateWorkspaceExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createWorkspaceDetails = new Oci.DataintegrationService.Models.CreateWorkspaceDetails
{
VcnId = "AjMSJNVWJiooxpoSYgHnaEbNSnozo8lSVWxUEIZqu1d0BbxGy2l9HDDDY1xhxQ4Dewi6ZOF1QhuaGmiKxgEurNd8dC7EZjXGeH1YEGILmo7TOxK6kSXtqdBtqkBcPUosbTQHtv9no8VKkf0sH7KBSE4Otj4O15fEL7F2VRDRgiqQkxb0tP7RPuXlekg7pRB1NvsYjqg5pdrjFJ3oWIUxDGVkAMWeDTAFqNzm1VAEd8YaoodFsAvaCtS7GTvKhHK",
SubnetId = "3kfUZH0mRPtVCDvPXUVatT0KP23LPjDs9rQTUGvuwP2WYDQSO9SdzTHw6240sm67toys7NaxmpZZxuGaktWvTetJufSgQBoYZZdHtxoJ5aRmrhsuZ07RxqNHT3ib4oV2pQqMRgYjQFvdzeUSg5rTkNDcNeJtZlRF2eDaV0XdF2CEYXda7EsC792zkHfi2lcKMwQjIiJuZhE9RouRCmqB9U0jdlStrZAjhegOZvLZvn1GLGj9pl4KjPqPI2A7FS9",
DnsServerIp = "EXAMPLE-dnsServerIp-Value",
DnsServerZone = "EXAMPLE-dnsServerZone-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_fNSjF",
"EXAMPLE_VALUE_z6alVwVen8LYyVSMB5Jp"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_i3neA",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_5w7wF",
"EXAMPLE--Value"
}
}
}
},
Description = "EXAMPLE-description-Value",
DisplayName = "EXAMPLE-displayName-Value",
CompartmentId = "DqvVh4A6y6ppv5ljKhWl6wPI6m39r2ImRfoTnvHpucYtD8WQ0JwutyeIFY0YWE5PfYnWuGaU1JfRRHKP10lpMcTsfSDyMfebD1iDdCI3N1FyVWheyKLYTtmaOe4vQJcDMrhMVmeGmq6HqgWM3jzYZsvQymzpLOR3WCxLVFoMA0JjJDQ5c2EglW1Dy0rlHf4rpqkJyfBvalLD5EPRxBfk8wm0CswCz6XTECdnsoDuwg9tToLd7vRt4GUjq8HLWHS",
IsPrivateNetworkEnabled = true,
RegistryId = "ocid1.test.oc1..<unique_ID>EXAMPLE-registryId-Value",
EndpointId = "ocid1.test.oc1..<unique_ID>EXAMPLE-endpointId-Value",
RegistryName = "EXAMPLE-registryName-Value",
RegistryCompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-registryCompartmentId-Value",
EndpointName = "EXAMPLE-endpointName-Value",
EndpointCompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-endpointCompartmentId-Value",
WorkspaceProperties = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_3LqLH",
"EXAMPLE_VALUE_OiNAVbXvfFfI6G4rCbjQ"
}
}
};
var createWorkspaceRequest = new Oci.DataintegrationService.Requests.CreateWorkspaceRequest
{
CreateWorkspaceDetails = createWorkspaceDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "1XW3FDO4C4WUAJ0AGLJR<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 DataIntegrationClient(provider, new ClientConfiguration()))
{
var response = await client.CreateWorkspace(createWorkspaceRequest);
// Retrieve value from the response.
var versionValue = response.httpResponseMessage.Version;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateWorkspace Failed with {e.Message}");
throw e;
}
}
}
}