# 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).
import oci
from datetime import datetime
# 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
capacity_management_client = oci.capacity_management.CapacityManagementClient(
config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_occ_capacity_request_response = capacity_management_client.create_occ_capacity_request(
create_occ_capacity_request_details=oci.capacity_management.models.CreateOccCapacityRequestDetails(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
namespace="COMPUTE",
region="EXAMPLE-region-Value",
display_name="EXAMPLE-displayName-Value",
date_expected_capacity_handover=datetime.strptime(
"2008-01-04T12:03:26.738Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
details=[
oci.capacity_management.models.OccCapacityRequestBaseDetails(
resource_type="EXAMPLE-resourceType-Value",
workload_type="EXAMPLE-workloadType-Value",
resource_name="EXAMPLE-resourceName-Value",
demand_quantity=409,
source_workload_type="EXAMPLE-sourceWorkloadType-Value",
expected_handover_quantity=283,
date_expected_handover=datetime.strptime(
"2046-11-15T05:38:11.481Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
actual_handover_quantity=458,
date_actual_handover=datetime.strptime(
"2044-08-01T16:06:09.223Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
availability_domain="EXAMPLE-availabilityDomain-Value",
associated_occ_handover_resource_block_list=[
oci.capacity_management.models.AssociatedOccHandoverResourceBlock(
occ_handover_resource_block_id="ocid1.test.oc1..<unique_ID>EXAMPLE-occHandoverResourceBlockId-Value",
handover_quantity=425)])],
occ_availability_catalog_id="ocid1.test.oc1..<unique_ID>EXAMPLE-occAvailabilityCatalogId-Value",
request_type="TRANSFER",
description="EXAMPLE-description-Value",
freeform_tags={
'EXAMPLE_KEY_cjWKP': 'EXAMPLE_VALUE_U8fggc8uiQBSyZMjrycz'},
defined_tags={
'EXAMPLE_KEY_CTtAy': {
'EXAMPLE_KEY_ZIhzj': 'EXAMPLE--Value'}},
lifecycle_details="EXAMPLE-lifecycleDetails-Value",
availability_domain="EXAMPLE-availabilityDomain-Value",
request_state="SUBMITTED"),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="YHX31IW2VON5RGFPIPMT<unique_ID>")
# Get the data from response
print(create_occ_capacity_request_response.data)