# 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
self_client = oci.self.PartnerIntegerationClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
submit_subscription_usage_records_response = self_client.submit_subscription_usage_records(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
submit_subscription_usage_records_details=oci.self.models.SubmitSubscriptionUsageRecordsDetails(
subscription_usage_records=[
oci.self.models.CreateSubscriptionUsageRecordDetails(
id="ocid1.test.oc1..<unique_ID>EXAMPLE-id-Value",
marketplace_offer_id="ocid1.test.oc1..<unique_ID>EXAMPLE-marketplaceOfferId-Value",
usage_dimension_name="EXAMPLE-usageDimensionName-Value",
amount=8697.652,
currency_code="tz8",
time_usage_started=datetime.strptime(
"2020-10-15T18:04:06.213Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
time_usage_ended=datetime.strptime(
"2024-02-19T16:37:40.532Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
billing_type="USAGE_BASED",
consumed_quantity=2901.3723,
billing_period="ZmNEeb9",
customer_tenancy_id="ocid1.test.oc1..<unique_ID>EXAMPLE-customerTenancyId-Value",
billing_identifier="EXAMPLE-billingIdentifier-Value",
unit_of_measure="EXAMPLE-unitOfMeasure-Value",
unit_price=5304.449,
product_sku="EXAMPLE-productSku-Value",
contract_duration="QUARTERLY",
additional_metadata=[
oci.self.models.ExtendedMetadata(
key="EXAMPLE-key-Value",
value="EXAMPLE-value-Value")],
usage_record_id="ocid1.test.oc1..<unique_ID>EXAMPLE-usageRecordId-Value")]),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="GOIV1RJOUU13UOFGWQBV<unique_ID>")
# Get the data from response
print(submit_subscription_usage_records_response.headers)