# 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
from datetime import datetime

# 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
data_connectivity_client = oci.data_connectivity.DataConnectivityManagementClient(
    config)


# Send the request to service, some parameters are not required, see API
# doc for more info
create_connection_response = data_connectivity_client.create_connection(
    registry_id="ocid1.test.oc1..<unique_ID>EXAMPLE-registryId-Value",
    create_connection_details=oci.data_connectivity.models.CreateConnectionDetails(
        name="EXAMPLE-name-Value",
        identifier="EXAMPLE-identifier-Value",
        properties={
            'EXAMPLE_KEY_pTHQg': 'EXAMPLE--Value'},
        type="EXAMPLE-type-Value",
        key="EXAMPLE-key-Value",
        model_version="EXAMPLE-modelVersion-Value",
        model_type="EXAMPLE-modelType-Value",
        description="EXAMPLE-description-Value",
        object_version=464,
        object_status=315,
        primary_schema=oci.data_connectivity.models.Schema(
            key="EXAMPLE-key-Value",
            model_type="EXAMPLE-modelType-Value",
            name="EXAMPLE-name-Value",
            identifier="EXAMPLE-identifier-Value",
            model_version="EXAMPLE-modelVersion-Value",
            parent_ref=oci.data_connectivity.models.ParentReference(
                    parent="EXAMPLE-parent-Value"),
            resource_name="EXAMPLE-resourceName-Value",
            description="EXAMPLE-description-Value",
            object_version=973,
            external_key="EXAMPLE-externalKey-Value",
            is_has_containers=False,
            default_connection="EXAMPLE-defaultConnection-Value",
            object_status=259,
            metadata=oci.data_connectivity.models.ObjectMetadata(
                        created_by="EXAMPLE-createdBy-Value",
                        created_by_name="EXAMPLE-createdByName-Value",
                        updated_by="EXAMPLE-updatedBy-Value",
                        updated_by_name="EXAMPLE-updatedByName-Value",
                        time_created=datetime.strptime(
                            "2008-01-24T18:43:30.728Z",
                            "%Y-%m-%dT%H:%M:%S.%fZ"),
                time_updated=datetime.strptime(
                            "2031-09-05T13:10:00.775Z",
                            "%Y-%m-%dT%H:%M:%S.%fZ"),
                aggregator_key="EXAMPLE-aggregatorKey-Value",
                aggregator=oci.data_connectivity.models.AggregatorSummary(
                            type="EXAMPLE-type-Value",
                            key="EXAMPLE-key-Value",
                            name="EXAMPLE-name-Value",
                            identifier="EXAMPLE-identifier-Value",
                            description="EXAMPLE-description-Value"),
                identifier_path="EXAMPLE-identifierPath-Value",
                info_fields={
                            'EXAMPLE_KEY_c3ZT3': 'EXAMPLE_VALUE_y2mvBIEijHyk4gJKPdTo'},
                registry_version=711,
                labels=["EXAMPLE--Value"],
                is_favorite=True)),
        connection_properties=[
            oci.data_connectivity.models.ConnectionProperty(
                name="EXAMPLE-name-Value",
                value="EXAMPLE-value-Value")],
        is_default=False,
        metadata=oci.data_connectivity.models.ObjectMetadata(
            created_by="EXAMPLE-createdBy-Value",
            created_by_name="EXAMPLE-createdByName-Value",
            updated_by="EXAMPLE-updatedBy-Value",
            updated_by_name="EXAMPLE-updatedByName-Value",
            time_created=datetime.strptime(
                "2047-08-31T13:49:14.523Z",
                "%Y-%m-%dT%H:%M:%S.%fZ"),
            time_updated=datetime.strptime(
                "2015-04-15T06:13:52.786Z",
                "%Y-%m-%dT%H:%M:%S.%fZ"),
            aggregator_key="EXAMPLE-aggregatorKey-Value",
            aggregator=oci.data_connectivity.models.AggregatorSummary(
                type="EXAMPLE-type-Value",
                key="EXAMPLE-key-Value",
                name="EXAMPLE-name-Value",
                identifier="EXAMPLE-identifier-Value",
                description="EXAMPLE-description-Value"),
            identifier_path="EXAMPLE-identifierPath-Value",
            info_fields={
                'EXAMPLE_KEY_RNsc8': 'EXAMPLE_VALUE_HkGwp2jLHIX90O8CUGqN'},
            registry_version=350,
            labels=["EXAMPLE--Value"],
            is_favorite=False),
        registry_metadata=oci.data_connectivity.models.RegistryMetadata(
            aggregator_key="EXAMPLE-aggregatorKey-Value",
            labels=["EXAMPLE--Value"],
            registry_version=800,
            key="EXAMPLE-key-Value",
            is_favorite=False,
            created_by_user_id="ocid1.test.oc1..<unique_ID>EXAMPLE-createdByUserId-Value",
            created_by_user_name="EXAMPLE-createdByUserName-Value",
            updated_by_user_id="ocid1.test.oc1..<unique_ID>EXAMPLE-updatedByUserId-Value",
            updated_by_user_name="EXAMPLE-updatedByUserName-Value",
            time_created=datetime.strptime(
                "2010-01-20T06:12:29.071Z",
                "%Y-%m-%dT%H:%M:%S.%fZ"),
            time_updated=datetime.strptime(
                "2016-11-15T12:53:21.111Z",
                "%Y-%m-%dT%H:%M:%S.%fZ"))),
    opc_request_id="KJWX2WL57FXCYLLPHCSS<unique_ID>",
    opc_retry_token="EXAMPLE-opcRetryToken-Value")

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