// 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 = "ycDTsarrdpMhVPQHsLK59mRCW6TtU6qfcydSUfmsraQ0mc2s2YdlTzeyHPV5hL0dNMw9YcwTj0uQBktVeKnXu2ngJf8Gl64665YHDim3erSiuY9atrIjG06SHatxQ2rnHQjoGVEPFOHzpxPME7FUlr5uhNidy0B2pxGu9G6qvam2JZDk2evO16s0qtSFi8II7rWwRlxiehtCaK3ACk4368rHbJArYtf6gho1IopnDMHNa1SVobHMJPFXM3sh8lS",
SubnetId = "kJ5KOVUyzjvnufjO1pbjLcJtPnzH6x2nrA7z71iYvLYfZr218GZms1ebPJJ2VjrsbSyOdZCMpa1QjvocFVtZ9Bp5xeNlVHNEOyBXYDkmuXApCpIx6RUr6wbBk9jpnMWh0nafTGJuoPHSrryCkEBayn4XUxq770ahVWcx0Y9VQIEQEPuKdVynHoO8ekazl1qnvKe2a7kJOf7ClHNhZCHrznNo19KKoMaNA5WYCpX8APQTjyzNiD9yVMC2vmlPzWk",
DnsServerIp = "EXAMPLE-dnsServerIp-Value",
DnsServerZone = "EXAMPLE-dnsServerZone-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_pGCKT",
"EXAMPLE_VALUE_rehfsC0PEySDqvVh4A6y"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_ljKhW",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_6ppv5",
"EXAMPLE--Value"
}
}
}
},
Description = "EXAMPLE-description-Value",
DisplayName = "EXAMPLE-displayName-Value",
CompartmentId = "ZMn8Y6CqyjkudcEP2k8TwAUKQP0TvpoiXTje7eL7Lmbh5qGy86Uo4k9T1cGam61XnZKcShsOd2CfZVvnyVicPVPETMCWuHJRrulO3vEGCPfFfvsXQfHAWhjkkwbLkqvDoNqVK2nZsHXCyKDTkn6eZa1arnHaQt7QRZMK9TiWML4KTlodzQOIU73RcujEfNfxuf4VjgGsHSSrKMzjIfm46qAf2bFZcGLgk9Xs4TBwtdiCDtETnRmy7JULmhKIwwf",
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_wPI6m",
"EXAMPLE_VALUE_39r2ImRfoTnvHpucYtD8"
}
}
};
var createWorkspaceRequest = new Oci.DataintegrationService.Requests.CreateWorkspaceRequest
{
CreateWorkspaceDetails = createWorkspaceDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "WQ0JWUTYEIFY0YWE5PFY<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;
}
}
}
}