# 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).

from datetime import datetime
import oci

# Create a default config using DEFAULT profile in default location
# Refer to
# https://docs.cloud.oracle.com/en-us/iaas/Content/API/Concepts/sdkconfig.htm#SDK_and_CLI_Configuration_File
# for more info
config = oci.config.from_file()


# Initialize service client with default config file
desktops_client = oci.desktops.DesktopServiceClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
create_desktop_pool_response = desktops_client.create_desktop_pool(
    create_desktop_pool_details=oci.desktops.models.CreateDesktopPoolDetails(
        compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
        display_name="EXAMPLE-displayName-Value",
        maximum_size=7900,
        standby_size=208,
        shape_name="EXAMPLE-shapeName-Value",
        is_storage_enabled=True,
        storage_size_in_gbs=17088,
        storage_backup_policy_id="ocid1.test.oc1..<unique_ID>EXAMPLE-storageBackupPolicyId-Value",
        device_policy=oci.desktops.models.DesktopDevicePolicy(
            clipboard_mode="FULL",
            audio_mode="FROMDESKTOP",
            cdm_mode="READONLY",
            is_printing_enabled=False,
            is_pointer_enabled=False,
            is_keyboard_enabled=False,
            is_display_enabled=False),
        availability_policy=oci.desktops.models.DesktopAvailabilityPolicy(
            start_schedule=oci.desktops.models.DesktopSchedule(
                cron_expression="EXAMPLE-cronExpression-Value",
                timezone="EXAMPLE-timezone-Value")),
        image=oci.desktops.models.DesktopImage(
            image_id="ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value",
            image_name="EXAMPLE-imageName-Value",
            operating_system="EXAMPLE-operatingSystem-Value"),
        network_configuration=oci.desktops.models.DesktopNetworkConfiguration(
            vcn_id="ocid1.test.oc1..<unique_ID>EXAMPLE-vcnId-Value",
            subnet_id="ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value"),
        contact_details="EXAMPLE-contactDetails-Value",
        are_privileged_users=True,
        availability_domain="EXAMPLE-availabilityDomain-Value",
        description="EXAMPLE-description-Value",
        shape_config=oci.desktops.models.CreateDesktopPoolShapeConfigDetails(
            ocpus=303,
            memory_in_gbs=801,
            baseline_ocpu_utilization="BASELINE_1_2"),
        use_dedicated_vm_host="TRUE",
        session_lifecycle_actions=oci.desktops.models.CreateDesktopPoolDesktopSessionLifecycleActions(
            inactivity=oci.desktops.models.InactivityConfig(
                action="NONE",
                grace_period_in_minutes=1101),
            disconnect=oci.desktops.models.DisconnectConfig(
                action="NONE",
                grace_period_in_minutes=1222)),
        time_start_scheduled=datetime.strptime(
            "2004-06-24T12:36:05.067Z",
            "%Y-%m-%dT%H:%M:%S.%fZ"),
        time_stop_scheduled=datetime.strptime(
            "2027-10-09T18:15:16.209Z",
            "%Y-%m-%dT%H:%M:%S.%fZ"),
        freeform_tags={
            'EXAMPLE_KEY_MHoLx': 'EXAMPLE_VALUE_4v26K1kDXleR2x49VTpF'},
        defined_tags={
            'EXAMPLE_KEY_STzII': {
                'EXAMPLE_KEY_Hl8Ae': 'EXAMPLE--Value'}},
        nsg_ids=["EXAMPLE--Value"],
        private_access_details=oci.desktops.models.CreateDesktopPoolPrivateAccessDetails(
            subnet_id="ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value",
            nsg_ids=["EXAMPLE--Value"],
            private_ip="EXAMPLE-privateIp-Value")),
    opc_retry_token="EXAMPLE-opcRetryToken-Value",
    opc_request_id="QEX5GWUQXROC2HSZOBTG<unique_ID>")

# Get the data from response
print(create_desktop_pool_response.data)

Was this article helpful?