# 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
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",
availability_domain="EXAMPLE-availabilityDomain-Value",
date_expected_capacity_handover=datetime.strptime(
"2020-03-26T03:19:28.205Z",
"%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=418,
source_workload_type="EXAMPLE-sourceWorkloadType-Value",
expected_handover_quantity=914,
date_expected_handover=datetime.strptime(
"2033-04-03T18:34:37.337Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
actual_handover_quantity=295,
date_actual_handover=datetime.strptime(
"2040-12-10T16:56:48.512Z",
"%Y-%m-%dT%H:%M:%S.%fZ"))],
occ_availability_catalog_id="ocid1.test.oc1..<unique_ID>EXAMPLE-occAvailabilityCatalogId-Value",
request_type="NEW",
description="EXAMPLE-description-Value",
freeform_tags={
'EXAMPLE_KEY_MBB3M': 'EXAMPLE_VALUE_dJcAtDDl8yAo4QawD251'},
defined_tags={
'EXAMPLE_KEY_LQzaW': {
'EXAMPLE_KEY_54e1j': 'EXAMPLE--Value'}},
lifecycle_details="EXAMPLE-lifecycleDetails-Value",
request_state="SUBMITTED"),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="GYDRFTDXZ4CMKL2KZBQZ<unique_ID>")
# Get the data from response
print(create_occ_capacity_request_response.data)