// 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 = "LfbAV3NbY7v8VMjQpn7l7LWmRBKyRHaTB4FSAOIgSUdkrtailz8TRJse9WZBeqYdfzWS0x6VBOsRQmDntam9pIGf0v5SCFFMR4TSVm99IOP1qA70onJWXMeEiB1CZHCYzxHrm2MnXyBYhTmTF1iQDyeJtpmAM0hmVnBcbQHBto6XvFw2NAc6S9vbx7JB9AI6boP1sCCRLXRwR2LWeQae8FiZ5tjUnk7TJvYWvGdD2k16BbMrL6mw1mbh3umP1Uu",
				SubnetId = "bUyowIQvGfR0ETxvuPhD3cNq9mrZKUYPdtMOU5hGxA9vvtk0EftD9yvhn5cPOrEufky9dnuIHw9TCB6w5SdFWPsULSQUNCAczIuNPq56lA5SyCcxJKwQbW4eKKtEvIOdPOdwRBGoRnFvcCLbO8qYPzgrtOwGTBPiZM9mFpAoLkcDdzbFuPhjho4hc708Xv3nxm7TmJOil5Br8PmLTGGFyIOd5CqGQyusHt3tsVC38dKC04qJfg4UmFl9iKNOPY6",
				DnsServerIp = "EXAMPLE-dnsServerIp-Value",
				DnsServerZone = "EXAMPLE-dnsServerZone-Value",
				FreeformTags = new Dictionary<string, string>()
				{
					{
						"EXAMPLE_KEY_3xVl8", 
						"EXAMPLE_VALUE_wdiIzHEE0m8YrLZ2IPGb"
					}
				},
				DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
				{
					{
						"EXAMPLE_KEY_yO05Q", 
						new Dictionary<string, Object>()
						{
							{
								"EXAMPLE_KEY_K2L73", 
								"EXAMPLE--Value"
							}
						}
					}
				},
				Description = "EXAMPLE-description-Value",
				DisplayName = "EXAMPLE-displayName-Value",
				CompartmentId = "QPlFtaLe2ftRxYOUJcj1FkTDqFc9DVHxdPTIzzZ99mq4fLFu4QQPqN1eOZHjBhqi1hEGmtQ6fjKii6MA3D00u2YhLxJnzn69i13I6G4myfAYAX5MaePWfbUMr4nJ2MV3JSy0vSruCe3CXaWrt2eBZkDGEvPwdRDa07MGHlRoNdyafVVEct6v4rZM2CC3amCPSvhXI9QDLjUAPTwwbGxZDcs5YUidPD0m2cUJsTSCoIYYMEpmEUDbeykgfEsVK0P",
				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_1rWBO", 
						"EXAMPLE_VALUE_OIpEUPkC0UFIezWLcoSB"
					}
				}
			};
			var createWorkspaceRequest = new Oci.DataintegrationService.Requests.CreateWorkspaceRequest
			{
				CreateWorkspaceDetails = createWorkspaceDetails,
				OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
				OpcRequestId = "KZWA4GR051QGX0KQQTXK<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;
            }
        }

    }
}

Was this article helpful?