// 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 = 4801,
StandbySize = 379,
ShapeName = "EXAMPLE-shapeName-Value",
ShapeConfig = new Oci.DesktopsService.Models.CreateDesktopPoolShapeConfigDetails
{
Ocpus = 865,
MemoryInGBs = 217,
BaselineOcpuUtilization = Oci.DesktopsService.Models.CreateDesktopPoolShapeConfigDetails.BaselineOcpuUtilizationEnum.Baseline18
},
UseDedicatedVmHost = Oci.DesktopsService.Models.CreateDesktopPoolDetails.UseDedicatedVmHostEnum.True,
IsStorageEnabled = true,
StorageSizeInGBs = 15056,
StorageBackupPolicyId = "ocid1.test.oc1..<unique_ID>EXAMPLE-storageBackupPolicyId-Value",
DevicePolicy = new Oci.DesktopsService.Models.DesktopDevicePolicy
{
ClipboardMode = Oci.DesktopsService.Models.DesktopDevicePolicy.ClipboardModeEnum.None,
AudioMode = Oci.DesktopsService.Models.DesktopDevicePolicy.AudioModeEnum.Todesktop,
CdmMode = Oci.DesktopsService.Models.DesktopDevicePolicy.CdmModeEnum.None,
IsPrintingEnabled = true,
IsPointerEnabled = false,
IsKeyboardEnabled = false,
IsDisplayEnabled = false,
IsVideoInputEnabled = true
},
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"
},
SessionLifecycleActions = new Oci.DesktopsService.Models.CreateDesktopPoolDesktopSessionLifecycleActions
{
Inactivity = new Oci.DesktopsService.Models.InactivityConfig
{
Action = Oci.DesktopsService.Models.InactivityConfig.ActionEnum.None,
GracePeriodInMinutes = 470
},
Disconnect = new Oci.DesktopsService.Models.DisconnectConfig
{
Action = Oci.DesktopsService.Models.DisconnectConfig.ActionEnum.None,
GracePeriodInMinutes = 163
}
},
TimeStartScheduled = DateTime.Parse("03/30/2030 11:47:44"),
TimeStopScheduled = DateTime.Parse("04/20/2045 01:35:24"),
ContactDetails = "EXAMPLE-contactDetails-Value",
ArePrivilegedUsers = true,
AvailabilityDomain = "EXAMPLE-availabilityDomain-Value",
FreeformTags = new Dictionary<string, string>()
{
{
"EXAMPLE_KEY_H0Sqa",
"EXAMPLE_VALUE_vIBEdwZK4vfnmksID5br"
}
},
DefinedTags = new Dictionary<string, Dictionary<string, Object>>()
{
{
"EXAMPLE_KEY_Y5vts",
new Dictionary<string, Object>()
{
{
"EXAMPLE_KEY_Gba8i",
"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"
},
BootVolumeSizeInGBs = 29936
};
var createDesktopPoolRequest = new Oci.DesktopsService.Requests.CreateDesktopPoolRequest
{
CreateDesktopPoolDetails = createDesktopPoolDetails,
OpcRetryToken = "EXAMPLE-opcRetryToken-Value",
OpcRequestId = "HEIDQRIKSLEAA9TL1PGL<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;
}
}
}
}