# 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'
# 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
batch_client = OCI::Batch::BatchComputingClient.new(config: config)
# Send the request to service, some parameters are not required, see API doc for more info
create_batch_context_response =
batch_client.create_batch_context(
OCI::Batch::Models::CreateBatchContextDetails.new(
compartment_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value',
network:
OCI::Batch::Models::CreateNetworkDetails.new(
subnet_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-subnetId-Value',
nsg_ids: %w[EXAMPLE--Value]
),
fleets: [
OCI::Batch::Models::CreateServiceManagedFleetDetails.new(
type: 'SERVICE_MANAGED_FLEET',
name: 'EXAMPLE-name-Value',
shape:
OCI::Batch::Models::FleetShape.new(
shape_name: 'EXAMPLE-shapeName-Value',
ocpus: 389,
memory_in_gbs: 980,
disk_size_in_gbs: 85
),
max_concurrent_tasks: 176
)
],
display_name: 'EXAMPLE-displayName-Value',
description: 'EXAMPLE-description-Value',
freeform_tags: {
'EXAMPLE_KEY_nj7wJ' => 'EXAMPLE_VALUE_Snac5SQnKPgCZCzTzdsQ'
},
defined_tags: {
'EXAMPLE_KEY_EgYX4' => { 'EXAMPLE_KEY_SLdfx' => 'EXAMPLE--Value' }
},
job_priority_configurations: [
OCI::Batch::Models::JobPriorityConfiguration.new(
tag_namespace: 'EXAMPLE-tagNamespace-Value',
tag_key: 'EXAMPLE-tagKey-Value',
weight: -21,
values: { 'EXAMPLE_KEY_72ZF7' => -652_557_629 }
)
],
entitlements: { 'EXAMPLE_KEY_L1Jzf' => 569_828_378 },
logging_configuration:
OCI::Batch::Models::OciLoggingConfiguration.new(
type: 'OCI_LOGGING',
log_group_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-logGroupId-Value',
log_id: 'ocid1.test.oc1..<unique_ID>EXAMPLE-logId-Value',
is_job_task_events_propagation_enabled: true
)
)
)
# Get the data from response
puts "#{create_batch_context_response.data}"