# 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
data_integration_client = oci.data_integration.DataIntegrationClient(config)


# Send the request to service, some parameters are not required, see API
# doc for more info
create_external_publication_response = data_integration_client.create_external_publication(
    workspace_id="ocid1.test.oc1..<unique_ID>EXAMPLE-workspaceId-Value",
    task_key="EXAMPLE-taskKey-Value",
    create_external_publication_details=oci.data_integration.models.CreateExternalPublicationDetails(
        application_compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-applicationCompartmentId-Value",
        display_name="EXAMPLE-displayName-Value",
        application_id="ocid1.test.oc1..<unique_ID>EXAMPLE-applicationId-Value",
        description="EXAMPLE-description-Value",
        resource_configuration=oci.data_integration.models.ResourceConfiguration(
            spark_version="EXAMPLE-sparkVersion-Value",
            driver_shape="EXAMPLE-driverShape-Value",
            executor_shape="EXAMPLE-executorShape-Value",
            total_executors=22),
        configuration_details=oci.data_integration.models.ConfigurationDetails(
            data_asset=oci.data_integration.models.DataAssetFromOracleDetails(
                model_type="ORACLE_DATA_ASSET",
                key="EXAMPLE-key-Value",
                model_version="EXAMPLE-modelVersion-Value",
                name="EXAMPLE-name-Value",
                description="EXAMPLE-description-Value",
                object_status=250,
                identifier="EXAMPLE-identifier-Value",
                external_key="EXAMPLE-externalKey-Value",
                asset_properties={
                    'EXAMPLE_KEY_1f5jl': 'EXAMPLE_VALUE_sshhJ6bUXivDwN2YqBNb'},
                native_type_system=oci.data_integration.models.TypeSystem(
                    key="EXAMPLE-key-Value",
                    model_type="EXAMPLE-modelType-Value",
                    model_version="EXAMPLE-modelVersion-Value",
                    parent_ref=oci.data_integration.models.ParentReference(
                        parent="EXAMPLE-parent-Value"),
                    name="EXAMPLE-name-Value",
                    description="EXAMPLE-description-Value",
                    object_version=677,
                    type_mapping_to={
                        'EXAMPLE_KEY_nfLOH': 'EXAMPLE_VALUE_1FKwtPPXQ8w1U6uysl8s'},
                    type_mapping_from={
                        'EXAMPLE_KEY_JM7dm': 'EXAMPLE_VALUE_oPxbRscVlmKb7zYmuPi8'},
                    object_status=623,
                    identifier="EXAMPLE-identifier-Value",
                    types=[
                        oci.data_integration.models.DataType(
                            model_type="DATA_TYPE",
                            key="EXAMPLE-key-Value",
                            model_version="EXAMPLE-modelVersion-Value",
                            parent_ref=oci.data_integration.models.ParentReference(
                                parent="EXAMPLE-parent-Value"),
                            name="EXAMPLE-name-Value",
                            object_status=514,
                            description="EXAMPLE-description-Value",
                            dt_type="PRIMITIVE",
                            type_system_name="EXAMPLE-typeSystemName-Value",
                            config_definition=oci.data_integration.models.ConfigDefinition(
                                        key="EXAMPLE-key-Value",
                                        model_type="EXAMPLE-modelType-Value",
                                        model_version="EXAMPLE-modelVersion-Value",
                                        parent_ref=oci.data_integration.models.ParentReference(
                                            parent="EXAMPLE-parent-Value"),
                                        name="EXAMPLE-name-Value",
                                        is_contained=True,
                                        object_status=821,
                                        config_parameter_definitions={
                                            'EXAMPLE_KEY_38IHH': {
                                                'parameterType': {
                                                    'modelType': 'COMPOSITE_TYPE',
                                                    'key': 'EXAMPLE-key-Value',
                                                    'modelVersion': 'EXAMPLE-modelVersion-Value',
                                                    'parentRef': {
                                                        'parent': 'EXAMPLE-parent-Value'},
                                                    'name': 'EXAMPLE-name-Value',
                                                    'objectStatus': 749,
                                                    'description': 'EXAMPLE-description-Value',
                                                    'elements': [
                                                        {
                                                            'modelType': 'SHAPE',
                                                            'key': 'EXAMPLE-key-Value',
                                                            'modelVersion': 'EXAMPLE-modelVersion-Value',
                                                            'parentRef': {
                                                                'parent': 'EXAMPLE-parent-Value'},
                                                            'configValues': {
                                                                'configParamValues': {
                                                                    'EXAMPLE_KEY_pvFAN': {
                                                                        'stringValue': 'EXAMPLE-stringValue-Value',
                                                                        'intValue': 751,
                                                                        'objectValue': 'EXAMPLE-objectValue-Value',
                                                                        'refValue': 'EXAMPLE-refValue-Value',
                                                                        'parameterValue': 'EXAMPLE-parameterValue-Value'}},
                                                                'parentRef': {
                                                                    'parent': 'EXAMPLE-parent-Value'}},
                                                            'objectStatus': 642,
                                                            'name': 'EXAMPLE-name-Value',
                                                            'description': 'EXAMPLE-description-Value'}]},
                                                'parameterName': 'EXAMPLE-parameterName-Value',
                                                'description': 'EXAMPLE-description-Value',
                                                'defaultValue': 'EXAMPLE-defaultValue-Value',
                                                                'classFieldName': 'EXAMPLE-classFieldName-Value',
                                                                'isStatic': True,
                                                'isClassFieldValue': False}}))]),
                object_version=794,
                parent_ref=oci.data_integration.models.ParentReference(
                    parent="EXAMPLE-parent-Value"),
                metadata=oci.data_integration.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(
                        "2042-04-03T14:51:07.269Z",
                        "%Y-%m-%dT%H:%M:%S.%fZ"),
                    time_updated=datetime.strptime(
                        "2027-09-23T21:49:25.369Z",
                        "%Y-%m-%dT%H:%M:%S.%fZ"),
                    aggregator_key="EXAMPLE-aggregatorKey-Value",
                    aggregator=oci.data_integration.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_aiXX1': 'EXAMPLE_VALUE_tMpK2JZDGPox5mbh1uh9'},
                    registry_version=305,
                    labels=["EXAMPLE--Value"],
                    is_favorite=False),
                key_map={
                    'EXAMPLE_KEY_cj6ZM': 'EXAMPLE_VALUE_w9rmlNlXIIBdKlmkiyN1'},
                host="EXAMPLE-host-Value",
                port="EXAMPLE-port-Value",
                service_name="EXAMPLE-serviceName-Value",
                driver_class="EXAMPLE-driverClass-Value",
                sid="EXAMPLE-sid-Value",
                credential_file_content="EXAMPLE-credentialFileContent-Value",
                wallet_secret=oci.data_integration.models.SensitiveAttribute(
                    secret_config=oci.data_integration.models.OciVaultSecretConfig(
                        model_type="OCI_VAULT_SECRET_CONFIG",
                        secret_id="ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
                    value="EXAMPLE-value-Value"),
                wallet_password_secret=oci.data_integration.models.SensitiveAttribute(
                    secret_config=oci.data_integration.models.OciVaultSecretConfig(
                        model_type="OCI_VAULT_SECRET_CONFIG",
                        secret_id="ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
                    value="EXAMPLE-value-Value"),
                default_connection=oci.data_integration.models.ConnectionFromOracleDetails(
                    model_type="ORACLEDB_CONNECTION",
                    key="EXAMPLE-key-Value",
                    model_version="EXAMPLE-modelVersion-Value",
                    parent_ref=oci.data_integration.models.ParentReference(
                        parent="EXAMPLE-parent-Value"),
                    name="EXAMPLE-name-Value",
                    description="EXAMPLE-description-Value",
                    object_version=98,
                    object_status=713,
                    identifier="EXAMPLE-identifier-Value",
                    primary_schema=oci.data_integration.models.Schema(
                        key="EXAMPLE-key-Value",
                        model_type="EXAMPLE-modelType-Value",
                        model_version="EXAMPLE-modelVersion-Value",
                        parent_ref=oci.data_integration.models.ParentReference(
                                parent="EXAMPLE-parent-Value"),
                        name="EXAMPLE-name-Value",
                        resource_name="EXAMPLE-resourceName-Value",
                        description="EXAMPLE-description-Value",
                        object_version=883,
                        external_key="EXAMPLE-externalKey-Value",
                        is_has_containers=True,
                        default_connection="EXAMPLE-defaultConnection-Value",
                        object_status=343,
                        identifier="EXAMPLE-identifier-Value",
                        metadata=oci.data_integration.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(
                                    "2002-10-26T15:02:53.306Z",
                                    "%Y-%m-%dT%H:%M:%S.%fZ"),
                            time_updated=datetime.strptime(
                                "2034-02-18T19:31:31.973Z",
                                "%Y-%m-%dT%H:%M:%S.%fZ"),
                            aggregator_key="EXAMPLE-aggregatorKey-Value",
                            aggregator=oci.data_integration.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_OdR1E': 'EXAMPLE_VALUE_93tyZ2kjApaO4IsNEVbe'},
                            registry_version=888,
                            labels=["EXAMPLE--Value"],
                            is_favorite=False)),
                    connection_properties=[
                        oci.data_integration.models.ConnectionProperty(
                            name="EXAMPLE-name-Value",
                            value="EXAMPLE-value-Value")],
                    is_default=True,
                    metadata=oci.data_integration.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(
                            "2021-05-04T15:03:14.028Z",
                            "%Y-%m-%dT%H:%M:%S.%fZ"),
                        time_updated=datetime.strptime(
                            "2000-06-20T11:23:08.388Z",
                            "%Y-%m-%dT%H:%M:%S.%fZ"),
                        aggregator_key="EXAMPLE-aggregatorKey-Value",
                        aggregator=oci.data_integration.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_6ymZe': 'EXAMPLE_VALUE_1JxhRFdTAFoGriPV1LW2'},
                        registry_version=32,
                        labels=["EXAMPLE--Value"],
                        is_favorite=False),
                    username="EXAMPLE-username-Value",
                    password="EXAMPLE-password-Value",
                    password_secret=oci.data_integration.models.SensitiveAttribute(
                        secret_config=oci.data_integration.models.OciVaultSecretConfig(
                            model_type="OCI_VAULT_SECRET_CONFIG",
                            secret_id="ocid1.test.oc1..<unique_ID>EXAMPLE-secretId-Value"),
                        value="EXAMPLE-value-Value"))),
            connection=oci.data_integration.models.ConnectionFromJdbc(
                model_type="GENERIC_JDBC_CONNECTION",
                key="EXAMPLE-key-Value",
                model_version="EXAMPLE-modelVersion-Value",
                parent_ref=oci.data_integration.models.ParentReference(
                    parent="EXAMPLE-parent-Value"),
                name="EXAMPLE-name-Value",
                description="EXAMPLE-description-Value",
                object_version=943,
                object_status=83,
                identifier="EXAMPLE-identifier-Value",
                primary_schema=oci.data_integration.models.Schema(
                    key="EXAMPLE-key-Value",
                    model_type="EXAMPLE-modelType-Value",
                    model_version="EXAMPLE-modelVersion-Value",
                    parent_ref=oci.data_integration.models.ParentReference(
                            parent="EXAMPLE-parent-Value"),
                    name="EXAMPLE-name-Value",
                    resource_name="EXAMPLE-resourceName-Value",
                    description="EXAMPLE-description-Value",
                    object_version=384,
                    external_key="EXAMPLE-externalKey-Value",
                    is_has_containers=True,
                    default_connection="EXAMPLE-defaultConnection-Value",
                    object_status=571,
                    identifier="EXAMPLE-identifier-Value",
                    metadata=oci.data_integration.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(
                                "2045-06-05T09:07:07.661Z",
                            "%Y-%m-%dT%H:%M:%S.%fZ"),
                        time_updated=datetime.strptime(
                            "2044-02-08T21:45:58.957Z",
                            "%Y-%m-%dT%H:%M:%S.%fZ"),
                        aggregator_key="EXAMPLE-aggregatorKey-Value",
                        aggregator=oci.data_integration.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_kcCJX': 'EXAMPLE_VALUE_WmZM8q1K4DvFRRMmSboy'},
                        registry_version=399,
                        labels=["EXAMPLE--Value"],
                        is_favorite=True)),
                connection_properties=[
                    oci.data_integration.models.ConnectionProperty(
                        name="EXAMPLE-name-Value",
                        value="EXAMPLE-value-Value")],
                is_default=False,
                metadata=oci.data_integration.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(
                        "2039-12-11T23:28:16.466Z",
                        "%Y-%m-%dT%H:%M:%S.%fZ"),
                    time_updated=datetime.strptime(
                        "2027-08-26T20:12:25.574Z",
                        "%Y-%m-%dT%H:%M:%S.%fZ"),
                    aggregator_key="EXAMPLE-aggregatorKey-Value",
                    aggregator=oci.data_integration.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_qVHGR': 'EXAMPLE_VALUE_eKGBqrVDXo7nJsOKxcVQ'},
                    registry_version=991,
                    labels=["EXAMPLE--Value"],
                    is_favorite=True),
                key_map={
                    'EXAMPLE_KEY_3nGB1': 'EXAMPLE_VALUE_OilOTo7si5DhS6pgWeC8'},
                username="EXAMPLE-username-Value"),
            compartment_id="ocid1.test.oc1..<unique_ID>EXAMPLE-compartmentId-Value",
            schema=oci.data_integration.models.Schema(
                key="EXAMPLE-key-Value",
                model_type="EXAMPLE-modelType-Value",
                model_version="EXAMPLE-modelVersion-Value",
                parent_ref=oci.data_integration.models.ParentReference(
                    parent="EXAMPLE-parent-Value"),
                name="EXAMPLE-name-Value",
                resource_name="EXAMPLE-resourceName-Value",
                description="EXAMPLE-description-Value",
                object_version=545,
                external_key="EXAMPLE-externalKey-Value",
                is_has_containers=True,
                default_connection="EXAMPLE-defaultConnection-Value",
                object_status=623,
                identifier="EXAMPLE-identifier-Value",
                metadata=oci.data_integration.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(
                            "2032-03-11T19:49:00.648Z",
                            "%Y-%m-%dT%H:%M:%S.%fZ"),
                    time_updated=datetime.strptime(
                        "2022-08-28T15:10:38.977Z",
                        "%Y-%m-%dT%H:%M:%S.%fZ"),
                    aggregator_key="EXAMPLE-aggregatorKey-Value",
                    aggregator=oci.data_integration.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_XYToo': 'EXAMPLE_VALUE_S089lGZylDULTNch8h6b'},
                    registry_version=762,
                    labels=["EXAMPLE--Value"],
                    is_favorite=False)))),
    opc_request_id="PWJ2V5DP4GTGIWFDOKJI/OpcRequestIdExample/<unique_ID>",
    opc_retry_token="EXAMPLE-opcRetryToken-Value")

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