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

require 'oci'
require 'date'

# 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::ConfigFileLoader.load_config

# Initialize service client with default config file
desktops_client = OCI::Desktops::DesktopServiceClient.new(config: 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(
    OCI::Desktops::Models::CreateDesktopPoolDetails.new(
      compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
      display_name: 'EXAMPLE-displayName-Value',
      maximum_size: 7251,
      standby_size: 383,
      shape_name: 'EXAMPLE-shapeName-Value',
      is_storage_enabled: true,
      storage_size_in_gbs: 26_918,
      storage_backup_policy_id:
        'ocid1.test.oc1..<unique_ID>EXAMPLE-storageBackupPolicyId-Value',
      device_policy:
        OCI::Desktops::Models::DesktopDevicePolicy.new(
          clipboard_mode: 'FULL',
          audio_mode: 'FULL',
          cdm_mode: 'FULL',
          is_printing_enabled: false,
          is_pointer_enabled: true,
          is_keyboard_enabled: true,
          is_display_enabled: false
        ),
      availability_policy:
        OCI::Desktops::Models::DesktopAvailabilityPolicy.new(
          start_schedule:
            OCI::Desktops::Models::DesktopSchedule.new(
              cron_expression: 'EXAMPLE-cronExpression-Value',
              timezone: 'EXAMPLE-timezone-Value'
            )
        ),
      image:
        OCI::Desktops::Models::DesktopImage.new(
          image_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-imageId-Value',
          image_name: 'EXAMPLE-imageName-Value'
        ),
      network_configuration:
        OCI::Desktops::Models::DesktopNetworkConfiguration.new(
          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',
      time_start_scheduled: DateTime.parse('2038-10-24T11:28:33.573Z'),
      time_stop_scheduled: DateTime.parse('2037-10-01T23:17:08.427Z'),
      freeform_tags: {
        'EXAMPLE_KEY_wmKu9' => 'EXAMPLE_VALUE_e0xUiSGt98PPCsuAK8ts'
      },
      defined_tags: {
        'EXAMPLE_KEY_JjfYb' => { 'EXAMPLE_KEY_qhJWH' => 'EXAMPLE--Value' }
      },
      nsg_ids: %w[EXAMPLE--Value]
    )
  )

# Get the data from response
puts "#{create_desktop_pool_response.data}"

Was this article helpful?