// 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.DesktopsService;
using Oci.Common;
using Oci.Common.Auth;
namespace Oci.Sdk.DotNet.Example.Desktops
{
public class CreateDesktopPoolExample
{
public static async Task Main()
{
// Create a request and dependent object(s).
var createDesktopPoolDetails = new Oci.DesktopsService.Models.CreateDesktopPoolDetails
{
CompartmentId = "ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
DisplayName = "EXAMPLE-displayName-Value",
Description = "EXAMPLE-description-Value",
MaximumSize = 4694,
StandbySize = 101,
ShapeName = "EXAMPLE-shapeName-Value",
ShapeConfig = new Oci.DesktopsService.Models.CreateDesktopPoolShapeConfigDetails
{
Ocpus = 897,
MemoryInGBs = 870,
BaselineOcpuUtilization = Oci.DesktopsService.Models.CreateDesktopPoolShapeConfigDetails.BaselineOcpuUtilizationEnum.Baseline11
},
UseDedicatedVmHost = Oci.DesktopsService.Models.CreateDesktopPoolDetails.UseDedicatedVmHostEnum.True,
IsStorageEnabled = true,
StorageSizeInGBs = 19662,
StorageBackupPolicyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-storageBackupPolicyId-Value",
DevicePolicy = new Oci.DesktopsService.Models.DesktopDevicePolicy
{
ClipboardMode = Oci.DesktopsService.Models.DesktopDevicePolicy.ClipboardModeEnum.Todesktop,
AudioMode = Oci.DesktopsService.Models.DesktopDevicePolicy.AudioModeEnum.Full,
CdmMode = Oci.DesktopsService.Models.DesktopDevicePolicy.CdmModeEnum.None,
IsPrintingEnabled = false,
IsPointerEnabled = false,
IsKeyboardEnabled = true,
IsDisplayEnabled = true,
IsVideoInputEnabled = false
},
AvailabilityPolicy = new Oci.DesktopsService.Models.DesktopAvailabilityPolicy
{
StartSchedule = new Oci.DesktopsService.Models.DesktopSchedule
{
CronExpression = "EXAMPLE-cronExpression-Value",
Timezone = "EXAMPLE-timezone-Value"
},
},
Image = new Oci.DesktopsService.Models.DesktopImage
{
ImageId = "ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
ImageName = "EXAMPLE-imageName-Value",
OperatingSystem = "EXAMPLE-operatingSystem-Value"
},
NetworkConfiguration = new Oci.DesktopsService.Models.DesktopNetworkConfiguration
{
VcnId = "ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value",
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
SecurityAttributes = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_OYaGT",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_kI980",
"EXAMPLE--Value"
}
}
}
}
},
SessionLifecycleActions = new Oci.DesktopsService.Models.CreateDesktopPoolDesktopSessionLifecycleActions
{
Inactivity = new Oci.DesktopsService.Models.InactivityConfig
{
Action = Oci.DesktopsService.Models.InactivityConfig.ActionEnum.None,
GracePeriodInMinutes = 305
},
Disconnect = new Oci.DesktopsService.Models.DisconnectConfig
{
Action = Oci.DesktopsService.Models.DisconnectConfig.ActionEnum.Delete,
GracePeriodInMinutes = 195
}
},
TimeStartScheduled = DateTime.Parse("12/14/2040 05:09:06"),
TimeStopScheduled = DateTime.Parse("10/27/2004 11:25:09"),
ContactDetails = "EXAMPLE-contactDetails-Value",
ArePrivilegedUsers = false,
AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_gwX7B",
"EXAMPLE_VALUE_sp5DlNXFPo0YXnLD96yk"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_8C9Hy",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_9qTxD",
"EXAMPLE--Value"
}
}
}
},
NsgIds = new List<string>
{
"EXAMPLE--Value"
},
PrivateAccessDetails = new Oci.DesktopsService.Models.CreateDesktopPoolPrivateAccessDetails
{
SubnetId = "ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
NsgIds = new List<string>
{
"EXAMPLE--Value"
},
PrivateIp = "EXAMPLE-privateIp-Value",
SecurityAttributes = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_2qgZS",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_ZhKRf",
"EXAMPLE--Value"
}
}
}
}
},
SecurityAttributes = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_xBlPJ",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_YG5an",
"EXAMPLE--Value"
}
}
}
},
BootVolumeSizeInGBs = 29147
};
var createDesktopPoolRequest = new Oci.DesktopsService.Requests.CreateDesktopPoolRequest
{
CreateDesktopPoolDetails = createDesktopPoolDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "LIFKX06TTFZG2BCMDNZF<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 DesktopServiceClient(provider, new ClientConfiguration()))
{
var response = await client.CreateDesktopPool(createDesktopPoolRequest);
// Retrieve value from the response.
var id = response.DesktopPool.Id;
}
}
catch (Exception e)
{
Console.WriteLine($"CreateDesktopPool Failed with {e.Message}");
throw e;
}
}
}
}