// 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 = "oeBXKEnxQTHPYQZyGXoJWuHC6KiRyrI0TLFx3UuYdbCI0JCo6G3QUGbc8pCqs7M704vrZb6t3AqgiJiPM6p3ykAeoaYKm04hhEQ26zjy77oLc6xNnwFse6AAiZZ7k0uZznBmhVtyhoe40vNrHjT51PHbVe2jFOuy0qtHqHu3VMd3EOBqHZr48NtE8eQDN7uGbh53sHUcdn3euxgxxNcRJUoRfmCXzfgGzFoEpfWX28Nnxp7xIrUOkdcrj3XllGI",
SubnetId = "bQzrnVtaUT8zm8i9QH8ITz2hrLDwWn00CMWjjLet9pUm2MPknXDzRtt44RXcjiHIuMJy6EBtvIMNoy4iFBJMmnIDpnUeYtowZ5sKtwEbiGnFqARvSVDMuXyFf2OGAQTROO5CBtl95NawHek6NX1IB1BWPiu17nSX4fFeCCIYVL7iw91YuXKh7IVLV4fXObYhliYETxDdNkrwxd9JcOhsTdnGCdRtZ8RX68gStodytfj79oCCZ4UwDCb5lzZRT7M",
DnsServerIp = "EXAMPLE-dnsServerIp-Value",
DnsServerZone = "EXAMPLE-dnsServerZone-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_G1YB1",
"EXAMPLE_VALUE_A6hywBPfrbZBtmt0rXim"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_XFwHW",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_3zSc3",
"EXAMPLE--Value"
}
}
}
},
Description = "EXAMPLE-description-Value",
DisplayName = "EXAMPLE-displayName-Value",
CompartmentId = "CyGoLlJHvzey7O9pCetYuqjaUudbtJV3ldNA1dFU1CXKJGf7MQlm7wt3Eg2HUERICL2Blf1XX8oWk0lL49Z4mgizrZj6IsMRgVSSaclLhBml24Ec0WFpR4T9WIWA7fYSEQWnC0u0JbwpLAqXLusgG9sWObFFiNcVQ8Jxt3NqbR9kYPSRWkKFHxgG2rgDDL3G7EZumcTxZ4IrFjm3nNuUu4S7LSKL21nt68Di5NGxzXvDWZWt7aJ0QIrXlj1OqCR",
IsPrivateNetworkEnabled = false,
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_OyfwH",
"EXAMPLE_VALUE_sW4Tmam5i7D1O4x7ZwX3"
}
}
};
var createWorkspaceRequest = new Oci.DataintegrationService.Requests.CreateWorkspaceRequest
{
CreateWorkspaceDetails = createWorkspaceDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "LAGWICCZY70JMZFHRTCV<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;
}
}
}
}