# 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=7212.0493,
currency_code="NCG",
time_usage_started=datetime.strptime(
"2002-10-28T06:54:03.553Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
time_usage_ended=datetime.strptime(
"2002-01-30T13:28:34.024Z",
"%Y-%m-%dT%H:%M:%S.%fZ"),
billing_type="FLAT_RATE",
consumed_quantity=7725.696,
billing_period="OL7RK16",
customer_tenancy_id="ocid1.test.oc1..<unique_ID>EXAMPLE-customerTenancyId-Value",
billing_identifier="EXAMPLE-billingIdentifier-Value",
unit_of_measure="EXAMPLE-unitOfMeasure-Value",
unit_price=2118.9277,
product_sku="EXAMPLE-productSku-Value",
contract_duration="QUARTERLY",
additional_metadata=[
oci.self.models.ExtendedMetadata(
key="EXAMPLE-key-Value",
value="EXAMPLE-value-Value")])]),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="P3TUVWLP6RNOSTIG7A1D<unique_ID>")
# Get the data from response
print(submit_subscription_usage_records_response.headers)