# 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
# 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.SubscriptionClient(config)
# Send the request to service, some parameters are not required, see API
# doc for more info
create_subscription_response = self_client.create_subscription(
create_subscription_details=oci.self.models.CreateSubscriptionDetails(
compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
tenant_id="ocid1.test.oc1..<unique_ID>EXAMPLE-tenantId-Value",
subscription_details=oci.self.models.SubscriptionDetails(
pricing_plan=oci.self.models.PricingPlan(
plan_type="FIXED",
plan_name="EXAMPLE-planName-Value",
billing_frequency="MONTHLY",
rates=[
oci.self.models.PricingRate(
currency="eup",
rate=8058.1914)],
plan_description="EXAMPLE-planDescription-Value",
plan_duration="MONTHLY",
dimensions=[
oci.self.models.UsageDimension(
dimension_name="EXAMPLE-dimensionName-Value",
dimension_key="EXAMPLE-dimensionKey-Value",
dimension_description="EXAMPLE-dimensionDescription-Value",
metric_type="OCPU_HOURS",
dimension_billing_frequency="MONTHLY",
included_quantity=4800.905)]),
partner_registration_url="EXAMPLE-partnerRegistrationUrl-Value",
billing_details=[
oci.self.models.BillingDetails(
pricing_plan_key="EXAMPLE-pricingPlanKey-Value",
billing_model="USAGE_BASED",
sku="EXAMPLE-sku-Value",
metric_type="INSTANCE_HOURS",
rate_allocation=0.5225627,
meters=[
oci.self.models.Meter(
name="EXAMPLE-name-Value",
rate_allocation=0.2837084,
extended_metadata=[
oci.self.models.ExtendedMetadata(
key="EXAMPLE-key-Value",
value="EXAMPLE-value-Value")])],
has_gov_sku=True)],
currency="NPL",
amount=5337.7056,
is_auto_renew=False),
seller_id="ocid1.test.oc1..<unique_ID>EXAMPLE-sellerId-Value",
product_id="ocid1.test.oc1..<unique_ID>EXAMPLE-productId-Value",
display_name="EXAMPLE-displayName-Value",
source_type="OCI_NATIVE",
additional_details=[
oci.self.models.ExtendedMetadata(
key="EXAMPLE-key-Value",
value="EXAMPLE-value-Value")],
realm="EXAMPLE-realm-Value",
region="EXAMPLE-region-Value",
freeform_tags={
'EXAMPLE_KEY_yfQRS': 'EXAMPLE_VALUE_Eb6dWv4V08oTWYuNLZvH'},
defined_tags={
'EXAMPLE_KEY_gexda': {
'EXAMPLE_KEY_BV7wz': 'EXAMPLE--Value'}}),
opc_retry_token="EXAMPLE-opcRetryToken-Value",
opc_request_id="2OU9ULMEM12UIWJPE55M<unique_ID>")
# Get the data from response
print(create_subscription_response.data)