# 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
usage_api_client = oci.usage_api.UsageapiClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
request_summarized_usages_response = usage_api_client.request_summarized_usages(
    request_summarized_usages_details=oci.usage_api.models.RequestSummarizedUsagesDetails(
        tenant_id="ocid1.test.oc1..<unique_ID>EXAMPLE-tenantId-Value",
        time_usage_started=datetime.strptime(
            "2009-02-06T13:52:23.125Z",
            "%Y-%m-%dT%H:%M:%S.%fZ"),
        time_usage_ended=datetime.strptime(
            "2015-07-10T10:39:02.547Z",
            "%Y-%m-%dT%H:%M:%S.%fZ"),
        granularity="TOTAL",
        is_aggregate_by_time=False,
        forecast=oci.usage_api.models.Forecast(
                    time_forecast_ended=datetime.strptime(
                        "2044-01-24T04:19:33.453Z",
                        "%Y-%m-%dT%H:%M:%S.%fZ"),
            forecast_type="BASIC",
            time_forecast_started=datetime.strptime(
                        "2043-10-12T07:46:04.512Z",
                        "%Y-%m-%dT%H:%M:%S.%fZ")),
        query_type="ALLCREDIT",
        group_by=["EXAMPLE--Value"],
        group_by_tag=[
            oci.usage_api.models.Tag(
                namespace="EXAMPLE-namespace-Value",
                key="EXAMPLE-key-Value",
                value="EXAMPLE-value-Value")],
        compartment_depth=1.9527036,
        filter=oci.usage_api.models.Filter(
            operator="AND",
            dimensions=[
                oci.usage_api.models.Dimension(
                    key="EXAMPLE-key-Value",
                    value="EXAMPLE-value-Value")],
            tags=[
                oci.usage_api.models.Tag(
                    namespace="EXAMPLE-namespace-Value",
                    key="EXAMPLE-key-Value",
                    value="EXAMPLE-value-Value")])),
    opc_request_id="SCDICOPHEBGFSGHYDP7S<unique_ID>",
    page="EXAMPLE-page-Value",
    limit=868)

# Get the data from response
print(request_summarized_usages_response.data)