// 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 = "aqEMmxuFjKl1AfqSsZrGNt7eyf0m4xb8CHtb93O9bG8DXIWfDfIy3dUy7HPaskNvxMVNHkGggEBNDWz2ucspoAnFLFCZxMsKvV4jULHJ5uRvqK3bvdSnrAWUHFrgvy4OOjIEjPeguyGNOvbu1g2WkCOOTSEZDXqybOKMtlruZfHPxkevYGLmKbzb1MEA8UeMjU87QO1hLpRYuA4ls1cDqDeRA6vBOBaw2nN2VvmhQNwSCnXlAZJ3Nlya88iMOd0",
SubnetId = "BtP4EvRwcUqLodYiP0yHdbzUPTeSrc6xwLesZafBPeailctPWQ6tB6cdHasHvv9FrzeoplrUXcZznVxM6nLcKb5xO7QQikHoezfMk98Jk6FLxT4HNP1RJ4VNaEmh5QrQ7pPr4Cks8AYvNPXUa47lA5d9hmG6Vd4bjDkUfHMLw0kFHU4ZDJTBQCknQJMkEWDKPo0OiHgW5Idizb6AnCEzPAVQIx8m8o1ODIAakdLiNezTTmFm118GxyCPF4K8mZQ",
DnsServerIp = "EXAMPLE-dnsServerIp-Value",
DnsServerZone = "EXAMPLE-dnsServerZone-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_D7P0k",
"EXAMPLE_VALUE_7YOIivmjzvcrVhvNSNia"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_Cxuk6",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_vV47d",
"EXAMPLE--Value"
}
}
}
},
Description = "EXAMPLE-description-Value",
DisplayName = "EXAMPLE-displayName-Value",
CompartmentId = "JmgxMuv8p5NEp9XVwsp6W1fcf9wqzvCjXPU1AeS1PvuvO4MF7zfwxMGopquyE2pCTdToxGMhPXWptO9VI8tcD71ryKojZZTkBT5n1u8CvxvRJXeVH86r9loB66fXViLinZLxNXLsffFO0zuZg13p6sWanzGcfPFJ8uzCt7h05XYDFNZo0FIadKj51irwInvhvvg7ywY69dTaU0duGSfVL1w3caZ3j82rkWdBTBngbct6TI4DkT6BnYHCC1cH9rB",
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_HYs6x",
"EXAMPLE_VALUE_C11SdiBXIOKsTz8dBisP"
}
}
};
var createWorkspaceRequest = new Oci.DataintegrationService.Requests.CreateWorkspaceRequest
{
CreateWorkspaceDetails = createWorkspaceDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "EUO7DMNUJSVOORCFXKMH<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;
}
}
}
}